4.8.27 · D2 · HinglishNumerical Methods

Visual walkthroughSystems of ODEs — RK4 for systems

2,124 words10 min read↑ Read in English

4.8.27 · D2 · Maths › Numerical Methods › Systems of ODEs — RK4 for systems

Hum assume karte hain ki tum add, multiply, aur graph padh sakte ho. Bas itna kaafi hai. Har naya symbol pehle draw hoga, phir use hoga.


Step 1 — "ODE solve karna" matlab kya hai (slope field)

KYA. Hamare paas ek unknown quantity hai jo time ke saath change hoti hai. Time ko kaho aur quantity ko . Ek ordinary differential equation (ODE) ek aisi rule hai jo tumhe ki slope har jagah batati hai:

Is line ke har symbol ko yahan explain karte hain:

  • slope, yani kitni tezi se badh ya gir rahi hai. Ise "y-prime" padho.
  • — ek known formula jo, yeh batane par ki tum kahan ho () aur kitne upar ho (), tumhe woh slope wapas deta hai.

KYUN. Hume khud abhi nahi pata — yahi toh poora puzzle hai. Lekin hume har jagah uski slope di gayi hai. Toh solve karne ka matlab hai: ek jaane-maane point se shuru karo aur chalo, hamesha woh slope follow karte hue jo formula deta hai.

PICTURE. Figure s01 mein ka slope field draw hai: har point pe ek choti arrow dikhati hai kahan jaana hai. Sahi solution (smooth curve ) woh path hai jo har arrow ke tangent rehta hai jisse woh guzarta hai.

Figure — Systems of ODEs — RK4 for systems

Step 2 — Ek step actually ek area hai (exact integral)

KYA. se tak width ka ek chota time-step lo. Us step mein ka exact change hai:

Term by term:

  • step width, ek chota chosen number jaise .
  • — "saari slopes add karo" ka symbol; yeh slope ko poore step mein sum karta hai. Letter sirf time ka stand-in hai jo se tak sweep karta hai.
  • Result us step mein slope curve ke neeche ka area hai.

KYUN. "Rise = slope curve ke neeche ka area" — yeh calculus ka fundamental fact hai. Agar hum woh area exactly compute kar paate, toh hum exactly true curve pe land karte. Hum nahi kar sakte — kyunki andar ka mein wahi cheez hai jo hume pata nahi. Toh poora game yeh ban jaata hai: is ek area ko cleverly estimate karo.

PICTURE. Figure s02 ek step mein slope curve ke neeche ke area ko shade karta hai. Landing accuracy = hum is shaded region ko kitna accha guess karte hain.

Figure — Systems of ODEs — RK4 for systems

Step 3 — Simpson ka idea: slope ko start, middle, end pe sample karo

KYA. Simpson's Rule ek area ko estimate karta hai curve ko teen jagah sample karke — dono ends aur midpoint — aur middle ko chaar baar zyada weight deta hai:

Weights padho: start pe , middle mein , end pe — total , jo exactly woh hai jo bahar divide kar raha hai.

YEH TOOL KYUN, KOI AUR KYUN NAHI. Simpson kyun, sirf "start pe slope times " (Euler) kyun nahi? Kyunki ek akela starting slope yeh ignore karta hai ki slope step ke dauran bend karta hai. Simpson parabola fit karta hai teen samples se — yeh curvature pakadta hai, isliye same step size ke liye dramatically zyada accurate hai. Yahi extra accuracy RK4 ko uski order-4 rating dilayegi.

PICTURE. Figure s03 teen sampled points pe ek parabola overlay karta hai aur weighting ko bar heights ke roop mein dikhata hai.

Figure — Systems of ODEs — RK4 for systems

Step 4 — Chaar slope estimates banana

KYA. Hum chaar slope samples compute karte hain, har ek hum kahan hain uska better guess use karte hue:

Symbol-by-symbol, har guess kya kar raha hai:

  • — slope start pe, already known state use karke.
  • use karke ek Euler half-step aage: "agar start-slope hold karta, toh midpoint yahan hoti." = wahan ki slope.
  • — ek refined midpoint, ab better slope use karke. = wahan ki slope.
  • — acchi midpoint slope use karke ek full step, end ke paas land karta hai. = wahan ki slope.

KYUN. Har estimate agla feed karta hai: hum apni way bootstrap karte hain trustworthy midpoint aur endpoint slopes tak, bina true curve jaane. aur ek hi midpoint slope ke do independent estimates hain — unhe average karne se errors cancel ho jaati hain.

PICTURE. Figure s04 mein ek step pe saare chaar probe arrows draw hain: left pe , do midpoint probes stacked, right pe .

Figure — Systems of ODEs — RK4 for systems

Step 5 — Weighted average jo step ko land karata hai

KYA. Chaar slopes ko Simpson ki spirit se combine karo — lekin Simpson ke paas sirf ek middle sample tha, aur hamare paas do hain (). Toh hum Simpson ka weight evenly split karte hain, har middle slope ko weight dete hain:

Weights divisor se match karte hain — yeh guarantee karta hai ki agar slope constant hoti, toh hume exactly slope milta (koi bias nahi).

KYUN. Yeh precise averaging error terms ko fourth order tak cancel karta hai — step ke baad bacha hua error hota hai, bahut chota ( adha karo toh yeh 32 guna chhota ho jaata hai). Poore interval mein accumulated global error hai; dekho Local vs Global Truncation Error.

PICTURE. Figure s05 mein chaar slope arrows fan out hain aur unka weighted average arrow (orange mein) landing point ki taraf point kar raha hai.

Figure — Systems of ODEs — RK4 for systems

Step 6 — Ab ko vector banne do

KYA. Real problems kaafi quantities ek saath track karte hain (position aur velocity, prey aur predator). Inhe ek list mein stack karo — ek vector:

Bold ka matlab hai "poori list ek saath." Sabse zaroori baat, har slope-formula har component padh sakta hai — yahi hai coupling: components haath pakad ke chalte hain.

DERIVATION KYUN FREE HAI. Steps 4–5 wapas dekho: humne sirf add kiya aur jaise numbers se multiply kiya. Yeh do operations ek list of numbers pe bilkul waise hi kaam karte hain jaise ek single number pe. Toh hum har symbol ko bold karte hain aur kuch nahi badlate: Har ab length ka vector hai.

PICTURE. Figure s06 mein do coupled trajectories lockstep mein aage badh rahi hain — vector recipe ka ek step dono ko ek saath move karta hai.

Figure — Systems of ODEs — RK4 for systems

Step 7 — Degenerate aur edge cases (koi gap mat chhodo)

KYA / KYUN / PICTURE un corners ke liye jo tumhe handle karne chahiye:

  • Ek equation (). Vector scalar mein collapse ho jaata hai; bold marks gayab ho jaate hain; tum exactly Step 5 recover karte ho. RK4-for-systems mein scalar RK4 ek special case ke roop mein shamil hai.
  • Uncoupled system (har sirf apne pe depend karta hai). Tab equations haath nahi pakadtein aur tum alag-alag RK4s run kar sakte the — lekin vector recipe phir bhi kaam karti hai aur koi extra cost nahi lagti. Coupling general case hai; independence lucky case hai.
  • Synchronization trap (ek asli galti). Kyunki padh sakta hai, tumhe pehle poora vector complete karna hoga koi bhi intermediate state banane se pehle. Agar tum pehle pe poora RK4 complete karte ho, toh ka ek stale, un-advanced padhega — silent, galat answers.

Figure s07 RIGHT order (har stage pe saare components ek saath advance hote hain) aur WRONG order (ek component aage bhaag jaata hai, doosre ko stale data deta hai) ko contrast karta hai.

Figure — Systems of ODEs — RK4 for systems

Worked check — parent ke Example 1 ko reproduce karo

, , ke liye, ek step deta hai (parent ke numbers): jo aur se match karta hai. Neeche ka VERIFY block dono ko scratch se recompute karta hai.


Ek-picture summary

Figure s08 poore walkthrough ko compress karta hai: exact-area problem (Step 2), three-sample Simpson estimate jo chaar probes mein split hoti hai (Steps 3–4), weighted landing (Step 5), aur vector bolding jo sab kuch coupled systems ke liye kaam karati hai (Step 6).

Figure — Systems of ODEs — RK4 for systems
Recall Feynman retelling (plain words)

Hum jaanna chahte hain ki ek chalti cheez ek pal baad kahan hogi. Sahi jawab us pal ke liye uski slope curve ke neeche ka area hai — lekin hum woh area nahi dekh sakte kyunki yeh depend karta hai ki cheez kahan jaati hai, aur yahi toh hum solve kar rahe hain. Toh hum cleverly cheat karte hain: hum slope chaar baar peep karte hain. Ekdum shuru mein ek baar. Middle mein do baar — doosri peep pehli se smarter kyunki woh pehli peep se seekha hua use karta hai. End ke paas ek baar, best middle guess use karke. Phir hum chaar peeks ka average lete hain, do middle waalon ko double count karte hue, aur chhe se divide karte hain. Woh average slope, times step, batata hai kitna move karna hai. Jab kaafi cheezein ek saath haath pakad ke chalti hain, hum exactly wahi peeking karte hain — lekin har peek ko unhe sab ko ek saath move karna chahiye, kabhi ek akele ko nahi, warna woh ek doosre ki purani positions padh rahe honge. Yahi hai RK4 for systems: chaar synchronized peeks, ek weighted average, baar baar.


Connections

  • Parent topic
  • RK4 for a single ODE — scalar recipe jise humne bold kiya.
  • Simpson's Rule — area-sampling jise RK4 imitate karta hai.
  • Reducing higher-order ODEs to first-order systems
  • Euler's method for systems — ek-peek wala cousin.
  • Local vs Global Truncation Error — kyun .
  • Stiff systems and stability — jahan explicit RK4 struggle karta hai.