Skip to content
Tutorials Center
My learning

Topics

Lesson 17 of 39 ยท Laplace Transforms

Solving ODEs with Laplace Transforms

Solve linear ODE initial value problems with the Laplace transform: transform, solve for Y(s), invert. Covers forcing, systems, transfer functions, with Python checks.

You now have all three ingredients: the transform and its derivative rules (definition), and inversion by partial fractions (inverse transforms). Put together they give a complete, mechanical method for linear constant-coefficient initial value problems.

The four-step recipe

  1. Transform both sides, using L{y'} = s*Y - y(0) and L{y''} = s**2*Y - s*y(0) - y'(0).
  2. Solve the resulting algebraic equation for Y(s).
  3. Decompose Y(s) into simple pieces (partial fractions, completing the square).
  4. Invert term by term.

The initial conditions are already in step 1, and the answer is the particular solution directly: there is no y_h + y_p assembly and no constants to fit.

Example 1: homogeneous

Solve y'' + 3*y' + 2*y = 0, y(0) = 1, y'(0) = 0. Transform: s**2*Y - s - 0 + 3*(s*Y - 1) + 2*Y = 0, so (s**2 + 3*s + 2)*Y = s + 3, and

Y = (s + 3)/((s + 1)*(s + 2)) = 2/(s + 1) - 1/(s + 2),

so y = 2*e**(-t) - e**(-2*t). Compare with the characteristic equation approach: roots -1, -2, same answer.

Example 2: forced equation

Solve y'' + 4*y = sin(t), y(0) = 0, y'(0) = 0. Transform: (s**2 + 4)*Y = 1/(s**2 + 1), so

Y = 1/((s**2 + 1)*(s**2 + 4)).

Partial fractions in s**2: 1/((u + 1)*(u + 4)) = (1/3)/(u + 1) - (1/3)/(u + 4). So Y = (1/3)/(s**2 + 1) - (1/3)/(s**2 + 4), whose inverse is y = (1/3)*sin(t) - (1/6)*sin(2*t). Notice the answer has both the forced response sin t/3 and the natural oscillation -sin(2t)/6 caused by the initial rest conditions, with no guessing.

Python The four steps with SymPy

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Example 3: resonance appears as a repeated pole

For y'' + y = sin(t), y(0) = y'(0) = 0: Y = 1/(s**2 + 1)**2, a repeated complex pole. Entries for 1/(s**2 + w**2)**2 give y = (sin t - t*cos t)/2, which grows linearly: resonance. The repeated pole is the transform-domain signature of the t*sin terms found with the resonance rule.

Python Resonance from a repeated pole

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Systems of equations

Laplace handles coupled equations too. For x' = -x + y, y' = -2*y, with x(0) = 1, y(0) = 3: transforms give s*X - 1 = -X + Y and s*Y - 3 = -2*Y. The second yields Y = 3/(s + 2); then (s + 1)*X = 1 + 3/(s + 2) = (s + 5)/(s + 2), so X = (s + 5)/((s + 1)*(s + 2)) = 4/(s + 1) - 3/(s + 2). Hence x = 4*e**(-t) - 3*e**(-2*t), y = 3*e**(-2*t). The linear algebra is what systems chapters generalize with matrices.

Python A coupled system

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Transfer functions

With zero initial conditions, the transformed equation (a*s**2 + b*s + c)*Y = G(s) gives Y = H(s)*G(s) with the transfer function

H(s) = 1/(a*s**2 + b*s + c).

H depends only on the system (m, c, k for a spring), not on the input. Multiplying the transform of any input by H gives the response; poles of H are the system's natural modes. When there are nonzero initial conditions, the transformed equation gains extra terms (a*s + b)*y(0) + a*y'(0) in the numerator: the free response caused by the stored energy.

When Laplace is the better tool

  • Forcing that switches on and off, or contains sudden impulses (next lesson).
  • Systems and engineering analysis with transfer functions.
  • Initial value problems where you want the answer in one pass.

It is not good for variable coefficients (except special cases) or nonlinear equations; the transform of a product is not a product of transforms.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. For y'' + 2y' + y = 0 with y(0) = 3, y'(0) = 1, the transformed equation is

    L{y''} = s**2 Y - 3s - 1 and L{2y'} = 2sY - 6, so the right side collects 3s + 1 + 6 = 3s + 7.
  2. 2. Laplace transforms are most useful for

    They turn linear constant-coefficient IVPs into algebra, and piecewise forcing is easy to transform.
  3. 3. The transfer function of y'' + 3y' + 2y = u(t) with zero initial conditions is

    With zero initial values (s2 + 3s + 2) Y = U(s), so H = Y/U = 1/(s2 + 3s + 2).
  4. 4. A repeated pole on the imaginary axis (such as 1/(s**2+1)**2) produces

    It inverts to terms like t cos t, whose amplitude grows linearly.

Summary

  • Transform, solve algebraically for Y(s), decompose, invert: initial conditions are built in.
  • Forced responses and free responses emerge automatically from the partial fractions.
  • Repeated poles on the imaginary axis mean resonance.
  • Systems become small linear algebra problems in s.
  • The transfer function H(s) = 1/(a s**2 + b s + c) captures the system independent of input.

Next: Step Functions, Impulses and Convolution