Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica: Trouble accurately integrating highly-nonlinear DE

  1. Aug 16, 2013 #1

    I'd like to numerically solve the IVP:

    [tex]x^2 y y''+2x y y'+2 y^2+xy'-x^2 y^3-(x y')^2-y=0,\quad y(x_0)=1,y'(x_0)=0[/tex]

    around the unit circle, [itex]x=e^{it}[/itex]. When I attempt to solve it around the entire circle, I think the integration is veering of course. I believe the solution is single-valued which means it should return to the starting point after a [itex]2\pi[/itex] route or at least be closer than in the figure below which shows the imaginary solution. And I'm pretty sure the large dip in the plot below is reflecting a loss of accuracy along the route. I've tried decreasing the step size and increasing working precision, trying a different method, but cannot get the the start and end points closer. I was wondering if someone here could suggest perhaps a better method to use or other NDSolve parameters that might help. Also, the code below reflects the change in variable [itex]x(t)=e^{it}[/itex]. There is always the possibility that the path is near a singular point and that would be causing the problem. However, even if I change the radius by letting [itex]x(t)=re^{it}[/itex], for any radius, I still run into the same problem.


    Here's the code I'm using:

    Code (Text):

    x = Exp[I t];

    reim = Im;

    tstart = 0;

    tend = tstart + 2 \[Pi];

    myeqn5 = -I x y[t] y''[t] - x y[t] y'[t] -
        I y'[t] (2 y[t] + 1 + I y'[t]) + 2 y[t]^2 - x^2 y[t]^3 - y[t] == 0;
    mysol5 = NDSolve[{myeqn5, y[tstart] == 1 , y'[tstart] == 0},
      y, {t, tstart, tend}, WorkingPrecision -> 45, MaxStepSize -> 0.001,
      MaxSteps -> 100000, AccuracyGoal -> 30, PrecisionGoal -> 30];

    p1 = ParametricPlot3D[{Re[z], Im[z], reim[y[t] /. mysol5]} /.
       z -> r Exp[I t], {t, tstart, tend}, BoxRatios -> {1, 1, 1},PlotRange->All]

    Attached Files:

    Last edited: Aug 16, 2013
  2. jcsd
  3. Aug 16, 2013 #2
    Afraid I made a mistake differentiating. The equation in t I believe should be:

    [tex]-y(y''-iy')+iy'(2y+1+i y')+2y^2-x^2 y^3-y=0[/tex]

    However, I seem to be getting the same problem even with this corrected equation.

    Sorry for the mistake and the second post. Wasn't sure the best way to edit the post. Think I'll take a step back and check everything out and try some more.

    Last edit I hope: After studying the numeric solution and trying to improve the accuracy of the results, I have reached the conclusion that there is nothing wrong with the integration but rather my hypothesis that the solution was either single-valued or n-sheeted is flawed: If the solution contains a log term either explicitly or implicitly such as inverse trig functions, then the numeric solution around a circle would never return to the starting point because of the geometry of the complex log function. It appears this may be the case.

    My apologies if anyone has spent time looking or working on this problem.
    Last edited: Aug 16, 2013
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook