3
$\begingroup$

I have a differential equation

$\frac{dx}{dt} = \sqrt{1+x^4}$

$x$ is a complex variable.

I want to solve it for some given initial condition, and plot the solution (real part vs. imaginary part).

I've tried this

sol = NDSolve[{x'[t] == Sqrt[1 + x[t]^4], x[0] == 1 + I}, x[t], {t, 0, 20}, Method -> "ExplicitMidpoint", "StartingStepSize" -> 1/1000];
ParametricPlot[Evaluate[{Re[x[t]], Im[x[t]]} /.sol], {t, 0, 20}]

But the result is not what I was expecting, it should be something similar to this

enter image description here

But if I use the direction fields:

With[{xMin = 3}, StreamPlot[{Re[#], Im[#]} &[Sqrt[1 + (x + I y)^4]], {x, -xMin, xMin}, {y, -xMin, xMin}]]

The result somehow resembles what I want:

enter image description here

How can I obtain the correct plot just by solving the differential equation?

$\endgroup$
4
  • $\begingroup$ Plot3D[Re[Sqrt[1 + (re + im*I)^4]], {re, 0, 2}, {im, 0, 2}] and Plot3D[Im[Sqrt[1 + (re + im*I)^4]], {re, 0, 2}, {im, 0, 2}] show a branch cut that is probably giving NDSolve fits. Sorry, I don't have a fix though! $\endgroup$
    – Chris K
    Jan 10, 2019 at 19:05
  • $\begingroup$ What's the source of your expected plot? $\endgroup$
    – Chris K
    Jan 10, 2019 at 19:20
  • $\begingroup$ @ Chris K Thanks for your comment. It's a part of my university homework. $\endgroup$ Jan 10, 2019 at 19:28
  • $\begingroup$ Mathematica can solve this exactly by separating the variables and integrating, which will give same curve as Michael E2's, but I don't understand what parameter you are varying to get your other expected curves. $\endgroup$
    – Bill Watts
    Jan 11, 2019 at 1:13

1 Answer 1

4
$\begingroup$

This, which is substantially the same as the OP's, looks correct as far as it goes:

sol = NDSolve[{x'[t] == Sqrt[1 + x[t]^4], x[0] == 1 + I}, 
   x, {t, -3, 3}, Method -> "ExplicitMidpoint", "StartingStepSize" -> 1/1000];
ParametricPlot[Evaluate[{Re[x[t]], Im[x[t]]} /. sol], 
 Evaluate@Flatten@{t, x["Domain"] /. sol[[1]]}, AspectRatio -> 0.6]

enter image description here

You can see from the StreamPlot that the stream lines reverse direction where the plot of sol stops. That is why the integration stops.

A workaround is to raise the order by differentiating the rationalized ODE:

sol = NDSolve[{D[x'[t]^2 == 1 + x[t]^4, t], x[0] == 1 + I, 
    x'[0] == Sqrt[1 + x[0]^4]}, x, {t, -3, 3}, 
   Method -> "ExplicitMidpoint", "StartingStepSize" -> 1/1000];
ParametricPlot[Evaluate[{Re[x[t]], Im[x[t]]} /. sol], 
 Evaluate@Flatten@{t, x["Domain"] /. sol[[1]]}, AspectRatio -> 0.6]

enter image description here

$\endgroup$
3
  • $\begingroup$ This is very intelligent. $\endgroup$ Jan 10, 2019 at 20:03
  • $\begingroup$ @Callmeatomato. Thanks for the compliment and the accept. I feel like it's a standard trick. The same trick was used on a much thornier problem here by Carl Woll and by me, as well as in one of the Q&A linked to it. $\endgroup$
    – Michael E2
    Jan 10, 2019 at 21:44
  • $\begingroup$ Thanks for the link. Your answer to that question is frightening! I need a couple of months to digest that. $\endgroup$ Jan 10, 2019 at 22:09

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.