Lesson 11 of 15

Laplace Transform

Laplace Transform

The Laplace transform converts a time-domain function f(t) into a complex-frequency-domain function F(s):

F(s)=L{f(t)}=0f(t)estdtF(s) = \mathcal{L}\{f(t)\} = \int_0^{\infty} f(t)\, e^{-st}\, dt

It is one of the most powerful tools in mathematical physics, turning differential equations into algebraic ones.

Common Transform Pairs

f(t)F(s)
11/s
eate^{at}1/(sa)1/(s-a)
sin(ωt)\sin(\omega t)ω/(s2+ω2)\omega/(s^2+\omega^2)
cos(ωt)\cos(\omega t)s/(s2+ω2)s/(s^2+\omega^2)
tnt^nn!/sn+1n!/s^{n+1}

The Convolution Theorem

If F(s)=L{f}F(s) = \mathcal{L}\{f\} and G(s)=L{g}G(s) = \mathcal{L}\{g\}, then:

L{fg}=F(s)G(s)\mathcal{L}\{f * g\} = F(s)\cdot G(s)

where the convolution is (fg)(t)=0tf(τ)g(tτ)dτ(f*g)(t) = \int_0^t f(\tau) g(t-\tau)\, d\tau

This makes solving linear ODEs with initial conditions straightforward: apply the transform, solve the algebraic equation, then invert.

Numerical Laplace Transform

For functions without a closed-form transform, we approximate:

F(s)i=0N1f(ti)estiΔtF(s) \approx \sum_{i=0}^{N-1} f(t_i)\, e^{-s\, t_i}\, \Delta t

where ti=iΔtt_i = i \cdot \Delta t and Δt=Tmax/N\Delta t = T_{\max}/N. This rectangle-rule quadrature works well when f(t) decays fast enough that the tail beyond TmaxT_{\max} is negligible.

Implementation

Implement the following functions:

  • laplace_exp(a, s) — analytic: returns 1/(sa)1/(s-a)
  • laplace_sin(omega, s) — analytic: returns ω/(s2+ω2)\omega/(s^2+\omega^2)
  • laplace_cos(omega, s) — analytic: returns s/(s2+ω2)s/(s^2+\omega^2)
  • laplace_tn(n, s) — analytic: returns n!/sn+1n!/s^{n+1}
  • laplace_numerical(f_func, s, T_max=20, N=10000) — numerical rectangle-rule approximation
import math

def laplace_exp(a, s):
    return 1.0 / (s - a)

def laplace_sin(omega, s):
    return omega / (s**2 + omega**2)
Python runtime loading...
Loading...
Click "Run" to execute your code.