Using Laplace Transforms in Python to Solve Differential Equations
Last time, we played with the Laplace transform and its inverse in Python. Today, we’ll use that knowledge to solve differential equations.
Suppose we have the differential equation
for the unknown function 𝑦(𝑡). This equation describes a forced oscillator with friction in physics. As initial conditions, we’ll choose 𝑦(0)=𝑦′(0)=0.
The Laplace transform offers a most convenient method to solve this kind of equation. First of all, look what happens, if we Laplace transform the second derivative of our unknown function:
where we have used partial integration from the first to the second line. So we can replace the second derivative by multiplying with p and subtracting with the initial condition for the first derivative. For 𝐿(𝑦′) we just…