1
$\begingroup$

Consider the following solution of NDSolve

tf = 100;
sol = NDSolve[{x'[t] == -x[t] + 0.1 y[t] + x[t]^2 y[t], 
    y'[t] == 0.5 - 0.1 y[t] - x[t]^2 y[t], x[0] == 0.5, y[0] == 1.5},
   {x, y}, {t, 0, tf}];
xFunc = x /. First@sol;
Plot[xFunc[t], {t, 0, tf}]

The plot produces enter image description here

How can I obtain the inverse function of xFunc[t], such that the plot will produce

enter image description here

$\endgroup$
3
$\begingroup$

Maybe like so:

tf = 100;
sol = NDSolve[{x'[t] == -x[t] + 0.1 y[t] + x[t]^2 y[t], 
y'[t] == 0.5 - 0.1 y[t] - x[t]^2 y[t], x[0] == 0.5, 
y[0] == 1.5}, {x, y}, {t, 0, tf}];
xFunc = x /. First@sol;
ParametricPlot[{xFunc[t], t}, {t, 0, tf}, AspectRatio -> 1]

enter image description here

Thanks to a good suggestion of user Michael E2

 ParametricPlot[{xFunc[t], -t}, {t, 0, tf}, AspectRatio -> 1, 
 Ticks -> {Automatic, Charting`ScaledTicks[{-# &, -# &}]}]
 Rotate[Plot[xFunc[t], {t, 0, tf}], -90 Degree](*and  My try :P *)
$\endgroup$
  • $\begingroup$ I've tried that, but in this manner, ScalingFunctions can not be used in parametric plot, and the plot can not be reversed. $\endgroup$ – jarhead May 6 '18 at 9:52
  • $\begingroup$ @jarhead. What ScalingFunctions do you need? $\endgroup$ – Mariusz Iwaniuk May 6 '18 at 10:34
  • $\begingroup$ It needs to be reversed as In the figure in the question. In any case the inverse function is needed as well. $\endgroup$ – jarhead May 6 '18 at 11:33
  • $\begingroup$ @jarhead The function does not have inverse function (not one-to-one/injective). Please clarify. $\endgroup$ – Michael E2 May 6 '18 at 11:57
  • 2
    $\begingroup$ ParametricPlot[{xFunc[t], -t}, {t, 0, tf}, AspectRatio -> 1, Ticks -> {Automatic, Charting`ScaledTicks[{-# &, -# &}]}] gives the desired graphics, I think. $\endgroup$ – Michael E2 May 6 '18 at 11:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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