# 352 - Topic 15 - Laplace Transforms and Differential Equations

## 811 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(t) =$ $e^{\left(4 \, t + 8\right)}$ $F(s) =$ $\frac{e^{8}}{s - 4}$

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

 $F(s) =$ $\frac{14}{{\left(3 \, s + 2\right)} {\left(s - 4\right)}}$ $f(t) =$ $e^{\left(4 \, t\right)} - e^{\left(-\frac{2}{3} \, t\right)}$

# 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 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') u(t) = unit_step(t) F = laplace(u(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) f(t = t-2)*u(t-2)
 -4/3*(e^(-3*t + 6) - 1)*unit_step(t - 2) -4/3*(e^(-3*t + 6) - 1)*unit_step(t - 2)

Sandbox below...

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

 $F(s) =$ $\frac{1}{{\left(s + 5\right)} {\left(s - 2\right)}}$ $f(t) =$ $\frac{1}{7} \, e^{\left(2 \, t\right)} - \frac{1}{7} \, e^{\left(-5 \, t\right)}$

# 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()