ode2 manual example



The second ode2  example in the manual is a second
order nonlinear ode in which a particular solution
is chosen so that at x = 0, y = 0, and dydx = 2.

The implicit solution for y as a function of x
is  3*y - 2*y^3  =  6*x , or y * (3 - 2*y^2) = 6*x
which indeed has one solution which is zero
when x = 0.

The first derivative of this implicit solution gives
dydx = 2/(1 - 2*y^2), which says dydx = 2
when y = 0.

But when I ask solve for explicit solutions
( exsoln below ), the first returned solution
has y1(0) = 0, dy1dx(0) = -1,
and the third returned solution has
 y3(0) = sqrt(3/2), dy3dx(0) = 2.

So how do we recover an explicit solution
which agrees with that returned by ic2?
(ie which has y(0) = 0 and dydx(0) = 2)?

--------------------------------------------------------
(%i1) display2d:false$

(%i2) de : 'diff(y,x,2) + y*'diff(y,x)^3;
(%o2) 'diff(y,x,2)+y*('diff(y,x,1))^3

(%i3) gsoln : ode2(%,y,x);
(%o3) (y^3+6*%k1*y)/6 = x+%k2
(%i4) ev(de,gsoln,diff);
(%o4) 0

(%i5) ic2(gsoln,x=0,y=0,diff(y,x)=2);
(%o5) (y^3-3*y*(y^2-1))/6 = x
(%i6) impsoln : 6*ratsimp(%);
(%o6) 3*y-2*y^3 = 6*x

(%i7) depends(y,x)$
(%i8) diff(impsoln,x);
(%o8) 3*'diff(y,x,1)-6*y^2*'diff(y,x,1) = 6
(%i9) solve(%,'diff(y,x));
(%o9) ['diff(y,x,1) = -2/(2*y^2-1)]
(%i10) kill(y)$

use solve for explicit soln:

(%i11) exsoln : map('rhs,solve(impsoln,y))$

look at x = 0 values of y
(%i12) rectform( subst(x=0,exsoln) );
(%o12) [ 0, -2^-(1/2)*sqrt(3),  sqrt(3)/sqrt(2)]

(%i13) dexsoln : diff(exsoln,x)$

look at x = 0 values of first derivatives

(%i14) rectform( subst(x=0,dexsoln) );
(%o14) [ -1, -1,  2 ]

 the following adds nothing new--
simply looks at first and third solution
again

(%i15) y1 : first(exsoln)$
(%i16) y3 : third(exsoln)$
(%i17) rectform( subst(x=0,[y1,y3]) );
(%o17)  [ 0,  sqrt(3)/sqrt(2) ]

(%i18) dy1dx : diff(y1,x)$
(%i19) dy3dx : diff(y3,x)$
(%i20) rectform( subst(x = 0,[dy1dx, dy3dx]) );
(%o20) [ -1, 2 ]
-------------------------------
I guess I'm looking for a nonlinear answer ;)

Ted Woollett
win xp, 5.18.1