# # Several Second Order differential equations are solved and checked. # An auxiliary procedure LZ is used to facilitate the solutions. # # Art Belmonte # Mon, 27/May/96 # Math 308-509 [Maple V Release 4] # Lecture, introducing: # LZ: Set up for 2nd order homogeneous constant coefficient differential # equations # # Define the procedure LZ > unprotect(LZ): > LZ:=proc(c) > local a,d,k,L,n,p,r,s,x,y,Z; > n:=nops(c) - 1; > a:=array(0..n, c); > p:=0; s:=0; > for k from 0 to n do > p:=p + a[k]*r^(n-k); > s:=s + a[k]*(D@@(n-k))(y) > od; > L:=unapply(s, y); > Z:=unapply(p, r); > [eval(L), eval(Z)] > end: > protect(LZ): # Ex 1 (S3. 1, T-120/7 ) > > unassign('y'); setup:=LZ([1, -9, 9]); > L:=setup[1]; Z:=setup[2]; > deq:={convert(L(y)(x)=0, diff)}; > (2) 2 setup := [y -> (D )(y) - 9 D(y) + 9 y, r -> y - 9 y + 9] (2) L := y -> (D )(y) - 9 D(y) + 9 y 2 Z := r -> r - 9 r + 9 / 2 \ |d | /d \ deq := {|--- y(x)| - 9 |-- y(x)| + 9 y(x) = 0} | 2 | \dx / \dx / > rt:=solve(Z(r)=0, r); 1/2 1/2 rt := 9/2 + 3/2 5 , 9/2 - 3/2 5 > y:=unapply(c1*exp(rt[1]*x) + c2*exp(rt[2]*x), x); 1/2 1/2 y := x -> c1 exp((9/2 + 3/2 5 ) x) + c2 exp((9/2 - 3/2 5 ) x) > check:=simplify(deq); check := {0 = 0} # Ex 2 (S3.1, T-120/11) > unassign('y'); setup:=LZ([6, -5, 1]); (2) 2 setup := [y -> 6 (D )(y) - 5 D(y) + y, r -> 6 y - 5 y + 1] > L:=setup[1]; Z:=setup[2]; (2) L := y -> 6 (D )(y) - 5 D(y) + y 2 Z := r -> 6 r - 5 r + 1 > deq:={convert(L(y)(x)=0, diff)}; / 2 \ |d | /d \ deq := {6 |--- y(x)| - 5 |-- y(x)| + y(x) = 0} | 2 | \dx / \dx / > IC:={y(0)=4, D(y)(0)=0}; IVP:=deq union IC; IC := {y(0) = 4, D(y)(0) = 0} / 2 \ |d | /d \ IVP := {6 |--- y(x)| - 5 |-- y(x)| + y(x) = 0, y(0) = 4, D(y)(0) = 0} | 2 | \dx / \dx / > rt:=solve(Z(r)=0, r); rt := 1/3, 1/2 > y:=unapply(c1*exp(rt[1]*x) + c2*exp(rt[2]*x), x); y := x -> c1 exp(1/3 x) + c2 exp(1/2 x) > eqs:=IC; sol:=solve(eqs, {c1, c2}); eqs := {c1 + c2 = 4, 1/3 c1 + 1/2 c2 = 0} sol := {c1 = 12, c2 = -8} > y:=unapply(subs(sol, y(x)), x); y := x -> 12 exp(1/3 x) - 8 exp(1/2 x) > check:=simplify(IVP); check := {0 = 0, 4 = 4} # Ex 3 (S3.4, T-142/11) > unassign('y'); setup:=LZ([1, 6, 13]); (2) 2 setup := [y -> (D )(y) + 6 D(y) + 13 y, r -> y + 6 y + 13] > L:=setup[1]; Z:=setup[2]; (2) L := y -> (D )(y) + 6 D(y) + 13 y 2 Z := r -> r + 6 r + 13 > deq:={convert(L(y)(x)=0, diff)}; / 2 \ |d | /d \ deq := {|--- y(x)| + 6 |-- y(x)| + 13 y(x) = 0} | 2 | \dx / \dx / > rt:=solve(Z(r)=0, r); rt := -3 + 2 I, -3 - 2 I > y:=unapply(c1*exp(Re(rt[1])*x)*cos(Im(rt[1])*x) > + c2*exp(Re(rt[1])*x)*sin(Im(rt[1])*x), x); y := x -> c1 exp(-3 x) cos(2 x) + c2 exp(-3 x) sin(2 x) > check:=simplify(deq); check := {0 = 0} # Ex 4 (S3.4, T-142/18) > unassign('y'); setup:=LZ([1, 4, 5]); (2) 2 setup := [y -> (D )(y) + 4 D(y) + 5 y, r -> y + 4 y + 5] > L:=setup[1]; Z:=setup[2]; (2) L := y -> (D )(y) + 4 D(y) + 5 y 2 Z := r -> r + 4 r + 5 > deq:={convert(L(y)(x)=0, diff)}; / 2 \ |d | /d \ deq := {|--- y(x)| + 4 |-- y(x)| + 5 y(x) = 0} | 2 | \dx / \dx / > IC:={y(0)=1, D(y)(0)=0}; IVP:=deq union IC; IC := {y(0) = 1, D(y)(0) = 0} / 2 \ |d | /d \ IVP := {y(0) = 1, |--- y(x)| + 4 |-- y(x)| + 5 y(x) = 0, D(y)(0) = 0} | 2 | \dx / \dx / > rt:=solve(Z(r)=0, r); rt := -2 + I, -2 - I > y:=unapply(c1*exp(Re(rt[1])*x)*cos(Im(rt[1])*x) > + c2*exp(Re(rt[1])*x)*sin(Im(rt[1])*x), x); y := x -> c1 exp(-2 x) cos(x) + c2 exp(-2 x) sin(x) > eqs:=IC; sol:=solve(eqs, {c1, c2}); eqs := {-2 c1 + c2 = 0, c1 = 1} sol := {c2 = 2, c1 = 1} > y:=unapply(subs(sol, y(x)), x); y := x -> exp(-2 x) cos(x) + 2 exp(-2 x) sin(x) > check:=simplify(IVP); check := {1 = 1, 0 = 0} # Ex 5 (S 3.5, 150/11) > unassign('y'); setup:=LZ([9, -12, 4]); (2) 2 setup := [y -> 9 (D )(y) - 12 D(y) + 4 y, r -> 9 y - 12 y + 4] > L:=setup[1]; Z:=setup[2]; (2) L := y -> 9 (D )(y) - 12 D(y) + 4 y 2 Z := r -> 9 r - 12 r + 4 > deq:={convert(L(y)(x)=0, diff)}; / 2 \ |d | /d \ deq := {9 |--- y(x)| - 12 |-- y(x)| + 4 y(x) = 0} | 2 | \dx / \dx / > IC:={y(0)=2, D(y)(0)=-1}; IVP:=deq union IC; IC := {y(0) = 2, D(y)(0) = -1} IVP := / 2 \ |d | /d \ {9 |--- y(x)| - 12 |-- y(x)| + 4 y(x) = 0, y(0) = 2, D(y)(0) = -1 | 2 | \dx / \dx / } > rt:=solve(Z(r)=0, r); rt := 2/3, 2/3 > y:=unapply(c1*exp(rt[1]*x) + c2*x*exp(rt[2]*x), x); y := x -> c1 exp(2/3 x) + c2 x exp(2/3 x) > eqs:=IC; sol:=solve(eqs, {c1, c2}); eqs := {c1 = 2, 2/3 c1 + c2 = -1} sol := {c1 = 2, c2 = -7/3} > y:=unapply(subs(sol, y(x)), x); y := x -> 2 exp(2/3 x) - 7/3 x exp(2/3 x) > check:=simplify(IVP); check := {2 = 2, 0 = 0, -1 = -1} # >