4.8.23 · D3 · Maths › Numerical Methods › Modified Euler (Heun's method)
Yeh note har tarah ke problems ka tour hai jo Heun's method mein aa sakte hain — flat starts, decreasing solutions, bade steps, multi-step marches, iterated correctors, aur exam twists. Pehle answer guess karo, phir dekho kaise nikalta hai.
Shuru karne se pehle, ek hi formula hai jis par poore page mein rely karenge (jo parent note mein scratch se banaya gaya hai):
Is method mein jo bhi problem aa sakti hai woh in cells mein se kisi ek mein hogi. Neeche ke examples mein cell(s) label kiye gaye hain.
#
Case class
Kya special hai
Example
A
Positive growing slope
f > 0 , curve upar bend karta hai
Ex 1
B
Zero start-slope
k 1 = 0 , Euler freeze ho jaata
Ex 2
C
Negative / decaying slope
f < 0 , curve neeche bend karta hai
Ex 3
D
Large step h
h bada → predictor bahut door, robustness test karta hai
Ex 4
E
Multi-step march
Recipe repeat karo, y 1 ko next step mein daalo
Ex 5
F
Iterated corrector
Output ko recycle karo implicit equation solve karne ke liye
Ex 6
G
Real-world word problem
Units, real duniya mein cooling
Ex 7
H
Exam twist: f sirf x par depend karta hai
Heun pure Trapezoidal Rule mein collapse ho jaata hai
Ex 8
Hum har cell cover karenge. Koi bhi scenario chhupaaya nahi jaayega.
y ′ = x + y , y ( 0 ) = 1 , h = 0.2 se y ( 0.2 ) nikalo.
Yahan f ( x , y ) = x + y hai, toh x 0 = 0 , y 0 = 1 , h = 0.2 .
Forecast: slope 1 se start hota hai aur jaise hum daayein jaate hain badhta hai (dono x aur y badhte hain). Toh true curve upar bend karti hai — start aur end slopes ka average 1.2 se thoda upar aana chahiye.
Step 1. k 1 = f ( 0 , 1 ) = 0 + 1 = 1 .
Yeh step kyun? Recipe sabse pehle start-slope maangti hai — woh direction jis mein abhi hum point kar rahe hain.
Step 2. Endpoint predict karo: y ( p ) = y 0 + h k 1 = 1 + 0.2 ( 1 ) = 1.2 .
Yeh step kyun? End-slope k 2 tab tak nahi mil sakta jab tak x = 0.2 par y ka guess na ho; cheap Euler yeh deta hai.
Step 3. k 2 = f ( 0.2 , 1.2 ) = 0.2 + 1.2 = 1.4 .
Yeh step kyun? Yeh "peek ahead" slope hai — k 1 se steeper, confirm karta hai ki curve upar bend kar rahi hai.
Step 4. Average aur step: y 1 = 1 + 2 0.2 ( 1 + 1.4 ) = 1 + 0.1 ( 2.4 ) = 1.24 .
Yeh step kyun? Trapezoid dono slopes ko equally weight karta hai; har ek ko step ka aadha milta hai.
Verify: exact solution y = 2 e x − x − 1 se y ( 0.2 ) = 2 e 0.2 − 1.2 = 1.2428 milta hai. Hamara 1.24 sirf 0.0028 se off hai — aur forecast ke exactly mutabiq 1.2 se upar aaya. ✓
y ′ = − 2 x y , y ( 0 ) = 1 , h = 0.2 se y ( 0.2 ) nikalo.
f ( x , y ) = − 2 x y , x 0 = 0 , y 0 = 1 .
Forecast: x = 0 par slope − 2 ( 0 ) ( 1 ) = 0 hai — flat . Plain Euler sochega "kuch ho nahi raha" aur 1 par ruk jaayega. Heun ko aage dekhna chahiye, curve ka neeche jaana notice karna chahiye, aur 1 se neeche land karna chahiye.
Step 1. k 1 = f ( 0 , 1 ) = − 2 ( 0 ) ( 1 ) = 0 .
Yeh step kyun? Zero slope bhi ek information hai — kehta hai "abhi mat hilo, lekin future check karo."
Step 2. Predict: y ( p ) = 1 + 0.2 ( 0 ) = 1 .
Yeh step kyun? k 1 = 0 ke saath predictor y ko move nahi karta; endpoint guess abhi bhi y = 1 hai.
Step 3. k 2 = f ( 0.2 , 1 ) = − 2 ( 0.2 ) ( 1 ) = − 0.4 .
Yeh step kyun? Ab x = 0 hai, toh f negative hai — "look ahead" us downward bend ko pakad leta hai jo Euler bilkul miss kar gaya.
Step 4. y 1 = 1 + 2 0.2 ( 0 + ( − 0.4 )) = 1 − 0.04 = 0.96 .
Verify: exact y = e − x 2 = e − 0.04 = 0.9608 . Error sirf 0.0008 . Plain Euler 1.0 par atka rehta hai (error 0.039 ) — Heun isse isliye beat karta hai kyunki predictor ne curve bend dikhaya. ✓
y ′ = − y , y ( 0 ) = 1 , h = 0.1 se y ( 0.1 ) nikalo.
f ( x , y ) = − y (pure decay). x 0 = 0 , y 0 = 1 .
Forecast: answer 1 se thoda neeche hona chahiye, e − 0.1 ≈ 0.905 ke kareeb. Kyunki decay slow hoti hai jaise y shrink karta hai, end-slope start-slope se gentler hogi, toh average slope dono ke beech hogi.
Step 1. k 1 = f ( 0 , 1 ) = − 1 .
Kyun? Start-slope: poore step ka sabse steep downhill kyunki y yahan sabse bada hai.
Step 2. Predict: y ( p ) = 1 + 0.1 ( − 1 ) = 0.9 .
Kyun? End-slope read karne ke liye y kahan end hoga iska cheap guess.
Step 3. k 2 = f ( 0.1 , 0.9 ) = − 0.9 .
Kyun? Endpoint slope — shallower (− 0.9 vs − 1 ) kyunki y drop ho gaya. Yeh "slowing decay" hai.
Step 4. y 1 = 1 + 2 0.1 ( − 1 − 0.9 ) = 1 − 0.05 ( 1.9 ) = 1 − 0.095 = 0.905 .
Verify: exact y = e − 0.1 = 0.904837 . Error 0.00016 — tiny, aur hamara answer predict kiye anusaar do-slope extremes ke beech hai. ✓
y ′ = − y , y ( 0 ) = 1 , ek giant step h = 1 mein y ( 1 ) nikalo.
Wahi ODE, lekin hum jaan-boojhkar bahut aage jaate hain.
Forecast: true value e − 1 ≈ 0.368 hai. Itne bade step ke saath predictor decay ko overshoot karega (woh 0 ke kareeb value guess karega), toh rough answer milega — lekin dekho average kaisa bhi rescue karta hai.
Step 1. k 1 = f ( 0 , 1 ) = − 1 .
Kyun? Start-slope.
Step 2. Predict: y ( p ) = 1 + 1 ( − 1 ) = 0 .
Kyun? h = 1 ke saath Euler bilkul 0 tak crash karta hai — ek bura guess, lekin theek hai, yeh sirf ek scaffold hai.
Step 3. k 2 = f ( 1 , 0 ) = − 0 = 0 .
Kyun? (Galat) predicted endpoint y = 0 par slope flat hai. Heun ab ek steep − 1 aur flat 0 ka average karta hai.
Step 4. y 1 = 1 + 2 1 ( − 1 + 0 ) = 1 − 0.5 = 0.5 .
Verify: exact e − 1 = 0.3679 . Error 0.132 — Ex 3 se bahut bura! Lesson: bada h error blow up karta hai (yaad karo error ∝ h 2 ; yahan h = 1 toh koi shrinkage nahi). Phir bhi, 0.5 plain Euler ke 0 se better hai. Chote steps (Ex 5) isse theek karte hain. ✓
y ′ = − y , y ( 0 ) = 1 , do steps h = 0.5 use karke y ( 1 ) tak pahuncho.
Ex 4 ki ek badi leap ki jagah, do baar march karo. Step 1 ka output step 2 ka input banta hai.
Forecast: do steps ko Ex 4 ke 0.5 se better hona chahiye aur 0.368 ki taraf inch karna chahiye.
Step 1 — pehla step (0 → 0.5).
k 1 = f ( 0 , 1 ) = − 1 . Predict y ( p ) = 1 + 0.5 ( − 1 ) = 0.5 . k 2 = f ( 0.5 , 0.5 ) = − 0.5 .
y 0.5 = 1 + 2 0.5 ( − 1 − 0.5 ) = 1 − 0.25 ( 1.5 ) = 0.625 .
Yeh step kyun? Interval ke pehle half par ordinary Heun.
Step 2 — doosra step (0.5 → 1), y = 0.625 se shuru.
k 1 = f ( 0.5 , 0.625 ) = − 0.625 . Predict y ( p ) = 0.625 + 0.5 ( − 0.625 ) = 0.3125 .
k 2 = f ( 1 , 0.3125 ) = − 0.3125 .
y 1 = 0.625 + 2 0.5 ( − 0.625 − 0.3125 ) = 0.625 − 0.25 ( 0.9375 ) = 0.625 − 0.234375 = 0.390625 .
Yeh step kyun? Hum pichla answer aage feed karte hain — isi ko "marching" kehte hain.
Verify: exact e − 1 = 0.3679 . Error 0.0227 — ek-bade-step ke error 0.132 se roughly 6 × chhota. Step halving ne sach mein error shrink kiya. ✓
y ′ = x + y , y ( 0 ) = 1 , h = 0.1 — corrector ko ek baar iterate karo.
Plain Heun y 1 deta hai; iterated version ise recycle karta hai implicit trapezoid ko better solve karne ke liye.
Forecast: exact 1.11034 hai; ek iteration hamara answer plain 1.11 se aage us ki taraf push karna chahiye.
Step 1. Standard Heun: k 1 = 1 , y ( p ) = 1.1 , k 2 = f ( 0.1 , 1.1 ) = 1.2 , y 1 [ 1 ] = 1 + 0.05 ( 1 + 1.2 ) = 1.11 .
Kyun? Usual predictor–corrector, pehla estimate y 1 [ 1 ] = 1.11 deta hai.
Step 2. Corrected value use karke end-slope re-evaluate karo: k 2 ′ = f ( 0.1 , 1.11 ) = 0.1 + 1.11 = 1.21 .
Yeh step kyun? Trapezoid equation y 1 = y 0 + 2 h [ k 1 + f ( x 1 , y 1 )] implicit hai — y 1 dono taraf appear karta hai. Apna better y 1 wapas insert karne se yeh zyada exactly solve hota hai.
Step 3. Phir correct karo: y 1 [ 2 ] = 1 + 0.05 ( 1 + 1.21 ) = 1 + 0.05 ( 2.21 ) = 1.1105 .
Verify: exact 1.110342 . Plain Heun error 0.00034 ; iterated error 0.00016 — half ho gaya. Iterate karna true trapezoid root tak converge karta hai. ✓
Newton cooling. 2 0 ∘ C ke room mein 9 0 ∘ C ki coffee T ′ = − 0.5 ( T − 20 ) se cool hoti hai (units: ∘ C / min ). h = 2 min ke saath 2 minutes baad temperature estimate karo.
f ( t , T ) = − 0.5 ( T − 20 ) , t 0 = 0 , T 0 = 90 .
Forecast: garam coffee pehle fast cool hoti hai, phir slow. Do minute mein kaafi temperature drop honi chahiye — 50 –6 0 ∘ range mein kahin.
Step 1. k 1 = f ( 0 , 90 ) = − 0.5 ( 90 − 20 ) = − 0.5 ( 70 ) = − 35 (∘ C/min).
Kyun? Initial cooling rate — coffee sabse zyada garam hai, toh sabse tezi se heat shed karti hai.
Step 2. Predict: T ( p ) = 90 + 2 ( − 35 ) = 90 − 70 = 20 (∘ C).
Kyun? Cheap Euler guess. Note karo h bada hai, toh yeh room temperature tak over-cool kar deta hai — yeh scaffold hai, answer nahi.
Step 3. k 2 = f ( 2 , 20 ) = − 0.5 ( 20 − 20 ) = 0 (∘ C/min).
Kyun? (Over-cooled) predicted end par cooling ruk gayi hai. − 35 aur 0 ka average ek sensible middle rate deta hai.
Step 4. T 1 = 90 + 2 2 ( − 35 + 0 ) = 90 − 35 = 5 5 ∘ C .
Kyun? Yahan 2 h = 1 min hai, toh averaged rate − 35 ... ruko — check karo: 2 2 ( k 1 + k 2 ) = 1 ⋅ ( − 35 ) = − 35 . Answer 5 5 ∘ C.
Verify: exact T = 20 + 70 e − 0.5 t hai, toh T ( 2 ) = 20 + 70 e − 1 = 20 + 25.75 = 45.7 5 ∘ C. Hamara 5 5 ∘ zyada hai kyunki h = 2 bahut bada hai (yeh Cell D ka large-step penalty disguise mein hai). Units poore mein consistent hain (∘ C/min × min = ∘ C). Chhota h ise tight karta. ✓
y ′ = 2 x , y ( 0 ) = 0 , h = 1 se y ( 1 ) nikalo. Dikhao ki Heun pure Trapezoidal Rule mein collapse ho jaata hai.
f ( x , y ) = 2 x — koi y nahi aata.
Forecast: exact y = x 2 hai, toh y ( 1 ) = 1 . Kyunki f y ko ignore karta hai, predictor ka y guess kabhi matter nahi karta — Heun bilkul ∫ 0 1 2 x d x par Trapezoidal Rule ban jaata hai.
Step 1. k 1 = f ( 0 , 0 ) = 2 ( 0 ) = 0 .
Kyun? Start-slope. Note karo y 0 f ke liye irrelevant hai.
Step 2. Predict: y ( p ) = 0 + 1 ( 0 ) = 0 .
Kyun? Recipe ke liye zaroori hai — lekin f y nahi padhta, toh yeh value k 2 ke liye kabhi use nahi hoti.
Step 3. k 2 = f ( 1 , 0 ) = 2 ( 1 ) = 2 — predicted y (0 ) ignore ho jaata hai.
Yeh step kyun? Yahi punchline hai: x -only ODEs ke liye, k 2 = f ( x 1 ) chahe predictor kuch bhi ho. Heun = integrand ka trapezoid.
Step 4. y 1 = 0 + 2 1 ( 0 + 2 ) = 1 .
Verify: exact y = x 2 , y ( 1 ) = 1 . Exact — kyunki trapezoidal rule linear integrand 2 x ke liye exact hai, aur Heun yahan wahi rule hai. Isliye parent note corrector ko "Trapezoidal Rule in disguise" kehta hai. ✓
Recall Har example ne kaunsa cell cover kiya?
Kaunsa example prove karta hai ki Heun = Trapezoidal Rule jab f mein koi y nahi? ::: Ex 8 (Cell H).
Kaunsa example dikhata hai ki bada step h error blow up karta hai? ::: Ex 4 (Cell D), aur Ex 7 ki cooling bhi.
Kaunse example mein zero start-slope hai jo plain Euler ko freeze kar deta? ::: Ex 2 (Cell B).
Kaunsa example multiple steps aage march karta hai? ::: Ex 5 (Cell E), h = 0.5 ke do steps.
Kaunsa example corrector ko iterate karta hai? ::: Ex 6 (Cell F).
Mnemonic Cover-the-matrix checklist
G rowth, Z ero-slope, D ecay, B ig-step, M arch, I terate, W ord, eX -only → "G Z D B M I W X ": exam se pehle pooch lo yeh kaunsa cell hai?
Modified Euler (Heun's method) — woh parent recipe jo har example apply karta hai.
Euler's Method — har example mein predictor step.
Trapezoidal Rule — Ex 8 mein literally Heun hai .
Order of Accuracy and Step Size — Ex 4 vs Ex 5 explain karta hai (bada vs chhota h ).
Predictor-Corrector Methods — Ex 6 ka iterated corrector.
Runge-Kutta Methods — har example secretly RK2 hai.