Green Lab. 1/20 MAXIMA & ODE2 Cheng Ren, Lin Department of Marine Engineering National Kaohsiung Marine University email: crlin@mail.nkmu.edu.tw
Objectives learn MAXIMA learn ODE2 2/20
ODE2 Method First Order y = f(x, y) Separable Differential Equations dy g(x) = f(x, y) = h(y)dy = g(x)dx dx h(y) 3/20 y h(y)dy = x g(x)dx (%i2) eq1:(3*x 2+4*x+2)=(2*y-1)*diff(y,x); (%o2) (%i3) ode2(eq1,y,x); (3x 2 + 4x + 2) = (2y 1) dy dx
(%o3) y 2 y = x 3 + 2x 2 + 2x + %C 4/20 Exact Differential Equations M(x, y)dx + N(x, y)dy = 0 If M y = N x, general solution F (x, y) = C can be found by: F x dx + y dy = 0 df (x, y) = F F x = M(x, y) F = M(x, y)dx + G(y) F y = N(x, y) = y M(x, y) x + d dy [ ( G(y) )] G(y) = N(x, y) M(x, y) x dy y
F (x, y) = M(x, y)dx + [ N(x, y) y ] M(x, y) x dy = Constant 5/20 (%i2) p:diff(y,x)$ (%i3) eq21:x 2*cos(x*y)*p+sin(x*y)+x*y*cos(x*y)=0; (%o3) sin(xy) + x 2dy cos(xy) + xy cos(xy) = 0 dx (%i4) ode2(eq21,y,x); (%o4) sin(xy) = %C
Integrating Factors M(x, y)dx + N(x, y)dy = 0 If M y N x, it may be possible to find an integrating factor σ(x, y) so that σ(x, y)m(x, y)dx + σ(x, y)n(x, y)dy = 0 is exact. That is y (σm) = x (σn). (%i2) eq22:(2*x*y-exp(-2*y))*diff(y,x)+y=0; (%o2) (%i3) ode2(eq22,y,x); (%o3) (2xy e 2y ) dy dx + y = 0 xe 2y log y = %C 6/20
(%i4) intfactor; (%o4) e 2y y 7/20 Homogeneous Differential Equations y = f( y x ) Can be made separable by setting u = y/x, dy dx = u + xdu dx. We will have du f(u) u = dx x. (%i2) eq4:diff(y,x)=(y/x) 2+2*(y/x);
(%o2) dy dx = y2 x + 2y 2 x (%i3) ode2(eq4,y,x); (%o3) xy + x2 y = %C 8/20 Linear Differential Equations y + p(x)y = q(x) (%i2) eq3:x 2*diff(y,x)+3*x*y=sin(x)/x; (%o2) x 2dy dx + 3xy = sin x x
(%i3) ode2(eq3,y,x); (%o3) y = %C cos x x 3 9/20 Bernoulli Equations dy dx + P (x)y = Q(x)yn, n 0, 1 (%i2) eq5:diff(y,x)+(2/x)*y=(1/x 2)*y 3; (%o2) dy dx + 2y x = y3 x 2
(%i3) ode2(eq5,y,x); (%o3) y = x 2 2 1 5x 5 + %C 10/20 MAXIMA can not solve Clairaut equation : y = xy + f(y ) (%i2) eq:y=x*diff(y,x)+(diff(y,x)) 2/2; (%o2) dx )2 y = x dy dx + (dy 2
(%i3) ode2(eq,y,x); (%o3) First order equation not linear in y Riccati equation : y + p(x)y = g(x)y 2 + h(x) (%i2) eq:diff(y,x)=y 2+2*x*y-4*x-4; (%o2) dy dx = y2 + 2xy 4x 4 11/20 (%i3) ode2(eq,y,x); (%o3) False
ODE2 Method Second Order a 0 (x) d2 y dx 2 + a 1(x) dy dx + a 2(x)y = f(x) 12/20 we have the solution set is {y 1 (x), y 2 (x)} Constant coefficients and homogeneous (f(x) = 0) d 2 y a 0 dx + a dy 2 1 dx + a 2y = 0 (%i2) eq521:diff(y,x,2)-diff(y,x)-6*y=0; (%o2) d 2 y dx dy 2 dx 6y = 0 (%i3) ode2(eq521,y,x);
(%o3) y = %K 1 e 3x + %K 2 e 2x (%i4) eq522:diff(y,x,2)-9*y=0; (%o4) d 2 y dx 9y = 0 2 (%i5) ode2(eq522,y,x); (%o5) y = %K 1 e 3x + %K 2 e 3x (%i6) eq523:diff(y,x,2)+9*y=0; (%o6) d 2 y dx + 9y = 0 2 (%i7) ode2(eq523,y,x); (%o7) y = %K 1 sin(3x) + %K 2 cos( 3x) 13/20
(%i8) eq524:diff(y,x,2)+9*y=0; (%o8) d 2 y dx + 9y = 0 2 (%i9) ode2(eq524,y,x); (%o9) y = e [%K 2x 1 sin( 3x) + %K 2 cos( ] 3x) 14/20 Constant coefficients and nonhomogeneous (f(x) 0) d 2 y a 0 dx + a dy 2 1 dx + a 2y = f(x) (%i2) eq531:diff(y,x,2)-3*diff(y,x)+2*y=2*sinh(x); (%o2) d 2 y dx 2 3dy dx + 2y = 2 sinh x
(%i3) ode2(eq531,y,x); (%o3) [ y = e x (6x + 6)e 6x e 2x + 1 ] 6 + %K 1 e 2x + %K 2 e x 15/20 (%i4) method; (%o4) VARIATIONOFPARAMETERS Nonconstant coefficients a 0 (x) d2 y dx + a 1(x) dy 2 dx + a 2(x)y = f(x)
Cauchy-Euler equation: x 2d2 y dx 2 + c 1x dy dx + c 2y = f(x), where c 1 and c 2 are constants (%i2) eq541:x 2*diff(y,x,2)-2*x*diff(y,x)-10*y=0; (%o2) x 2d2 y dx 2 2xdy dx 10y = 0 16/20 (%i3) ode2(eq541,y,x); (%o3) (%i4) method; (%o4) y = %K 1 x 5 + %K 2 x 2 EULER
Bessel s equation of order ν: 17/20 x 2 y + xy + (x 2 ν 2 )y = f(x), where ν is a nonnegative real number (%i1) depends([y,p],x)$ (%i2) p:diff(y,x)$ (%i3) eq:x 2*diff(p,x)+x*p+(x 2-1/4)*y=0; (%o3) (%i4) ode2(eq,y,x); x 2d2 y dx 2 + xdy dx + (x2 1 4 )y = 0
(%o4) (%i5) method; (%o5) y = %K 1 sin x + %K 2 cos x x BESSEL 18/20 (%i6) eq:x 2*diff(p,x)+x*p+(x 2-4)*y=0; (%o6) x 2d2 y dx 2 + xdy dx + (x2 4)y = 0 (%i7) ode2(eq,y,x); (%o7) y = %K 2 Y 2 (x) + %K 1 J 2 (x)
J ν (x) is the Bessel function of the first kind, of order ν Y ν (x) is the Bessel function of the second kind, of order ν 19/20
References Maxima Homepage (http://maxima.sourceforge.net/) Greenberg, M. D., Advanced Engineering Mathematics. 2 nd ed., Prentice-Hall, 1998. Michael J. Wester, Computer Algebra Systems: Guide, John Wiley & Sons, 1999. A Practical Kreyszig, E., Advanced Engineering Mathematics. 8 th ed., John Wiley & Sons, 1999. 20/20