differential equations30 min

Laplace Transforms

Laplace transforms convert differential equations into algebraic equations, making complex problems solvable with algebra

0/9Not Started

Why This Matters

Some differential equations are extremely difficult to solve directly but become simple algebra problems in disguise. The Laplace transform is the key to this transformation: it converts a function of time f(t) into a function of a complex variable F(s) by computing an integral. Derivatives become multiplications by s, and solving a differential equation reduces to solving an algebraic equation.

The result in the s-domain is called a transfer function. It encodes the entire input-output behavior of a system in a single rational expression. Engineers use transfer functions to design filters, control systems, and signal processors. To get back to the time domain, you apply the inverse Laplace transform, often by looking up known pairs in a table or using partial fraction decomposition. The Laplace transform is the bridge between differential equations and the frequency domain analysis used throughout electrical and control engineering.

Define Terms

Visual Model

Time Domainf(t), differential eq.
Laplace TransformL{f(t)} = F(s)
s-DomainF(s), algebraic eq.
Algebraic SolutionSolve for Y(s)
Inverse LaplaceL^-1{Y(s)} = y(t)
Transfer FunctionH(s) = Y(s)/X(s)
Solution y(t)Back in time domain

The full process at a glance. Click Start tour to walk through each step.

The Laplace transform converts a differential equation to algebra, solves it, then converts back. Transfer functions characterize the system.

Code Example

Code
// Numerical Laplace transform: approximate the integral
// L{f(t)} = integral from 0 to infinity of f(t)*e^(-st) dt

function numericalLaplace(f, s, tMax, dt) {
  let sum = 0;
  for (let t = 0; t < tMax; t += dt) {
    sum += f(t) * Math.exp(-s * t) * dt;
  }
  return sum;
}

// Known Laplace pairs to verify:
// L{1} = 1/s
// L{t} = 1/s^2
// L of e^(at) = 1/(s-a)
// L{sin(wt)} = w/(s^2 + w^2)

console.log("Verifying Laplace transform pairs:");

// L{1} at s=2 should be 1/2 = 0.5
const f1 = (t) => 1;
console.log(`L{1} at s=2: ${numericalLaplace(f1, 2, 50, 0.001).toFixed(3)} (exact: 0.5)`);

// L{t} at s=2 should be 1/4 = 0.25
const f2 = (t) => t;
console.log(`L{t} at s=2: ${numericalLaplace(f2, 2, 50, 0.001).toFixed(3)} (exact: 0.25)`);

// L{e^(-t)} at s=2 should be 1/(2+1) = 0.333
const f3 = (t) => Math.exp(-t);
console.log(`L{e^(-t)} at s=2: ${numericalLaplace(f3, 2, 50, 0.001).toFixed(3)} (exact: 0.333)`);

// L{sin(3t)} at s=2 should be 3/(4+9) = 0.231
const f4 = (t) => Math.sin(3 * t);
console.log(`L{sin(3t)} at s=2: ${numericalLaplace(f4, 2, 50, 0.001).toFixed(3)} (exact: 0.231)`);

// L{e^(-2t)*sin(t)} at s=1 should be 1/((1+2)^2+1) = 0.1
const f5 = (t) => Math.exp(-2 * t) * Math.sin(t);
console.log(`L{e^(-2t)*sin(t)} at s=1: ${numericalLaplace(f5, 1, 50, 0.001).toFixed(3)} (exact: 0.1)`);

// Transfer function example: H(s) = 1/(s^2 + 3s + 2)
// Poles at s = -1 and s = -2 (stable system)
console.log("\nTransfer function H(s) = 1/(s^2 + 3s + 2)");
const H = (s) => 1 / (s * s + 3 * s + 2);
[0.5, 1, 2, 5].forEach(s => {
  console.log(`  H(${s}) = ${H(s).toFixed(4)}`);
});

Interactive Experiment

Try these exercises:

  • Compute L(e^(-3t)) numerically at s = 1, 2, 5. Compare with the exact formula 1/(s + 3). How close are they?
  • Try L(cos(2t)) at s = 1. The exact answer is s/(s^2 + 4) = 1/5 = 0.2. Does the numerical result match?
  • Change the upper limit tMax from 50 to 10 and to 100. How does truncation affect accuracy for slow-decaying functions?
  • For the transfer function H(s) = 1/(s^2 + 4), find where the poles are. What does this tell you about the system behavior?
  • Decrease the step size dt from 0.001 to 0.01 and 0.0001. How does it affect accuracy and computation time?

Quick Quiz

Coding Challenge

Numerical Laplace Transform

Write a function called `laplaceApprox` that numerically computes the Laplace transform of a function f(t) at a given value of s. Use the rectangle rule: sum f(t)*e^(-s*t)*dt for t from 0 to tMax with step dt. Parameters: f (function), s (number), tMax (default 50), dt (default 0.001). Return the numerical approximation rounded to 3 decimal places.

Loading editor...

Real-World Usage

Laplace transforms are indispensable in engineering:

  • Control systems: The transfer function H(s) is the standard way to describe a control system. PID controllers, autopilots, and industrial regulators are all designed using Laplace domain analysis.
  • Electrical engineering: Circuit analysis with capacitors and inductors uses impedance in the s-domain: Z_C = 1/(sC) and Z_L = sL. Complex circuits become simple voltage dividers.
  • Signal processing: Filters are designed in the s-domain (analog) or z-domain (digital). The Laplace transform of the impulse response gives the frequency response.
  • Mechanical engineering: Vibration analysis uses transfer functions to predict resonance frequencies and design dampers for buildings, bridges, and vehicles.
  • Communications: Modulation, demodulation, and channel analysis all use Laplace and Fourier transforms to move between time and frequency representations.

Connections