3

I was looking to apply a nonlinear transformation to a geometric region, say a rectangle to obtain a transformed region. According to the documentation for TransformedRegion, one requires a Region and a function. I am trying to use the flow (solution) of an ODE at some time $t$ as the function transforming the region. I am using ParametricNDSolveValue to get the flow numerically as a function of the initial condition at some given time. Here is my attempt.

(*Ft is the flow of the ODE at time t=1, starting at (a,b)*)
ODEs = {x'[t] == y[t], y'[t] == Sin[x[t]], x[0] == a, y[0] == b};
Ft = ParametricNDSolveValue[ODEs, {x[1], y[1]}, {t, 0, 2}, {a, b}];
R = Rectangle[{-1,-1},{1,1}];
FtR = TransformedRegion[R,Ft]; 

But I am getting the following error:

TransformedRegion::vfunc: ParametricFunction[1,Internal`Bag[<1>],0,1,{{a$109714,b$109715},<<5>>,{0,1}},{NDSolve`base$109724,NDSolve`NDSolveParametricFunction[0,{ParametricNDSolveValue,Internal`Bag[<2>],None,ParametricNDSolveValue},<<6>>,{},{2.}]}] evaluated at a list of length 2 should give a non-empty list.

I thought I could define some function:

FtF = Function[{a, b}, Ft[a, b]]

And apply this instead, but

FtR = TransformedRegion[R, FtF] 

Gives

TransformedRegion::vfunc: Function[{a,b},Ft[a,b]] evaluated at a list of length 2 should give a non-empty list.

Any advice would be appreciated.

NoobNoob
  • 159
  • 5
  • Duplicate, nearly (even the same ODE): https://mathematica.stackexchange.com/questions/34837/how-to-draw-the-image-of-a-circle-under-the-action-of-a-transformation-of-the-ph/34838#34838 – Michael E2 Mar 09 '22 at 06:15

2 Answers2

1

Maybe TransformedRegion only accept symbol expression. By now we have to use ParametricPlot and DiscretizeGraphics to obtain such region.

ODEs = {x'[t] == y[t], y'[t] == Sin[x[t]], x[0] == a, y[0] == b};
Ft = ParametricNDSolveValue[ODEs, {x[1], y[1]}, {t, 0, 2}, {a, b}];
R = Rectangle[{-1, -1}, {1, 1}];
plot = ParametricPlot[Ft[a, b], {a, b} ∈ R]
DiscretizeGraphics[plot]

enter image description here

cvgmt
  • 72,231
  • 4
  • 75
  • 133
1

A work-around: Apply Ft to the MeshCoordinates of boundary-discretized R:

transformedRegion[reg_, f_] := MeshRegion[
   f @@@ MeshCoordinates[#], 
   MeshCells[#, All]] & @
  BoundaryDiscretizeRegion @ reg

transformedRegion[R, Ft]

enter image description here

kglr
  • 394,356
  • 18
  • 477
  • 896