Ek step par exact integral se shuru karte hain:
y(t+h)=y(t)+∫tt+hf(s,y(s))ds.
RK4 is integral ko Simpson-jaisi sampling se approximate karta hai — f ko start par, midpoint par do baar, aur end par evaluate karta hai — lekin estimated states use karke, unknown true ones se nahi.
Solve karo y1′=y2,y2′=−y1 with y(0)=(1,0). (True solution: y1=cost,y2=−sint.) h=0.1 lo, ek step.
Toh f(t,y)=(y2,−y1).
Step k1.k1=(y2,−y1)=(0,−1).
Yeh step kyun? Current state (1,0) use karke start par slope nikala.
Step k2. Intermediate state y+2hk1=(1,0)+0.05(0,−1)=(1,−0.05).
k2=(−0.05,−1).
Yeh step kyun? Hum slope ko predicted midpoint par re-evaluate karte hain — note karo ki dono components ne advanced state use ki, sirf ek ne nahi.
Step k3.y+2hk2=(1,0)+0.05(−0.05,−1)=(0.9975,−0.05).
k3=(−0.05,−0.9975).
Yeh step kyun?k2 use karke ek refined midpoint slope.
Step k4.y+hk3=(1,0)+0.1(−0.05,−0.9975)=(0.995,−0.09975).
k4=(−0.09975,−0.995).
Yeh step kyun? Interval ke end par slope.
Combine karo.y1,1=1+60.1(0+2(−0.05)+2(−0.05)+(−0.09975))=1+60.1(−0.29975)≈0.99500.y2,1=0+60.1(−1+2(−1)+2(−0.9975)+(−0.995))=60.1(−5.99)≈−0.099833.
True: cos0.1=0.995004, −sin0.1=−0.099833. y1 ki value ~4 decimals tak match karti hai; y2 ki value ~3 decimals tak match karti hai — sirf ek step mein.
Solve karo y′′+y=0, y(0)=1,y′(0)=0. Reduce karo: u1=y,u2=y′:
u1′=u2,u2′=−u1.Yeh step kyun? Example 1 jaisi hi physics hai — pendulum/oscillator. Humne ek 2nd-order ODE ko system mein convert kiya taaki RK4-for-systems directly apply ho sake. Result identical hai: y1cost track karta hai. Yeh prove karta hai ki reduction trick ek method ko saare orders handle karne deti hai.
Socho do dost daud rahe hain aur haath pakde hain — jahan ek jaata hai doosre par asar padta hai. Andaaza lagaane ke liye ki woh ek pal baad kahan honge, tum sirf ek baar peek nahi karte; tum chaar baar peek karte ho: shuru mein, beech mein do baar, aur end mein — har baar andaaza lagate ho ki dono dost saath mein kahan gaye. Phir tum ek smart weighted average lete ho (beech wale peeks ko double count karo). Kyunki woh haath pakde hain, tumhe har peek par dono ko move karna padta hai, kabhi ek ko akela nahi. Wahi careful four-peek average hai RK4 for systems.