1
$\begingroup$

I want to solve $dx/dt=\sqrt{(1-x^2)}$, where $x$ is complex. When I solve it by hand and analytically for some initial value and draw the imaginary part versus the real part, I obtain an ellipse, as expected. I tried to solve it with Mathematica, but I failed. Here is my code:

s = NDSolve[{x'[t] == (1 - x[t]^2)^0.5, x[0] == 1 + I}, x[t], {t, 0, 10},
      Method -> "ExplicitMidpoint",   "StartingStepSize" -> 1/10];

ParametricPlot[Evaluate[{Re[x[t]], Im[x[t]]} /. s], {t, 0, 10}, PlotRange -> Full]

Mathematica graphics

I would appreciate if someone could help me to fix the problem.

$\endgroup$
  • $\begingroup$ @m_goldberg, I don't have this error message on v8. $\endgroup$ – Öskå Jun 5 '14 at 13:20
  • $\begingroup$ @Öskå. Got message ">NDSolve::mxst: Maximum number of 10000 steps reached at the point t == 0.9045874497947668`. >> " from V9.0.1 running on OS X $\endgroup$ – m_goldberg Jun 5 '14 at 13:22
  • $\begingroup$ @m_goldberg That's what I expected :) I guess it's relevant to have it as a comment or as a side note in the question :) $\endgroup$ – Öskå Jun 5 '14 at 13:28
2
$\begingroup$

NDSolve is having trouble dealing with t outside the interval {-2.235, .9}. Also, for the initial condition x[0] == 1 + I, it only gets the top half of the ellipse. A work-around is:

s1 = NDSolve[{x'[t] == (1. - x[t]^2)^0.5, x[0] == 1 + I}, x, {t, -2.235, .9}];
s2 = NDSolve[{x'[t] == (1. - x[t]^2)^0.5, x[0] == 1 - I}, x, {t, -2.235, .9}];
pp1 = ParametricPlot[Evaluate[{Re[x[t]], Im[x[t]]} /. s1], {t, -2.235, .9}];
pp2 = ParametricPlot[Evaluate[{Re[x[t]], Im[x[t]]} /. s2], {t, -2.235, .9}];
Show[pp1, pp2, PlotRange -> All]

plot

$\endgroup$
  • $\begingroup$ Actually I want to use this code for more general equations such as dx/dt=sqrt(1 + (I x)^3), for example for x(0)=-2 - 3I. But it seems it does not work for this case. How can I generalize this code for this equation? $\endgroup$ – user14782 Jun 5 '14 at 14:34
0
$\begingroup$
s = Quiet@DSolve[{x'[t]==(1-x[t]^2)^(1/2),x[0]==1+I},x[t],t][[1]]

{x[t] -> Sin[t + ArcSin[1 + I]]}

ParametricPlot[Evaluate[{Re[x[t]],Im[x[t]]}/.s],{t,0,2Pi}]

enter image description here

$\endgroup$
  • $\begingroup$ Thanks you for your attention. But I want to solve it numerically, I mean by NDSolve. Because I want to apply the method for equations which do not have analytic answer, like: dx/dt=sqrt(1+(I x)^3) . $\endgroup$ – user14782 Jun 5 '14 at 14:03
  • $\begingroup$ I removed Off[] and replaced it by Quiet. After using Off[] one needs to turn On[] again the messages. Quiet has the same effect in that case. $\endgroup$ – Öskå Jun 5 '14 at 14:07

Your Answer

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