← All days ◀ Day 14
15-Day Differential Equations Course · Week 3 · Day 15

Capstone: Finite Differences, Final Assessment and Certificate

Finish by building the bridge from differential equations to the computer codes engineers use every day: finite differences, explicit and implicit schemes, and the stability condition that decides whether a simulation is right or explodes. Then a capstone problem that uses the whole course, a final assessment, your certificate and where to go next.

⏱ about 2–3 hours🧪 Lab: Finite-difference stability + exam🎓 Final assessment

1Today's goals

  • Approximate derivatives with finite differences and know their accuracy
  • Write the explicit (FTCS), implicit and Crank–Nicolson schemes for the heat equation
  • Derive the stability limit r ≤ ½ by von Neumann analysis, and the CFL condition for waves
  • Model a complete engineering system with the tools of all 15 days
  • Know where to go next: FEM and CFD, control, stochastic and delay equations

2Derivatives on a grid

Put the rod on a grid xi = i·Δx and step in time tn = n·Δt. Taylor series give

Forward difference: u′ ≈ (ui+1 − ui)/Δx error O(Δx)
Central difference: u′ ≈ (ui+1 − ui−1)/(2Δx) error O(Δx²)
Second derivative: u″ ≈ (ui+1 − 2ui + ui−1)/Δx² error O(Δx²)

Replacing the space derivatives in a PDE but keeping time continuous turns it into a large system of ODEs — the method of lines. Everything from Day 4 then applies: you can hand the system to an RK or a stiff solver.

3Three schemes for the heat equation

r = α·Δt / Δx²
Explicit (FTCS): uin+1 = uin + r·(ui+1n − 2uin + ui−1n) stable only if r ≤ ½
Implicit (backward Euler): un+1 − r·δ²un+1 = un stable for all r, first order in time
Crank–Nicolson: average of the two stable for all r, second order in time

The implicit schemes need a tridiagonal solve each step (cheap: the Thomas algorithm is O(N)). The explicit scheme is simplest but halving Δx forces Δt down four times — eight times more work in one dimension (twice the points × four times the steps), and sixteen times in two.

Von Neumann stability analysis

Put a single Fourier mode uin = Gn·ejkiΔx into the scheme. For FTCS: G = 1 + r·(ejkΔx − 2 + e−jkΔx) = 1 − 4r·sin²(kΔx/2). The scheme is stable if |G| ≤ 1 for every k. The worst mode is the grid's zig-zag, kΔx = π, where G = 1 − 4r; |G| ≤ 1 needs r ≤ ½. For the wave equation the same analysis of the leapfrog scheme gives the Courant–Friedrichs–Lewy (CFL) condition c·Δt/Δx ≤ 1: in one time step, a wave must not travel further than one grid cell — the numerical domain of dependence must contain the physical one. Every explicit CFD and crash code respects a condition of this kind.

4Lab: finite-difference stability

The exact solution (dashed) is two decaying sine modes. Set r = 0.48 and press P: the explicit scheme follows it well. Stop, set r = 0.52, and play again: a saw-tooth grows out of round-off and destroys the answer. The right plot shows why — the amplification factor G of the shortest waves has crossed −1. Switch to implicit or Crank–Nicolson and push r to 2.

5Capstone: a gearbox on a test rig

Bring the course together on one system. A gearbox runs on an endurance rig: motor → coupling → gearbox → coupling → absorbing dynamometer. Work through the questions on paper and check each in the labs.

  1. Thermal (Days 1–2, 14). The oil gains Ploss = 1.2 kW and loses h·A·(T − 30) with h·A = 26 W/K; the oil-and-casing heat capacity is m·c = 34 kJ/K. Write the ODE, find τ and the final temperature, and the time to "stabilised" (rate < 1 °C per 30 min). Answer: τ = 34000/26 = 1308 s ≈ 21.8 min; T∞ = 30 + 1200/26 = 76.2 °C.
  2. Runaway check (Day 3). If the loss rises with temperature, P = 1.2·(1 + 0.01·(T − 30)) kW, is there still a stable equilibrium? Sketch generation and dissipation against T. Generation slope 12 W/K < dissipation slope 26 W/K, so yes: T∞ = 30 + 1200/(26 − 12) = 115.7 °C — much hotter. The margin is the gap between the two slopes.
  3. Torsional modes (Days 5, 8). Lump the drive as three inertias Jm = 0.25, Jg = 0.05, Jd = 0.4 kg·m² on two shafts k₁ = k₂ = 2×10⁴ N·m/rad. Write M·θ″ + K·θ = 0, note the rigid-body mode at 0, and find the two non-zero natural frequencies. (≈ 40 Hz and ≈ 148 Hz.) Compare with the motor speed and gear-mesh frequency.
  4. Forced response (Days 6–7). The gear mesh excites the drive at z·n/60 Hz. Sweep the motor speed: at what speeds does mesh frequency cross each mode? What damping would keep the dynamic magnification below 10?
  5. Data (Day 14). Paste a real warm-up log into the model fitter and compare its τ with item 1.
  6. Simulation (Days 4, 15). If you simulate the coupled thermal + torsional model with an explicit method, which time scale sets the step size, and why is the system stiff?

Hint for 3: with M = diag(0.25, 0.05, 0.4) and K = 2×10⁴·[[1, −1, 0], [−1, 2, −1], [0, −1, 1]], det(K − ω²M) = 0 gives ω = 0 (the rigid-body mode) and two roots ω ≈ 254 and ≈ 930 rad/s. In mode 1 the motor and the dynamometer swing against each other across the gearbox; in mode 2 the light gearbox inertia vibrates between the two shafts while the heavy ends hardly move. For 6: the mode periods are milliseconds, the thermal time constant is twenty minutes — a ratio of about 10⁶.

6Final assessment

Twenty questions across the whole course. Your best score is kept and appears on the certificate.

7Your certificate

Type your name. The certificate counts the days you have marked complete and your best final-assessment score. Print it or save it as PDF; when you are signed in and have finished every day and the assessment, "Save to my account" stores it with a certificate ID that anyone can verify.

8Where next

Finite elements and CFDThe same PDEs on real geometry. Start with a 1-D FEM bar code, then a package (ANSYS, Abaqus, OpenFOAM, FEniCS). Every result there is a solution of Days 12–13's equations.
Control engineeringDay 7 grown up: root locus, Bode and Nyquist, PID tuning, state-space and observers. Ogata, or Åström and Murray (free online).
Nonlinear dynamicsStrogatz, Nonlinear Dynamics and Chaos — the friendliest deep book on Days 3, 10 and 11.
Rotor and structural dynamicsDay 5–8 applied: critical speeds, Campbell diagrams, modal testing. Rao, Mechanical Vibrations; Friswell et al., Dynamics of Rotating Machines.
Stochastic and delay equationsNoise-driven systems (Brownian motion, finance, sensor drift) and equations with memory (control loops with transport delay, population cycles).
Data-driven modelsSystem identification, Kalman filters, sparse regression (SINDy) and neural ODEs — learning the right-hand side f from data, the next step after Day 14.
Progress is kept in this browser (and in your account when signed in).