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):
It is one of the most powerful tools in mathematical physics, turning differential equations into algebraic ones.
Common Transform Pairs
| f(t) | F(s) |
|---|---|
| 1 | 1/s |
The Convolution Theorem
If and , then:
where the convolution is
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:
where and . This rectangle-rule quadrature works well when f(t) decays fast enough that the tail beyond is negligible.
Implementation
Implement the following functions:
laplace_exp(a, s)— analytic: returnslaplace_sin(omega, s)— analytic: returnslaplace_cos(omega, s)— analytic: returnslaplace_tn(n, s)— analytic: returnslaplace_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.