Simpson's stencil har pair ke liye 1-4-1 hota hai. Teen pairs ko six slices ke across chain karo.
Endpoints (x0,x6) ek-ek parabola se belong karte hain → weight 1.
Odd-index nodes (x1,x3,x5) pair-centres hain (woh peak jahan parabola bend karti hai) → weight 4.
Even interior nodes (x2,x4) do adjacent parabolas ke beech share hote hain → weight 2.
Toh pattern hai
[1,4,2,4,2,4,1].
Check karo: weights ka sum 1+4+2+4+2+4+1=18=3n hai, aur 3h⋅3n⋅(avg f) constant f ke liye (b−a)⋅(avg f) recover karta hai. ✓
Recall Solution
Points =n+1, isliye n=9−1=8. Phir h=nb−a=84−0=0.5.
Simpson ko neven chahiye; 8 even hai ✓ — allowed hai.
h=42−0=0.5. Nodes aur heights:
x=0,0.5,1,1.5,2⇒f=1,1.25,2,3.25,5.T4=2h[f(x0)+f(x4)+2(f(x1)+f(x2)+f(x3))]=20.5[1+5+2(1.25+2+3.25)]=0.25[6+2(6.5)]=0.25⋅19=4.75.
Exact value: ∫02(x2+1)dx=38+2=4.66. Trapezoid overshoot karta hai (curve convex hai, seedhi lids uske upar baith jaati hain) approximately ≈0.083 se.
Recall Solution
Same nodes/heights jaise L2.1 mein hain. Weights [1,4,2,4,1]:
S4=3h[1+4(1.25)+2(2)+4(3.25)+5]=30.5[1+5+4+13+5]=30.5⋅28=4.66.
Yeh exact 14/3 ke exactly barabar hai, kyunki x2+1 degree 2 ka hai aur Simpson saari parabolas ko exactly integrate karta hai.
Ratio E2/E4=0.035649/0.008940≈3.99≈4. ✓ O(h2) prediction hold karti hai.
Recall Solution
Kyun: Ek cubic par parabola fit karne ki error leftover cubic term se aati hai. Symmetric interval [−h,h] par cubic error term x ka odd function hota hai, aur symmetric limits par ek odd function ka integral 0 hota hai. Simpson nodes −h,0,h symmetric hain, isliye odd leftover exactly zero integrate ho jaata hai — cubic term error mein kuch contribute nahi karta. Yahi woh "free" extra degree hai.
Confirm: true value ∫−11x3dx=0 (odd function). Simpson ke saath h=1, f(−1)=−1,f(0)=0,f(1)=1:
S=31[(−1)+4(0)+1]=31⋅0=0.
Exact, jaisa promise tha. ✓
Richardson combine karo:
S=34(4.75)−5=319−5=314=4.66.
Yeh S4=4.66 se exactly match karta hai. Kyun kaam karta hai: trapezoid error Ch2+O(h4) hai. h half karne par leading term 41 se scale hota hai; weights 4 aur −1 over 3 precisely isliye choose kiye gaye hain taaki h2 terms cancel ho jaayein, ek aisi method chhod ke jo O(h4) tak accurate hai — yahi Simpson hai. Yeh Richardson extrapolation ka ek step hai; ise iterate karne par Romberg integration milti hai.
Recall Solution
h=0.2, nodes xi=0,0.2,0.4,0.6,0.8,1.0, heights
f=1,1.221403,1.491825,1.822119,2.225541,2.718282.Simpson on [0,0.8] (nodes x0..x4, weights 1,4,2,4,1):
S=30.2[1+4(1.221403)+2(1.491825)+4(1.822119)+2.225541]
Bracket =1+4.885612+2.983650+7.288476+2.225541=18.383279; ×30.2=1.225552.Trapezoid on [0.8,1.0] (nodes x4,x5):
T=20.2[2.225541+2.718282]=0.1⋅4.943823=0.494382.Total=1.225552+0.494382=1.719934. Error ≈0.00165 — pure trapezoid se kaafi better, dangling slice ko honestly handle karta hai.
Trapezoid exact: koi bhi straight line, jaise f(x)=3x+1 on [0,4]. Trapezoid construction se degree-1 polynomials ke liye exact hota hai (seedha lid function hi hota hai). Exact value ∫04(3x+1)dx=23(16)+4=28; n=1 ke saath, T1=24[f(0)+f(4)]=2[1+13]=28. ✓ Simpson bhi 28 deta hai lekin tumhe kuch extra nahi milta — capture karne ke liye koi curvature hi nahi hai.
Error orders fail:f(x)=x lo [0,1] par. Iska derivative x=0 par blow up karta hai, isliye O(h2)/O(h4) ke peeche wala Taylor-series argument (jisme bounded higher derivatives ki zaroorat hoti hai) break down ho jaata hai. Observed convergence h2 se slower hoti hai. Lesson: advertised error orders assume karte hain ki f kaafi smooth hai (trapezoid ke liye bounded 2nd derivative, Simpson ke liye 4th). Kinks, cusps, aur singularities guarantee void kar dete hain — wahan scipy.integrate.quad ki adaptive machinery use karo.
Recall Solution
Correct (weights 1,4,1): 31[0+4(1)+4]=38=2.6667. Exact ✓.
Buggy (weights 4,4,4): 31[4(0)+4(1)+4(4)]=31[0+4+16]=320=6.6667.
Bug se error=6.6667−2.6667=4.0000 — bahut hi galat answer (2.5× zyada bada). Sirf x2=2 par extra weight (jahan f=4) ne akele 31⋅3⋅4=4 add kar diya. Isliye endpoint weighting #1 silent bug hai: yeh crash nahi karta, bas quietly garbage return karta hai.
Recall Solution
S4 (h=0.25, nodes 0,0.25,0.5,0.75,1, f=0,0.00390625,0.0625,0.31640625,1):
S4=30.25[0+4(0.00390625)+2(0.0625)+4(0.31640625)+1]
Bracket =0+0.015625+0.125+1.265625+1=2.40625; ×30.25=0.200521.
Error E4=0.200521−0.2=0.000521 — chhota lekin nonzero (degree 4, Simpson ke exact degree 3 se zyada hai).
S8 (h=0.125): weighted sum compute karne par S8=0.20003255 milta hai, error E8≈0.00003255.
Ratio E4/E8≈0.000521/0.00003255≈16.0=24. ✓ O(h4) order confirm ho gaya.
Recall Self-test summary (cloze)
Slice width hai ==h=(b−a)/n.
Simpson's per-pair stencil hai 1-4-1, scale hota hai h/3== se.
Trapezoid error order ::: O(h2)
Simpson error order ::: O(h4)
Highest exact degree — trapezoid / Simpson ::: 1 / 3
n subintervals ke liye points ::: n+1
Richardson combo jo trapezoids se Simpson deta hai ::: S=(4T(h/2)−T(h))/3