4.8.15 · Maths › Numerical Methods
Hum ∫ a b f ( x ) d x chahte hain lekin aksar antiderivative nahi mil sakta (jaise e − x 2 , ya f sirf data points pe pata hai).
Trapezoids kyun? Ek tiny strip pe curve almost seedha dikhta hai. Har strip pe curve ki jagah ek seedhi line le lo, aur ek seedhi line ke neeche ka area bas ek trapezium hai — aasaan. Saari strips add karo. Strips jitni patli hongi, seedhi-line wali approximation utni acchi hogi, isliye h → 0 hone par accuracy improve hoti hai.
EK strip [ x i , x i + 1 ] jis ki width h = x i + 1 − x i hai, ko hum kaise approximate karte hain:
f ki jagah seedhi line L ( x ) lo jo endpoints ( x i , f ( x i )) aur ( x i + 1 , f ( x i + 1 )) se guzre. L ke neeche ka region ek trapezium hai jis ki parallel sides f ( x i ) aur f ( x i + 1 ) hain aur height h hai.
Intuition "Composite" kyun?
[ a , b ] pe ek bada trapezoid bahut crude hoga. [ a , b ] ko n equal strips mein baanto jis ki width h = n b − a ho, nodes x k = a + k h hon. Single rule ko har strip pe apply karo aur jodo .
Summing se derivation:
∫ a b f d x ≈ ∑ k = 0 n − 1 2 h ( f ( x k ) + f ( x k + 1 ) )
Terms likhke dekho: f ( x 0 ) + f ( x 1 ) + f ( x 1 ) + f ( x 2 ) + ⋯ + f ( x n − 1 ) + f ( x n ) .
Har interior node x 1 , … , x n − 1 do strips mein aata hai → do baar count hota hai. Endpoints ek baar aate hain.
Intuition Error kyun hota hai
Ek seedhi line curvature ko ignore karti hai. Agar f mudi hui ho (second derivative f ′′ = 0 ), toh line over/under-shoot karti hai. Toh error f ′′ ke saath scale hona chahiye. Convex (f ′′ > 0 , cup-up) function ke liye chord curve ke upar hoti hai → trapezoid overestimate karta hai.
Single-strip error (order derive karo). [ x i , x i + 1 ] pe Taylor-expand karo aur difference integrate karo. Exact result (ek line ke interpolation error ko integrate karne se):
E strip = − 12 h 3 f ′′ ( ξ i ) , ξ i ∈ ( x i , x i + 1 )
h 3 kyun? (sanity derivation sketch)
Linear interpolation error hai f ( x ) − L ( x ) = 2 f ′′ ( ξ ) ( x − x i ) ( x − x i + 1 ) .
Strip pe integrate karo: ∫ x i x i + 1 ( x − x i ) ( x − x i + 1 ) d x = − 6 h 3 .
Toh E strip = 2 f ′′ ( ξ ) ⋅ ( − 6 h 3 ) = − 12 h 3 f ′′ ( ξ ) . Ye step kyun? Ye constant 1/12 ko rigorously pin down karta hai, guess se nahi.
Composite error. n strips pe sum karo aur f ′′ ( ξ i ) values ka mean use karo → f ′′ ( ξ ) :
E n = ∑ − 12 h 3 f ′′ ( ξ i ) = − 12 h 3 n f ′′ ( ξ )
Ab n = h b − a hai, isliye n h 3 = ( b − a ) h 2 :
Worked example Example 1 —
∫ 0 1 x 2 d x with n = 4
Exact = 3 1 . h = 0.25 , nodes 0 , 0.25 , 0.5 , 0.75 , 1 , f = x 2 : 0 , 0.0625 , 0.25 , 0.5625 , 1 .
T 4 = 2 0.25 [ 0 + 2 ( 0.0625 + 0.25 + 0.5625 ) + 1 ] — Kyun? endpoints ka weight 1, interiors ka weight 2.
= 0.125 [ 0 + 2 ( 0.875 ) + 1 ] = 0.125 ( 2.75 ) = 0.34375 .
Error = 0.34375 − 0.3333 = 0.0104 > 0 — overestimate , expected kyunki f ′′ = 2 > 0 (convex). ✓
Bound check: ∣ E ∣ ≤ 12 ( 1 − 0 ) ( 0.25 ) 2 ( 2 ) = 0.0104 . Equality isliye kyunki f ′′ constant hai. ✓
Worked example Example 2 —
∫ 0 π sin x d x with n = 2
Exact = 2 . h = π /2 , nodes 0 , π /2 , π , f = 0 , 1 , 0 .
T 2 = 2 π /2 [ 0 + 2 ( 1 ) + 0 ] = 4 π ⋅ 2 = 2 π ≈ 1.5708 .
Bada error (under): f ′′ = − sin x < 0 andar, toh concave → trapezoid undershoot karta hai. n = 4 refine karo → 1.8961 , bahut closer. Kyun? h aadha → error ÷ 4 .
Worked example Example 3 — Forecast-then-Verify (sirf data)
f diya gaya hai x = 1 , 2 , 3 , 4 pe as 3 , 5 , 4 , 6 , h = 1 .
Forecast: weights 1 , 2 , 2 , 1 → T = 2 1 [ 3 + 2 ( 5 ) + 2 ( 4 ) + 6 ] = 2 1 [ 27 ] = 13.5 .
Verify: strips 2 1 ( 3 + 5 ) + 2 1 ( 5 + 4 ) + 2 1 ( 4 + 6 ) = 4 + 4.5 + 5 = 13.5 ✓ identical.
Common mistake "Saare nodes ko 2 se multiply karo."
Kyun sahi lagta hai: formula mein 2's bhari padi hain. Fix: endpoints f ( x 0 ) , f ( x n ) ko weight 1 milta hai, sirf interiors ko 2 . Pattern 1 , 2 , 2 , … , 2 , 1 .
∝ h hai, toh half h se error aadha hoga."
Kyun sahi lagta hai: finer mesh = better, linear natural lagta hai. Fix: error ∝ h 2 hai. h aadha karne se error 4 guna kam hota hai. Isliye n double karna zyada faida deta hai.
h = n + 1 b − a ."
Kyun: n + 1 nodes dekhke temptation hota hai. Fix: n = strips ki sankhya, h = n b − a ; nodes n + 1 hote hain.
Common mistake "Trapezoidal parabolas ke liye exact hai."
Kyun: Simpson's hai, toh log dono ko blur kar dete hain. Fix: Trapezoidal sirf degree 1 (seedhi lines) tak exact hai, kyunki error mein f ′′ hai.
Recall Feynman: ek 12-saal ke bachche ko explain karo
Socho ek ulhji hui pahari hai aur tum uske neeche ka area chahte ho. Ek wiggle measure nahi kar sakte, lekin seedhe slopes CAN measure kar sakte ho. Toh pahari ko patli slices mein kato aur maan lo ki har slice ka top ek seedha ramp hai. Ek ramp ke neeche ka area aasaan hai (ek tircha box). Saare boxes add karo — wahi tumhara answer hai. Agar pahari zyada curve karti hai, patli slices thodi galat guess karti hain; slices ko do guna patla karne se galti chaar guna chhoti ho jaati hai.
"1-2-2-...-2-1, times h over 2." Aur error ke liye: "Trap error is curvy-squared" — curvature f ′′ aur h 2 pe depend karta hai.
Composite trapezoidal formula T n = 2 h [ f ( x 0 ) + 2 ∑ k = 1 n − 1 f ( x k ) + f ( x n ) ] , h = n b − a
Node weights ka pattern 1 , 2 , 2 , … , 2 , 1 (endpoints 1, interiors 2)
Composite trapezoidal ka global error E n = − 12 ( b − a ) h 2 f ′′ ( ξ ) , yaani O ( h 2 )
n double karne par error ka kya hota hai?Approximately 4 guna kam ho jaata hai (kyunki E ∝ h 2 = 1/ n 2 )
Trapezoidal rule polynomials ke liye degree kitni tak exact hai? 1 (linear), kyunki error mein f ′′ hai
Jab f convex ho (f ′′ > 0 ) toh error ka sign kya hoga? Positive — rule overestimate karta hai (chord curve ke upar hoti hai)
Single-strip error term − 12 h 3 f ′′ ( ξ ) har strip pe
Interior nodes ko weight 2 kyun milta hai Har interior node do adjacent strips ke beech share hota hai
n strips ke liye nodes ki sankhyan + 1
Simpson's Rule — parabolas fit karta hai, error O ( h 4 ) , degree 3 tak exact
Riemann Sums — trapezoidal = left & right Riemann sums ka average
Taylor's Theorem — interpolation error term ka source
Linear Interpolation — har strip pe line L ( x )
Richardson Extrapolation — T n , T 2 n combine karo h 2 term ko khatam karne ke liye → Romberg
Numerical Methods — parent index
Replace f by line per strip
Strip error = -h^3/12 f''
Composite error order h^2
Better accuracy as h to 0