Re: Relatively simple, but problematic, non-linear ODE
- To: mathgroup at smc.vnet.net
- Subject: [mg72002] Re: Relatively simple, but problematic, non-linear ODE
- From: dh <dh at metrohm.ch>
- Date: Thu, 7 Dec 2006 06:26:22 -0500 (EST)
- Organization: hispeed.ch
- References: <el685m$2p9$1@smc.vnet.net>
Hi Alan,
your diff. equ. has a singular solution y==2, that is a solution that is
tangential to a family of solutions. At a point with y==2 we have 2
solutions runing through this point and every numerical procedure will
have problems.
You can convince yourself by calculating and analytical solution:
rho = 0; z = 3.2;
res = 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}];
Plot[Evaluate[res], {x, -3, z}]
Daniel
Alan wrote:
> 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
>
>