4.8.25 · D4 · HinglishNumerical Methods

ExercisesAdaptive step-size — RK45, error control

3,359 words15 min read↑ Read in English

4.8.25 · D4 · Maths › Numerical Methods › Adaptive step-size — RK45, error control

Is poore page ka ek hi formula hai:

Koi bhi exercise shuru karne se pehle, hum har symbol ko clearly define kar lete hain taaki kuch bhi bina define ke use na ho.

Shuru karne se pehle neeche ki figure padho. Ye plot karta hai, ek step ke liye jo exactly tol par land karta hai, predicted next-step error ko tol ke fraction ke roop mein ki choice ke against — dikhata hai ki safe-but-not-wasteful sweet spot kyun hai, aur accept region mark karta hai.

Figure — Adaptive step-size — RK45, error control

Fuller stage-by-stage derivation ke liye dekho the parent note.


Level 1 — Recognition

Recall Solution L1.1

(a) Ek embedded Runge–Kutta pair (RK45 / Fehlberg / Dormand–Prince). (b) . Ek system ke liye yeh tolerance-scaled RMS norm hai (accept karo jab ); single equation ke liye bas hai. Yeh free hai kyunki yeh har expensive -evaluation reuse karta hai aur sirf ek sasta weighted difference add karta hai. (c) Controller use karta hai: error estimate essentially 4th-order result ke local error ko measure karta hai. Aap fir bhi se advance karte ho (local extrapolation), lekin update mein exponent hai use karte hue. Dekho Order of a Numerical Method.

Recall Solution L1.2

Rule: accept karo agar aur sirf agar .

  • A: accept.
  • B: accept (equality pass hoti hai).
  • C: reject, same se step redo karo.

Level 2 — Application

Recall Solution L2.1

(a) accept. (b) Ratio . Hamare paas error spare tha, isliye hum grow karte hain — lekin sirf se, 20 se nahi, kyunki local error ki tarah scale hota hai.

Recall Solution L2.2

(a) reject. (b) Ratio . Same se ke saath retry karo.

Recall Solution L2.3

(a) . (b) accept (relative part ne bachaya). (c) Ratio . Note karo ki sirf atol () use karne se yeh perfectly good step reject ho jaata — dekho Local vs Global Truncation Error ki kyun absolute-only tolerances misbehave karti hain jab bada ho.


Level 3 — Analysis

Recall Solution L3.1

set karo. Toh raw update factor hai Predicted error ki tarah scale hota hai, isliye , isliye — comfortably budget ke neeche. Yahi safety factor khareedta hai: jab hum tol par dead-on bhi hit karein, agla step ~59% of tol par land karne ka prediction hai, toh pehli try mein accept hone ki bahut zyada probability hai. Yeh wahi trade-off hai jo opening figure mein draw kiya gaya hai.

Recall Solution L3.2

Shrink factor .

  • Student X: ~76% tak girta hai.
  • Student Y: half ho jaata hai. Kyunki true local error hai, factor-4 error overshoot ko fix karne ke liye sirf chahiye. Student Y ka exponent over-shrinks karke par le jaata hai, steps waste karta hai: retried step ke saath wapas aayega — 8× under budget, matlab bahut agla step turant grow karne ki koshish karega. Galat exponent ⇒ oscillating, inefficient stepping. Dekho Taylor Series Expansion ki kahan se aata hai.
Recall Solution L3.3

(a) Ratio . (b) clamp fire karta hai (yaad karo opening definitions se). (c) . error model sirf locally trustworthy hai; ~20× jump ek aise region mein leap kar sakta hai jahan completely alag curvature ho, isliye hum growth ko 5× par cap karte hain.


Level 4 — Synthesis

Recall Solution L4.1

Attempt 1: reject. par raho. Ratio . Factor (clamps ke andar). Attempt 2 ( se, ke saath): accept. Advance: . Ab agले interval ke liye step pick karo: ratio , factor . Summary: ek baar reject (t 0 par raha), doosri try mein accept (t ≈0.06238 par advance hua), phir agले interval ke liye thoda grow karke ≈0.06744 hua.

Recall Solution L4.2

(a) Attempts . (b) calls . (c) Wasted calls; fraction . ~10–15% rejection rate healthy hai — iska matlab controller ko tolerance ke edge tak push kar raha hai, timidly chhota nahi reh raha.


Level 5 — Mastery

Recall Solution L5.1

Attempt 1 (): reject. Ratio . Factor (clamps ke andar, kyunki ). Attempt 2 (): reject. Ratio . Factor . Attempt 3 (): accept. Advance: . Final: do rejections aur ek acceptance ke baad . Note karo ki clamp yahan kabhi fire nahi hua; har shrink previous ke se kaafi upar raha.

Recall Solution L5.2

(a) Ratio . Raw factor . , toh raw . (b) lower clamp fire karta hai. (c) . (d) se kaafi neeche raw factor baar baar aana stiff region ki fingerprint hai — yahan ek explicit adaptive method thrash kar sakta hai; implicit solver consider karo (dekho Stiff ODEs and Stability).

Recall Solution L5.3

Ratio .

  • Galat (, exponent ): factor , .
  • Sahi (, exponent ): factor , . Sahi controller zyada grow karta hai (factor 2 vs 1.78). Reason: error estimate 4th-order solution ke error ko track karta hai, jo ki tarah scale hota hai; 32× error surplus × step increase allow karta hai. use karne se underestimate hota hai ki aap kitni tezi se grow kar sakte ho — safe hai lekin wasteful. Mnemonic wahi rehta hai: "Tol Over Error, to the Fifth-root."
Recall Solution L5.4

(a) Maximum shrink: . (b) → yeh floor violate karta hai. (c) Solver ko silently sub-floor step nahi lena chahiye. Standard behaviour (jaise scipy ka solve_ivp) ya toh ko tak clamp karta hai aur thoda-sa-zyada error warning ke saath accept karta hai, ya abort karta hai "step size too small" failure ke saath. Blindly shrink karte rehna dangerous hai kyunki (i) machine ki taraf underflow kar sakta hai, jahan round back ho jaata hai par aur integration forever stall ho jaata hai; aur (ii) hajaaron micro-steps mein round-off accumulate hota hai jo us accuracy ko swamp kar deta hai jiska aap peecha kar rahe the. Repeatedly hit karna implicit method mein switch karne ka classic signal hai jo stiff problems ke liye built ho.


Connections

  • Runge–Kutta Methods (RK4) — fixed-step method jise ye embedded pairs extend karte hain.
  • Local vs Global Truncation Error — kyun local error controller ko drive karta hai.
  • Order of a Numerical Method mein ko pin karta hai.
  • Stiff ODEs and Stability — jahan se L5.2, L5.4 aur endless-rejection trap aate hain.
  • Taylor Series Expansion — leading error term ka source.
  • Dormand–Prince (RK45 used by scipy solve_ivp) — stages ke peechhe coefficient table aur RMS norm convention.
  • Hinglish version →