4.8.24 · HinglishNumerical Methods

Runge-Kutta 4th order (RK4) — derivation

1,481 words7 min readRead in English

4.8.24 · Maths › Numerical Methods

, ko solve karna, bina closed-form solution jaane.

The Big Picture

WHAT: hum kya karne ki koshish kar rahe hain?

HOW: general RK4 skeleton derive karna

Ek 4-stage explicit RK method ki form hoti hai jahan har stage pichle wale use karti hai:

Ye shape kyun? Har ek sample point pe ka estimate hai. Hum constants is tarah tune karte hain ki poori cheez true solution ki Taylor series se tak agree kare.

Step 1 — True solution ka Taylor expansion (target)

Kyunki hai, baar baar differentiate karo (chain rule, yaad rakho depend karta hai pe):

Ye step kyun? Ye exact quantities hain jo true solution carry karti hai. Hamara method inhe reproduce karna chahiye.

To exact step hai

Step 2 — Har ko Taylor expand karo aur match karo

ko 2-variable Taylor series ke roop mein expand karke aur weighted sum ko upar diye exact expansion ke barabar force karke order conditions ka ek system milta hai. Classic solution (infinitely many hain; ye elegant symmetric wala hai):

aur , , baaki sab zero.

Ye numbers kyun? Weights exactly Simpson's rule weights hain — kyunki jab sirf pe depend karta hai, RK4 reduce ho jaata hai Simpson's -style integration mein, jo accurate hai. RK4 Simpson's rule ka -dependence ke liye generalization hai!

Step 3 — Classical RK4 formulas

Figure — Runge-Kutta 4th order (RK4) — derivation

Worked Example 1

, solve karo, se nikalo.

  • Kyun? Start pe slope.
  • Kyun? ka aadha use karke midpoint.
  • Kyun? ka aadha use karke refined midpoint.
  • Kyun? Pura use karke endpoint.

Exact solution . Error ! Itna achha kyun? Fourth-order accuracy ki wajah se.

Worked Example 2 (Forecast-then-Verify)

, , ek step solve karo. Forecast: true value hai; Euler deta hai. Predict karo ki RK4 ke kaafi kareeb aayega.

Verify: vs , error even with huge step . Gaur karo = ki series ke pehle paanch terms — direct proof ki RK4 Taylor se tak match karta hai.

Common Mistakes

Recall Feynman: ek 12-saal ke bacche ko explain karo

Imagine karo tum fog mein ek pahaadi par chal ke sahi height pe utarna chahte ho. Euler sirf wahan slope check karta hai jahan se wo shuru hota hai aur seedha chalta hai — wo overshoot kar deta hai. RK4 zyada samajhdar hai: wo start pe slope dekhta hai, phir beech mein guess karta hai, check karta hai, beech ko dobara check karta hai, phir door wale end ko check karta hai — aur charon peeks ka cleverly weighted average leta hai (do beech wali peeks double count hoti hain). Wo average real curved path ko almost perfectly match karta hai. To bade steps mein bhi, wo almost exactly target pe land karta hai.

Active Recall

What IVP does RK4 solve?
with , ek baar mein ek step aage badhte hue.
Write the four RK4 slope formulas (with ).
; ; ; .
What is the RK4 update formula?
.
What are the local and global error orders?
Local , global .
Why do get weight 2?
Ye midpoint slope estimate karte hain (interval ko best represent karte hain); Simpson's weighting se match karta hai.
Where is each sampled?
left edge pe, midpoint pe, right edge pe.
What does RK4 reduce to when only?
Integral ke liye Simpson's rule.
How does RK4 avoid computing derivatives of ?
Ye derivatives ko interior points pe extra function evaluations se replace karta hai, Taylor series ko match karte hue.
Why is global error one order lower than local?
~ steps per-step error ko accumulate karke bana dete hain.

Connections

Concept Map

exact solution as

too inaccurate

approximate via

has

tune constants against

match up to h^4

solved by

give weights 1/6,1/3,1/3,1/6

produce

generalized to y-dependence

error per step

needs no

IVP y'=f x,y

Integral form of step

Euler uses one slope

RK4 samples many slopes

4-stage skeleton k1..k4

Taylor series of true solution

Order conditions

Symmetric constants c,a,b

Simpson's rule weights

Classical RK4 formulas

O h^5 accuracy

Derivatives of f