Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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.

share|improve this question
    
@m_goldberg, I don't have this error message on v8. –  Öskå Jun 5 at 13:20
    
@Ö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 –  m_goldberg Jun 5 at 13:22
    
@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 :) –  Öskå Jun 5 at 13:28
add comment

2 Answers 2

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

share|improve this answer
    
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? –  user14782 Jun 5 at 14:34
add comment
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

share|improve this answer
    
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) . –  user14782 Jun 5 at 14:03
    
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. –  Öskå Jun 5 at 14:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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