# Math 2250 Maple Project 7, Laplace Applications # NAME ________________________________________ CLASSTIME ________ # L7.1 # (a) opts:=ytickmarks=3,color=red,labels=[t,'f(t)'], title="square wave",numpoints=100,discont=true,thickness=2; f1:=t ->(-1)^floor(t); h1:=t->piecewise(t<1,1,t<2,-1,0); f2:=t -> t-floor(t); f3:=t -> 1/2+(f2(t)-1/2)*f1(t); f4:=t->abs(sin(t)); f5:=t->(1/2(*sin(t)+abs(sin(t))); p:= t -> (2-t)*t: f6:=t->p(2*f2(t/2))*f1(t/2); q:=t->piecewise(tq(2*Pi*f2(x/2/Pi)); # Sample maple code used to solve L7.1(a),(b) for f1(t). opts1a:=ytickmarks=3,color=red,labels=['t','f'], title="square wave",numpoints=100,discont=true,thickness=2; f1:=t ->(-1)^floor(t); h1:=t->piecewise(t<1,1,t<2,-1,0); f2:=t -> t-floor(t); print("L7.1(a) for f1(t). Plot f1(t), square wave."); plot(f1(t),t=0..3*2,opts1a); print("L7.1(b) for f1(t). Zero graph expected."); print("The answer check verifies that f1(t) = h1(2*f2(t/2))"); opts1b:=ytickmarks=3,color=red,labels=['t','f'], title="square wave answer check",numpoints=100,discont=true,thickness=2; plot(h1(2*f2(t/2))-f1(t),t=-2..2*2,opts1b); # What is not done here is to solve (a), (b) for functions f2 --> f7. # You are expected to write code for h2 --> h7. Then devise the # corresponding answer check. Functions h1 --> h7 are pulses, not # periodic functions. This is why f1(t) = h1(t) is FALSE, but it is # TRUE that f1(t) = h1(2*f2(t/2)) [the composition is periodic]. # L7.2 DE:=diff(x(t),t,t)+9*x(t)=3*Dirac(t-3); IC:=x(0)=1,D(x)(0)=0; dsolve({DE,IC},x(t),method=laplace); # x(t) = cos(3*t)+Heaviside(t-3)*sin(-9+3*t) convert(%,piecewise);combine(%,trig); # x(t) = cos(3*t) for t < 3,cos(3*t)+sin(-9+3*t) for t>3, undef t=3. DE1:=diff(x(t),t,t)+9*x(t)=5*Dirac(t-3); IC1:=x(0)=-1,D(x)(0)=1; DE2:=diff(x(t),t,t)+9*x(t)=6*Dirac(t-3); IC2:=x(0)=1,D(x)(0)=-1; DE3:=diff(x(t),t,t)+9*x(t)=8*Dirac(t-3); IC3:=x(0)=0,D(x)(0)=-1; DE4:=diff(x(t),t,t)+9*x(t)=9*Dirac(t-3); IC4:=x(0)=1,D(x)(0)=0; # L7.3 with(inttrans): # Laplace method steps required # answer check # dsolve({DE,IC},x(t),method=laplace); will work. # Use Laplace's method as follows. with(inttrans): laplace(DE1,t,s); subs(laplace(x(t),t,s)=X,IC4,%); # s^2 X- s + 9 X = 5 exp(-3 s) solve(%,X);invlaplace(%,s,t);convert(%,piecewise); # L7.4 # (a) f := x -> 2/10+7/10*sin(x)+1/10*cos(5*x): T:=2: # T==period g:=x->x-T*floor(x/T); # g==triangular wave of period T h:= x -> f(g(x)): # h == Extension of f as a periodic function plot(f(x),x=0..T); # Periodic function f on base interval [0,T] plot(h(x),x=-10..10,discont=true); # (b) int(f(g(t))*exp(-s*t),t=0..T)/(1-exp(-s*T)); #ans:=1/10*(-s+exp(-2*s)*s*cos(10)-5*exp(-2*s)*sin(10))/ # ((s^2+25)*(1-exp(-2*s))); # (c) pulse:=(t,a,b)->Heaviside(t-a)-Heaviside(t-b); f := x -> 2/10+7/10*sin(x): h:= t->sum(f(t-n*T)*pulse(t,n*T,n*T+T),n=0..infinity); inttrans[laplace](h(t),t,s); eval(%) assuming n::positive; pulse:=(t,a,b)->Heaviside(t-a)-Heaviside(t-b); f := x -> (1/10)*cos(5*x): h:= t->sum(f(t-n*T)*pulse(t,n*T,n*T+T),n=0..infinity); inttrans[laplace](h(t),t,s); eval(%) assuming n::positive; # L7.5 with(LinearAlgebra):with(inttrans): A:=Matrix([[1,0],[0,2]]); u0:=Vector([alpha,beta]); B:=(s*IdentityMatrix(2)-A)^(-1).u0; u:=Map(invlaplace,B,s,t); # end of maple L7 text