Yeh page ek self-testing ladder hai. Har problem ko uski solution kholne se pehle khud try karo. Levels "kya tum RK4 pehchaan sakte ho?" se shuru hokar "kya tum iske saath cheezein build aur prove kar sakte ho?" tak jaate hain. Yahan use hue har symbol ki definition parent note RK4 derivation mein hai — use reference ke liye khula rakho.
RK4 recipe mein, k3 kis x-value par evaluate hota hai, aur yeh kaun si previous slope reuse karta hai?
Recall Solution
k3=hf(xn+2h,yn+2k2). Toh yeh midpointxn+2h par sample hota hai, aur yeh k2 reuse karta hai (ek refined midpoint slope). Figure s01 dekho: dono amber arrows (k2 aur k3) midpoint par ek hi vertical dashed line share karte hain; sirf estimated y ki height alag hoti hai.
Ek student likhta hai yn+1=yn+6h(k1+2k2+2k3+k4) jahan ki=hf(…) use kar raha hai. Kya yahan extra 6h sahi hai, ya 61 hona chahiye?
Recall Solution
61 hona chahiye, na ki6h. Hamare convention mein har ki mein h ka ek factor pehle se hai (kyunki ki=hf). 6h likhne se h se do baar multiply ho jaata, jo h2 step deta — galat dimensions.
yn+1=yn+61(k1+2k2+2k3+k4).6h wali form tabhi correct hai jab doosre convention mein ki ek pure slope ho (koi h nahi).
y′=−2y, y(0)=3 ko h=0.5 se ek step mein y(0.5) tak solve karo. (Note: f mein koix-dependence nahi hai, isliye saare stages trivially ek hi x shift use karte hain.)
Recall Solution
f(x,y)=−2y, y0=3, h=0.5.
k1=0.5(−2⋅3)=−3.
k2=0.5(−2(3+2−3))=0.5(−2⋅1.5)=−1.5.
k3=0.5(−2(3+2−1.5))=0.5(−2⋅2.25)=−2.25.
k4=0.5(−2(3+(−2.25)))=0.5(−2⋅0.75)=−0.75.
y1=3+61(−3+2(−1.5)+2(−2.25)+(−0.75))=3+6−11.25=1.125.
Bracket check karte hain: −3+2(−1.5)+2(−2.25)+(−0.75)=−3−3−4.5−0.75=−11.25, aur 3−611.25=3−1.875=1.125.
Exact: y=3e−2x⇒y(0.5)=3e−1=1.103638. Yahan step h=0.5 ek fast-decaying equation ke liye bada hai, isliye error (≈0.021) dikh raha hai — ek reminder ki "4th order" chhoteh ke baare mein ek statement hai.
y′=f(x) ke liye (right-hand side sirf x par depend karta hai), dikhao ki RK4 update ∫xnxn+hf(x)dx ke liye Simpson's rule mein collapse ho jaata hai.
Recall Solution
Jab f sirf x par depend karta hai, toh y-arguments irrelevant hain, isliye:
k1=hf(xn),k2=k3=hf(xn+2h),k4=hf(xn+h).
Update mein substitute karke:
yn+1−yn=61(hf(xn)+2⋅hf(xn+2h)+2⋅hf(xn+2h)+hf(xn+h)).=6h(f(xn)+4f(xn+2h)+f(xn+h)).
Yeh last line bilkul Simpson's rule6h(f0+4fmid+f1) hai [xn,xn+h] par integral ke liye. Toh RK4 hai hi Simpson's rule, y-dependence allow karne ke liye generalize kiya gaya. Isliye weights 1,2,2,1 hain: dono midpoint samples Simpson ke single "4" mein merge ho jaate hain.
RK4 ka local (per-step) error O(h5) hai. Explain karo ki fixed interval [a,b] par global error sirf O(h4) kyun hota hai.
Recall Solution
Fixed length L=b−a cross karne ke liye tum N=hL steps lete ho — yaani N∝h1.
"Har step ∼Ch5 add karta hai" ka matlab. Ek single step par method ka answer true curve se (kuch constant) ×h5 ki bounded amount se differ karta hai. Uss constant ko C kaho: yeh package karta hai solution kitna curvy hai (roughly, interval par uski 5th derivative ka size) aur 1201 ka fixed numerical factor jo RK4 chhod jaata hai. Ch ke chhote hone par shrink nahi karta — yeh problem par depend karta hai, step par nahi — isliye ek step ke error ki poori h-dependence h5 mein hai. Isliye hum likhte hain "local error =Ch5".
Errors add kyun hote hain (error propagation). Calculation ko ek relay ki tarah socho: har step previous step ke (pehle se thode galat) answer se start hota hai aur apni nayi Ch5 galti add karta hai. Toh har step par do cheezein hoti hain — (i) ek nayi∼Ch5 error commit hoti hai, aur (ii) pehle se maujood errors aage carry hote hain. Ek well-behaved (stable) equation ke liye carried-forward errors blow up nahi hote; woh zyada se zyada bounded factor se badhte hain. Us case mein total sirf N fresh contributions ko sum karne se dominate hota hai, ek per step:
global error∼kitne stepsN×ek step ki errorCh5=hL⋅Ch5=CLh4=O(h4).h ki ek power steps ki badhti number se "khaai" jaati hai: jab h chhota hota hai tum zyada steps lete ho, isliye zyada chhoti errors pile up hoti hain, h ka ek factor cancel ho jaata hai. Dekho Local vs Global Truncation Error. Isliye RK4 ko 4th order kehte hain (global statement), chahye har step 5th-order accurate kyun na ho.
k4=0.5(1.6484375+1.081787…)=1.3651123…y2=1.6484375+61(0.82421875+2(1.0302734)+2(1.0817871)+1.3651123).
Bracket sum =6.4134277…, toh y2=1.6484375+1.0689046…=2.7173421.
Exact e=2.7182818; error ≈0.00094. Single bade step ne 2.70833 diya (error ≈0.010). Step half karne se error roughly 16=24 se cut hua — yeh 4th-order method ki pehchaan hai.
L4.1 ke observation ko use karke, bina compute kiye predict karo ki agar same problem ke liye h=0.25 ke chaar steps use karo toh error kya hoga. Reasoning batao.
Recall Solution
Global error ∝h4. h=0.5 se h=0.25 jaane par h half hota hai, toh error (21)4=161 se scale hota hai.
naya error≈160.00094≈5.9×10−5.
Toh hum predict karte hain y(1)≈e−5.9×10−5≈2.718222. (Direct computation mein error ≈6.5×10−5 aata hai — 24 rule kaam karta hai.)
Algebraically dikhao ki y′=y, y(0)=1 par size h ke single step ke saath RK4 deta hai
y1=1+h+2h2+6h3+24h4,
yaani eh ke pehle paanch terms. (Yeh direct proof hai ki RK4 Taylor se h4 tak match karta hai.)
Recall Solution
f(x,y)=y, y0=1 ke saath:
k1=h⋅1=h.
k2=h(1+2k1)=h(1+2h)=h+2h2.
k3=h(1+2k2)=h(1+2h+4h2)=h+2h2+4h3.
k4=h(1+k3)=h(1+h+2h2+4h3)=h+h2+2h3+4h4.
Ab weights 1,2,2,1 se combine karo:
k1+2k2+2k3+k4.h ki power se collect karo:
h1: 1+2+2+1=6 → contributes 6h.
h2: 2⋅21+2⋅21+1=1+1+1=3 → contributes 3h2.
h3: 2⋅41+1⋅21=21+21=1 → contributes h3.
h4: 1⋅41=41 → contributes 41h4.
Toh k1+2k2+2k3+k4=6h+3h2+h3+41h4. 6 se divide karo:
y1=1+h+2h2+6h3+24h4.
Yeh exactly eh=1+h+2h2+6h3+24h4+120h5+⋯ ke pehle paanch terms hain. Pehla term jo RK4 miss karta hai woh 120h5 hai — confirm karta hai local error O(h5). Dekho Taylor Series Methods.
Coupled system dtdx=y,dtdy=−x ko x(0)=1,y(0)=0 ke saath ek RK4 step h=0.1 use karke x(0.1),y(0.1) estimate karo. (Yeh x¨=−x hai, simple harmonic motion; exact answer x=cost,y=−sint hai.) Vector RK4 use karo: u=(x,y) aur f(u)=(y,−x) maano.
Toh x(0.1)≈0.9950042,y(0.1)≈−0.0998333. Exact: cos0.1=0.9950042,−sin0.1=−0.0998334. Dono lagbhag 2×10−6 tak match karte hain — RK4 systems ko same 4th-order accuracy ke saath handle karta hai, koi nayi machinery nahi chahiye.