4.8.24 · D3 · HinglishNumerical Methods

Worked examplesRunge-Kutta 4th order (RK4) — derivation

2,784 words13 min read↑ Read in English

4.8.24 · D3 · Maths › Numerical Methods › Runge-Kutta 4th order (RK4) — derivation

Is deep-dive mein parent RK4 derivation ko practice mein drill kiya gaya hai. Hum ka ek step solve karte hain, chaar slopes aur update use karke. Kuch naya assume nahi kiya gaya — neeche har symbol parent note mein build kiya gaya tha. Yahan hum ensure karte hain ki koi bhi case aapko surprise na kare.

Kisi bhi number se pehle, chaliye woh machine yaad kar lete hain jisme hum data feed kar rahe hain, taaki cold reader bhi follow kar sake.

Ise dobara kyun list kiya? Kyunki RK4 ki 90% galtiyan kisi stage mein galat ya plug karne ki hoti hain. Is box ko padhte waqt khula rakhein.

Kyunki hamara promise visual-first hai, neeche har worked example apne step-diagram ke saath aata hai: actual curve par slope samples ki ek picture, taaki arithmetic kabhi geometry se alag na ho. Figure pehle dekhein, phir numbers padhein.


Scenario matrix

Har RK4 problem jo aap kabhi dekhenge woh neeche ke kisi cell mein fit hoga (ya unka mix hoga). Jo examples follow karte hain unhe us cell ke saath label kiya gaya hai jisme woh fit hote hain, taaki saath mein poora grid cover ho jaye.

Cell Kya cheez ise alag banati hai Example
A. Pure- integrand RK4 Simpson's rule mein collapse ho jata hai Ex 1
B. Linear mixed Dono variables move karte hain; smooth growth Ex 2
C. Negative / decaying slope Signs flip hote hain; shrink karta hai, overshoot nahi hona chahiye Ex 3
D. Nonlinear in etc. Stages bahut differ karte hain; sensitivity Ex 4
E1. Zero slope everywhere Kuch nahi hilta; sanity floor Ex 5a
E2. Zero only at start , rest Motion phir bhi hota hai; jaldi mat ruko Ex 5b
F. Multi-step march ( ke do steps) Errors chain hoti hain; from Ex 6
G. Large step / limiting bada Jahan accuracy strain karti hai; Taylor view Ex 7
H. Word problem (real world) cooling / motion Story ko mein translate karo, units rakho Ex 8
I. Exam twist nonlinearly aur par depend karta hai, awkward numbers Careful arithmetic, no calculator luxuries Ex 9

Cell A — pure- integrand (RK4 = Simpson)

Forecast: Exact answer hai . RK4 ise exactly nail karna chahiye — padhne se pehle guess karo kyun. (Hint: Simpson cubics par exact hai.)

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

Figure 1 (Cell A): parabola jisme teen sample -values (left, midpoint, right) mark hain; kyunki ko ignore karta hai, dono midpoint samples coincide karte hain.

  1. . Yeh step kyun? Left-edge slope. Kyunki , ko ignore karta hai, bas plug karo.
  2. . Kyun? Midpoint . -shift irrelevant hai kyunki mein nahi hai.
  3. . Kyun? Same midpoint, same value — pure- problems mein -dependence na hone se hamesha hoga.
  4. . Kyun? Right edge .
  5. . Bracket hai , toh

Verify: Exact . RK4 error . Yahi Cell A ka poora point hai: jab , RK4 hai hi Simpson's rule aur degree 3 tak ke polynomials par exact hai. Dekho Simpson's Rule.


Cell B — linear mixed slope

Forecast: Exact solution hai , toh . Predict karo ki RK4 ~5 decimals tak match karta hai.

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

Figure 2 (Cell B): true curve from to , chaar slope samples as short line segments apne sample points par — dekho kaise har successive segment thoda aur steep hota ja raha hai.

  1. . Kyun? Left slope.
  2. . Kyun? Midpoint , shifted by .
  3. . Kyun? Refined midpoint, shifted by .
  4. . Kyun? Right edge, shifted by full .

Verify: ; hamara match karta hai. Error — textbook 4th-order behaviour.


Cell C — negative / decaying slope

Forecast: Exact hai , toh . Naive worry: kya RK4 zero se neeche overshoot kar sakta hai? Guess: nahi, positive rahega.

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

Figure 3 (Cell C): decaying curve ; har slope sample neeche point karta hai (negative), lekin arrows chote hote jaate hain jaise drop karta hai — ek self-limiting decay ki picture jo zero se neeche kabhi nahi jaati.

  1. . Kyun? Slope start par; negative sign kehta hai "neeche jao".
  2. . Kyun? Midpoint start se neeche hai, toh downward slope gentler hai.
  3. . Kyun? Refined midpoint.
  4. . Kyun? Right edge aur zyada drop ho gaya hai.

Verify: ; error (bada step, phir bhi tiny). Crucially — RK4 ka averaged slope decaying curve ko track karta hai rather than Euler ki tarah seedha neeche fire karne ke (jo deta, bahut kam). Compare karo Euler's Method se.


Cell D — nonlinear in

Forecast: Exact hai (yeh par blow up karta hai!). Toh . Predict karo RK4 uske close hoga.

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

Figure 4 (Cell D): curve par apne blow-up ki taraf steep hoti hui; chaar slope arrows visibly se tak lengthen hote hain kyunki squaring har -shift ko amplify karta hai.

  1. . Kyun? Slope .
  2. . Kyun? Midpoint ; squaring shift ko amplify karta hai.
  3. . Kyun? Refined midpoint .
  4. . Kyun? Right edge .

Verify: ; error . Singularity ke paas bhi (yahan dur hai), RK4 shine karta hai kyunki midpoint refinements ke through woh steepening slope ko sense karta hai.


Cell E — zero / degenerate inputs (do flavours)

Forecast: Zero slope ke saath, change nahi kar sakta. Answer exactly hona chahiye.

  1. . Kyun? Slope har jagah hai.
  2. . Kyun? Kisi bhi -shift ke baad bhi zero, kyunki .
  3. , . Kyun? Same reasoning — sample karne ko kuch nahi.

Verify: Exact . Error . Sanity floor: agar true solution constant hai, RK4 use constant rakhta hai.

Forecast: Exact hai , toh . Trap yeh hai: dekh ke galti se conclude karna ki " nahi badhta". Badhta hai — later stages nonzero slopes sample karte hain.

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

Figure 5 (Cell E2): parabola ; left-edge arrow perfectly flat hai (), phir bhi midpoint aur right-edge arrows upar tilt karte hain — curve se tak flat start ke bawajood climb karta hai.

  1. . Kyun? Slope left edge par — yahan genuinely flat.
  2. . Kyun? Midpoint ; -shift irrelevant kyunki mein nahi, lekin move ho gaya toh slope ab hai.
  3. . Kyun? Same midpoint ; ke barabar (pure- integrand).
  4. . Kyun? Right edge , slope .

Verify: Exact . Error (pure-, toh Simpson-exact). Lesson: sirf isliye march band mat karo ki hai — hamesha charon stages compute karo.


Cell F — multi-step march

Forecast: Same ODE as Ex 2 lekin do chhote steps mein reach kiya. ke do steps ke ek step se behtar hone chahiye (Ex 2 result ). Predict karo aur thoda zyada accurate.

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

Figure 6 (Cell F): ke saath do consecutive RK4 steps; pehla step par land karta hai, aur doosra step usi point se start hoke reach karta hai — errors ka step se step chain hone ki picture.

Step 1 (parent note ke Worked Example 1 se): at . Kyun reuse karein? Arithmetic parent se identical hai; hum doosra step yahan se start karte hain.

Step 2 (from , , ):

  1. . Kyun? Naya left edge.
  2. . Kyun? Midpoint .
  3. . Kyun? Refined midpoint.
  4. . Kyun? Right edge .

Verify: Exact . Do chhote steps essentially bang-on land karte hain. Lesson: ko half karne se global error shrink hota hai — "4th order" ka promise (dekho Local vs Global Truncation Error).


Cell G — large step / limiting behaviour

Forecast: Exact hai . Euler dega. Huge step ke saath RK4 — guess karo ki phir bhi ~1% ke andar aata hai.

  1. . Kyun? Slope .
  2. . Kyun? Midpoint .
  3. . Kyun? Refined midpoint.
  4. . Kyun? Right edge .

Verify: ; error . Aur yeh beautiful identity: ke pehle paanch terms par. RK4 Taylor series ko exactly term tak reproduce karta hai — isliye woh "4th order" hai (compare karo Taylor Series Methods se). Missing piece exactly woh local error hai, visible kyunki bada hai.

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

Figure 7 (Cell G): true (dashed navy) vs Euler ki single left-slope line (orange, par landing) aur RK4 ke chaar sampled slopes (magenta dots) jo path ko tak bend karte hain — ek labelled snapshot ki kyun zyada slopes sample karna better hai.


Cell H — real-world word problem

Forecast: Coffee ki taraf cool hogi. Exact: , toh . Predict karo RK4 ke close hoga.

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

Figure 8 (Cell H): cooling curve se dashed room-temperature line ki taraf drop karti hui; chaar slope samples dikhate hain ki cooling slow hoti jaati hai jaise room ke paas aata hai — curve kabhi se neeche cross nahi karti.

Yahan , units ; har ka unit hai (slope minutes).

  1. . Kyun? Left slope: garam coffee jaldi cool hoti hai.
  2. . Kyun? Midpoint .
  3. . Kyun? Refined midpoint .
  4. . Kyun? Right edge .

Verify: Exact ; error . Units check: har mein hai, update mein add karta hai ✓. Physically sound: temperature drop hua lekin room ke se kaafi upar raha.


Cell I — exam-style twist

Forecast: Slope positive hai (dono ), toh grow karega. Rough guess: , toh ke over ~-ish rise karega simple estimate se aage — expect karo .

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

Figure 9 (Cell I): exact solution se tak climb karta hua; chaar slope arrows (saare upar) grow karte hain kyunki step mein dono aur increase karte hain.

  1. . Kyun? Left edge , .
  2. . Kyun? Midpoint , .
  3. . Kyun? Refined midpoint .
  4. . Kyun? Right edge , .

Verify: Separable exact solution: . par: . par: . Hamara RK4 deta hai — 4 decimals tak match karta hai. ka forecast sahi ballpark mein tha. ✓


Matrix, sab green

Har cell A–I ka ab ek fully worked, verified example hai (E ko E1 aur E2 mein split kiya gaya). Sign flips (C), zeros dono total aur partial (E1, E2), nonlinearity (D, I), chaining (F), stress steps (G), aur units-bearing story (H) — sab cover ho gaye hain — aapko koi bhi RK4 scenario kabhi aise nahi milna chahiye jo is page ne rehearse na kiya ho.

Recall Close karne se pehle self-test

Kaun sa cell test karta hai ki RK4 = Simpson? ::: Cell A (pure- integrand, Ex 1). Jab ho toh computing kyun jaari rakhni chahiye? ::: Later stages () nonzero slopes sample kar sakte hain — dekho Ex 5b jahan climb karta hai despite . Coffee se upar kyun rahi? ::: Slope jaise ; room temperature ke paas cooling slow ho jaati hai. Ex 7 mein kya represent karte hain? ::: ke pehle paanch Taylor terms — proof ki RK4 Taylor ko tak match karta hai. ko half karne se global error kitne factor se improve hota hai? ::: Approximately (4th-order convergence).

Connections