352 - Topic 15 - Laplace Transforms and Differential Equations

25 days ago by Professor352

John Travis

Mississippi College

var('t,s') # f=t^30 f = e^(4*t+8) L=laplace(f,t,s) html.table([['$f(t) =$',f],['$F(s) =$',L]]) 
       


F = 14/((3*s+2)*(s-4)) IL=inverse_laplace(F,s,t) html.table([['$F(s) =$',F],['$f(t) =$',IL]]) 
       


# If one wants to do this inverse transform by hand, then partial fractions may need to be used # to break up the term into linear denominators # var('s') # F = (15*s^2-12*s+19)/((s^2+4)^2*s^3) F.partial_fraction(s).show() 
       

                                
                            

                                
# Using these with differential equations var('t,s,y,y0') y = function('y')(t) eqn = diff(y,t) - 5*y == e^(-t) # eqn = diff(y,t) + 4*y == 8*sin(4*t) ICS =[0,y0] print 'Differential Equation:' eqn.show() print 'With initial condition',ICS desolve_laplace(eqn,y,ICS).show() 
       
Differential Equation:
With initial condition [0, y0]
Differential Equation:
With initial condition [0, y0]
# to quickly solve (or to check your manual solution) var('t,y,C') y=function('y')(t) @interact def _(eq = input_box(diff(y,t) + 5*y == exp(-t),label='DE:'),y0 = input_box(2,width=2,label='$y_0$')): html('Remember to enter diff(y,t) for any derivative.') ics = [0,y0] eq.show() desolve_laplace(eq,y,ics).show() 
       

Click to the left again to hide and once more to show the dynamic interactive window

# Notice the Sage commands can handle the translation theorem forward # but cannot deal with the translation theorem in reverse var('t,v') u = unit_step(v) plot(u(v=t-3),t,0,6).show() F = laplace(u(v=t-3),t,s) F.show() f = inverse_laplace(F,s,t) f.show() 
       

                                
                            

                                
# We can have Sage help with parts along the way and then apply the theorems ourselves # Below, consider e^(-2s)*F(s) var('t,s') F = 4/(s*(s+3)) f =inverse_laplace(F,s,t) show(f(t = t-2)*u(v = t-2)) 
       

                                
                            

                                

Sandbox below...

var('t,s') F = s/((s^2+1)*(s^2+2*s+2)) IL=inverse_laplace(F,s,t) # html.table([['$F(s) =$',F],['$f(t) =$',IL]]) F.partial_fraction(s).show() 
       

                                
                            

                                
# periodic function var('t') f1 = 2*unit_step(t-2) f2 = 1*unit_step(t-3) f3 = -3*unit_step(t-5) f4 = 2*unit_step(t-7) f5 = 1*unit_step(t-8) f6 = -3*unit_step(t-10) f = f1+f2+f3+f4+f5+f6 G = plot(0,t,0,2,thickness = 5,ticks=[[1,2,3,4,5,6,7,8,9,10,11,12],[1,2,3,4]])+plot(2,t,2,3,thickness = 5)+plot(3,t,3,5,thickness = 5)+plot(0,t,5,7,thickness = 5)+plot(2,t,7,8,thickness = 5)+plot(3,t,8,10,thickness = 5) G += circle((10.5,1.5),.1,fill=true)+circle((11,1.5),.1,fill=true)+circle((11.5,1.5),.1,fill=true) G.show() 
       
var('s,t') F = 1/(s^2-4)+ 6/(s^3*(s^2-4)) FwithE = 1/((s-1)*(s^2-4)) IL=inverse_laplace(F,s,t) ILwithE=inverse_laplace(FwithE,s,t) show(F+FwithE*exp(4*s)) show(IL+ILwithE(t=t-4))