4.8.3 · Maths › Numerical Methods
Intuition Ek-sentence wali idea
Computers numbers ko finite precision ke saath store karte hain, isliye 1 aur us agले number ke beech ek tiny gap hota hai jo computer represent kar sakta hai. ==Machine epsilon (ε mach )== us gap ki size hai — floating-point arithmetic ki sabse choti relative "graininess".
Ek real number jaise π = 3.14159265 … ke infinitely many digits hote hain, lekin memory finite hai. Toh computer ko har number ko binary digits (bits) ki ek fixed number par round karna padta hai. Rounding ek residue chhodti hai — aur us residue ki relative size kabhi bhi ε mach se choti nahi ho sakti. Yeh number system ki resolution limit hai, bilkul jaise sirf millimetres mein marked ruler 0.3 mm measure nahi kar sakta.
Definition Floating-point representation
Ek number is tarah store hota hai
x = ± ( 1. b 1 b 2 … b t ) 2 × 2 e
jahan mantissa (significand) mein t fractional bits hain aur e exponent hai. Leading 1 "free" hota hai (normalized numbers ke liye hamesha wahan hota hai), toh hume t + 1 bits of precision milti hai.
Definition Machine epsilon
==ε mach == 1.0 aur 1.0 se bade agले representable number ke beech ka gap hai:
ε mach = 2 − t
IEEE-754 double precision ke liye, t = 52 , isliye
ε mach = 2 − 52 ≈ 2.22 × 1 0 − 16 .
Common mistake Steel-man: "epsilon sabse chota positive number hai"
Kyun sahi lagta hai: "sabse chota gap" sunne mein "sabse chota number" lagta hai.
Fix: Sabse chota positive representable number bahut zyada tiny hai — doubles ke liye sabse chota normalized float ≈ 2.2 × 1 0 − 308 hai, aur subnormals ke saath aap ≈ 5 × 1 0 − 324 tak ja sakte hain. Dono underflow / exponent range ke baare mein hain, jo bilkul alag cheez hai. Epsilon relative precision near 1 ke baare mein hai, na ki aap zero ke kitna paas ja sakte hain.
Intuition "Unit roundoff" cousin
Jab ek real x ko uske nearest float fl ( x ) par round kiya jata hai, toh rounding aapko half a gap ke andar land karti hai, isliye
∣ x ∣ ∣ fl ( x ) − x ∣ ≤ u = 2 1 ε mach = 2 − t − 1 .
u ko unit roundoff kehte hain. Bahut saari textbooks "machine epsilon" ko yeh u define karti hain. Hamesha check karo ki konsa convention use ho raha hai — lekin idea (relative precision ∼ 1 0 − 16 ) same hi hai.
Worked example 1 — Kyun computer par
0.1 + 0.2 != 0.3
0.1 binary mein repeating fraction 0.0 0011 2 hai — ise exactly store nahi kiya ja sakta, isliye ise relative error ≤ u ke saath round kiya jata hai. Yahi 0.2 aur 0.3 ke liye bhi.
Do rounded numbers ko add karne par ε mach order ka residue bachta hai:
0.1 + 0.2 = 0.30000000000000004 …
Observed error ≈ 4.44 × 1 0 − 17 ≈ 0.2 ε mach hai (0.3 ke paas consecutive floats ke beech gap 4 1 ε mach ⋅ (scale) hai, isliye residue ek aisa gap hai).
Yeh step kyun? Discrepancy exactly 0.3 ke paas number line ki graininess hai, jo epsilon ka meaning confirm karta hai.
Worked example 2 — Epsilon khud compute karo
E = 1.0 se shuru karo. Ise tab tak halve karte raho jab tak 1 + E > 1 abhi bhi true rahe:
E = 1.0
while 1.0 + E > 1.0:
E = E/2
E = 2*E # last value that still mattered
Loop tab rukta hai jab 1 + E wapas 1 par round ho jata hai, yaani jab E gap se niche girta hai. Final E ≈ 2.22 × 1 0 − 16 .
Yeh step kyun? Hum literally sabse choti perturbation ko probe kar rahe hain jise 1.0 abhi bhi "feel" kar sake. Yahi definition hai.
Worked example 3 — Kab equality par trust karna chahiye
Floats ke liye kabhi if x == y mat likho. Iske bajaye test karo
∣ x − y ∣ ≤ tol ⋅ max ( ∣ x ∣ , ∣ y ∣ ) , tol ≈ 10 ε mach .
Yeh step kyun? Har arithmetic op ∼ ε mach error inject kar sakta hai; kuch ops ke baad accumulated noise floor epsilon ka ek chota multiple hota hai, isliye tolerance ko epsilon ke saath aur numbers ki magnitude ke saath scale karna chahiye.
Worked example 4 — Catastrophic cancellation epsilon ko amplify karta hai
x = 1 0 − 8 ke paas f ( x ) = x 2 1 − cos x compute karo. True value → 1/2 .
Yahan 1.0 exactly store hota hai, lekin cos x ≈ 1 − 5 × 1 0 − 17 nearest float of 1 par round ho jata hai, yaani 1 se uski tiny deviation relative error ∼ ε mach ≈ 2 × 1 0 − 16 ki wajah se kho jaati hai. Do nearly-equal numbers ko subtract karna cos x mein us rounding error ko ek huge relative error mein promote kar deta hai, aur 0 ya 1.1 jaisi garbage deta hai.
Fix: Subtraction se bachne ke liye x 2 2 sin 2 ( x /2 ) ki tarah rewrite karo.
Yeh step kyun? Error literal 1.0 se nahi aata (jo exact hai); yeh cos x ko round karne se aata hai. Near-equal quantities ka subtraction phir surviving result ko kuch tiny se divide kar deta hai, relative error ko blow up karta hai.
Recall Padhne se pehle predict karo
Single precision mein t = 23 hai. ε mach forecast karo.
Kya ε mach 1000 ke paas ya 1 ke paas consecutive floats ke beech ka gap hai?
Kya ε mach ko halving karte karte 0 tak jaane se matlab hai ki computer arbitrarily small numbers represent kar sakta hai?
Verify: (1) 2 − 23 ≈ 1.19 × 1 0 − 7 . (2) 1 ke paas; 1000 ≈ 2 10 ke paas gap 2 10 ε mach hai — gaps magnitude ke saath badhte hain. (3) Nahi — yeh underflow/denormals hai, ek alag limit (sabse chota normalized ≈ 2.2 × 1 0 − 308 , sabse chota subnormal ≈ 5 × 1 0 − 324 ).
Machine epsilon kya hai? 1.0 aur next representable float ke beech ka gap; ε mach = 2 − t , number system ki relative precision.
IEEE double precision ke liye ε mach ki value? 2 − 52 ≈ 2.22 × 1 0 − 16 (t = 52 mantissa bits).
ε mach = 2 − t kyun?Mantissa mein t fractional bits hain; 1 se upar sabse chota increment last bit flip karna hai = 2 − t .
ε mach aur sabse chote positive float mein fark?Epsilon = 1 ke paas relative precision (~1 0 − 16 ); sabse chota positive float = underflow limit (sabse chota normalized ~2.2 × 1 0 − 308 , sabse chota subnormal ~5 × 1 0 − 324 ). Alag concepts hain.
Unit roundoff u kya hai? Max relative rounding error = 2 1 ε mach = 2 − t − 1 , kyunki rounding half a gap ke andar land karti hai.
0.1+0.2 != 0.3 kyun?0.1, 0.2, 0.3 binary mein exactly representable nahi hain; rounding ε mach order ka residue chhodti hai (observed ≈ 4.44 × 1 0 − 17 ).
Do floats compare karne ka sahi tarika? ∣ x − y ∣ ≤ tol ⋅ max ( ∣ x ∣ , ∣ y ∣ ) with tol ∼ 10 ε mach , kabhi == nahi.
Catastrophic cancellation kya hai? Do nearly-equal numbers subtract karna tiny rounding-error ko large relative error mein promote kar deta hai.
Kya literal 1.0 exactly store hota hai? Haan — 1.0 exactly representable hai; 1 − cos x mein error cos x ko round karne se aata hai, 1.0 store karne se nahi.
Floats ke beech gap magnitude ke saath kaise badalta hai? 2 e size ke number ke paas gap 2 e ε mach hai — gaps magnitude ke saath badhte hain.
Single precision (t = 23 ) ke liye ε mach ? 2 − 23 ≈ 1.19 × 1 0 − 7 .
Recall Feynman: 12-saal ke bachche ko samjhao
Socho ek ruler jo number 1 ke paas sirf bahut paas-paas lines dikhata hai, lekin numbers ke bade hone ke saath lines aur door ho jaati hain. Computer sirf ek line par point kar sakta hai, kabhi do lines ke beech nahi. Machine epsilon number 1 ke bilkul baad waali do lines ke beech ka sabse chota gap hai. Agar aap computer se us gap se patli cheez mark karne kahein, toh woh nearest line par snap kar leta hai — woh tiny snapping error hi wajah hai ki 0.1 + 0.2 thoda sa galat aata hai. Computer baavla nahi hai; uske paas bas ek sabse chota "pencil width" hai, aur epsilon wahi width hai.
"EPS = Even the Pencil Slips." Epsilon 1 ke paas pencil width hai: doubles ke liye 2 − 52 . Aur: "epsilon ≠ tiniest number; yeh tiniest step hai."
leaves residue bounded by
bounds relative rounding error
Gap between 1 and next float
Not smallest positive number
Underflow / exponent range