Relatively simple, but problematic, non-linear ODE
- To: mathgroup at smc.vnet.net
- Subject: [mg71956] Relatively simple, but problematic, non-linear ODE
- From: "Alan" <info at optioncity.REMOVETHIS.net>
- Date: Wed, 6 Dec 2006 06:03:33 -0500 (EST)
I am trying to find positive, non-decreasing solutions y(z)
on the interval (0,z), z > 0 to the ODE:
(y')^2 - rho y y' + (1/4) y^2 = 1, with y[0] = 0.
where y' = dy/dz, and the constant parameter |rho| < 1.
There are generally two solutions. The one I want has the
same sign as z.
Here is my code:
FSolver[z_, rho_] :=
Module[{solnpair, vals, ans},
solnpair = y[x] /. NDSolve[{y'[x]^2 - rho y'[x] y[x] + (1/4) y[x]^2
== 1,
y[0] == 0}, y[x], {x, 0, z}];
vals = Re[solnpair /. x -> z];
ans = Select[vals, (Sign[#] == Sign[z]) &][[1]];
Return[ans];
You can see that y[x] = 2 is also a solution to the ODE.
The solution I want apparently switches to y = 2
at some critical value of z. The problem is that this causes Mathematica to
choke.
For example, for rho = 0, the exact solution is y(z) = 2 Sin(z/2)
for |z| < Pi and y(z) = 2 for larger z. I can fix things for rho = 0, since
I
am very confident about the answer. But I am less confident about
the solution for rho not equal to zero.
For example, run my fragment with z = 3, rho = 1/2 to see the problems.
Any suggestions on how to get some reliable output
from NDSolve for this problem will be much appreciated.
Thanks!
alan