3
$\begingroup$

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.

$\endgroup$
1

2 Answers 2

1
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ That's so cool! $\endgroup$
    – Chris K
    Commented Mar 9, 2022 at 6:22
1
$\begingroup$

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

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.