Перейти к содержимому

Runge–Kutta Methods (RK2) Explained Visually | Numerical Methods – Lecture 39

Maths Visualisation

0:00 / 0:00

Runge–Kutta Methods (RK2) Explained Visually | Numerical Methods – Lecture 39

121 просмотр · 2 нед. назад
Maths Visualisation
226 подписчиков
121 просмотр · 2 нед. назад
Second-order Runge–Kutta methods reach the accuracy of the second-order Taylor method without any derivatives of f: they sample the slope twice inside each step and blend the samples. Heun's method averages the slope at the start and at the Euler prediction, K₁ = h f(tⱼ, yⱼ), K₂ = h f(tⱼ + h, yⱼ + K₁), yⱼ₊₁ = yⱼ + (K₁ + K₂)/2, the trapezoidal rule with a predicted end point. The midpoint method uses the slope halfway along the step. We write the general s-stage Runge–Kutta method, expand the two-stage form in Taylor series, and match terms: W₁ + W₂ = 1, W₂c₂ = W₂a₂₁ = 1/2, a one-parameter family (Heun α = 1, midpoint α = 1/2, Ralston α = 2/3), and show why third order is impossible with two stages. Worked examples from the notes: y′ = t + y and y′ = t + y² with h = 0.1, the local error O(h³), the global error O(h²) on a log-log plot, the cost per function evaluation, a first look at stability, and the algorithm. 📌 Chapters 0:00 Introduction 0:37 Recap: Euler and Taylor methods 1:36 The idea: sample the slope twice 2:19 Heun's method 2:56 Heun = trapezoidal rule 3:31 The midpoint method 4:06 General s-stage Runge–Kutta methods 4:51 Two-stage methods: four constants 5:30 Taylor series of the exact solution 6:09 Taylor series of the method 6:58 Matching terms: the order conditions 7:43 A one-parameter family 8:27 Why not third order 9:09 Worked example: y′ = t + y 9:57 Heun vs Euler: the table 10:30 Worked example: y′ = t + y² 11:19 Four Heun steps 12:00 Heun, midpoint and Ralston 12:34 Local error O(h³) 13:09 Global error O(h²) 13:51 Accuracy per function evaluation 14:30 A first look at stability 15:24 Algorithm 16:07 Comparison 16:43 Summary 📝 Key results • Heun: K₁ = h f(tⱼ, yⱼ), K₂ = h f(tⱼ + h, yⱼ + K₁), yⱼ₊₁ = yⱼ + (K₁ + K₂)/2 • Midpoint: K₂ = h f(tⱼ + h/2, yⱼ + K₁/2), yⱼ₊₁ = yⱼ + K₂ • Order conditions: W₁ + W₂ = 1, W₂c₂ = 1/2, W₂a₂₁ = 1/2; family c₂ = a₂₁ = α, W₂ = 1/(2α) • Two stages cannot give third order: local error O(h³), global error O(h²) • y′ = t + y, h = 0.1: Heun y(1) ≈ 3.42816 (error 0.0084) against Euler 0.249 • y′ = t + y², h = 0.1: Heun y(0.4) ≈ 1.77682 against 1.78936 (error 0.0125) • Two evaluations of f per step and no derivatives of f 💻 Practise this lecture Self-paced practice with live plots, hints and instant feedback: 👉 https://biswarupbiswas.github.io/nume... 📚 Course website (all lectures, notes and practice): https://biswarupbiswas.github.io/nume... Next lecture: the classical fourth-order Runge–Kutta method, RK4. #NumericalMethods #RungeKutta #DifferentialEquations #ODE #Mathematics #Engineering