∫ α β a x 2 + b x + c = a 3 x 3 + b 2 x 2 + c x ∣ α β = a 3 β 3 + b 2 β 2 + c β − ( a 3 α 3 + b 2 α 2 + c α ) = a 3 ( β 3 − α 3 ) + b 2 ( β 2 − α 2 ) + c ( β − α ) = β − α 6 [ 2 a ( β 2 + α β + α 2 ) + 3 b ( β + α ) + 6 c ] = β − α 6 [ ( a α 2 + b α + c ) + ( a α 2 + 2 a α β + a β 2 + 2 b α + 2 b β + 4 c ) + ( a β 2 + b β + c ) ] = β − α 6 [ y ( α ) + 4 y ( α + β 2 ) + y ( β ) ] = β − α 6 ( y 0 + 4 y 1 + y 2 ) \LARGE \begin{aligned} \int_{\alpha}^{\beta}ax^2+bx+c&=\frac{a}{3}x^3+\frac{b}{2}x^2+cx\Bigg|_{\alpha}^{\beta} \\ &=\frac{a}{3}\beta^3+\frac{b}{2}\beta^2+c\beta -(\frac{a}{3}\alpha^3+\frac{b}{2}\alpha^2+c\alpha )\\ &=\frac{a}{3}(\beta^3-\alpha^3)+\frac{b}{2}(\beta^2-\alpha^2)+c(\beta-\alpha) \\ &=\frac{\beta-\alpha}{6}\left[{2a}(\beta^2+\alpha\beta+\alpha^2)+{3b}(\beta+\alpha)+6c\right] \\ &=\frac{\beta-\alpha}{6}\left[(a\alpha^2+b\alpha+c)+(a\alpha^2+2a\alpha\beta+a\beta^2+2b\alpha+2b\beta+4c)+(a\beta^2+b\beta+c)\right] \\ &=\frac{\beta-\alpha}{6}\left[y(\alpha)+4y(\frac{\alpha+\beta}{2})+y(\beta)\right] \\ &=\frac{\beta-\alpha}{6}\left(y_0+4y_1+y_2\right) \end{aligned} ∫αβax2+bx+c=3ax3+2bx2+cx αβ=3aβ3+2bβ2+cβ−(3aα3+2bα2+cα)=3a(β3−α3)+2b(β2−α2)+c(β−α)=6β−α[2a(β2+αβ+α2)+3b(β+α)+6c]=6β−α[(aα2+bα+c)+(aα2+2aαβ+aβ2+2bα+2bβ+4c)+(aβ2+bβ+c)]=6β−α y(α)+4y(2α+β)+y(β) =6β−α(y0+4y1+y2)
辛普森要求拆分为偶数项,我们拟合一次抛物线近似会占用两个微元面积,如果我们把区间 ( a , b ) (a,b) (a,b)拆分为n份,那么2份就是:
2 ( b − a ) n = β − α \dfrac{2(b-a)}{n}=\beta-\alpha n2(b−a)=β−α
主要利用定积分的累加性,拆分为n份,自变量从 x 0 ∼ x n x_0\thicksim x_n x0∼xn,每次拟合的函数都不同,只不过我们每次取三个点模拟二次函数
∫ a b ψ ( x ) d x ≈ ∫ x 0 x 2 f 1 ( x ) d x + ∫ x 2 x 4 f 2 ( x ) d x + ⋯ + ∫ x n − 2 x n f n 2 ( x ) d x = b − a 3 n [ ( y 0 + 4 y 1 + y 2 ) + ( y 2 + 4 y 3 + y 4 ) + ⋯ + ( y n − 2 + 4 y n − 1 + y n ) ] \LARGE \begin{aligned} \int_a^b\psi(x)dx &\approx \int_{x_0}^{x_2}f_{1}(x)dx+\int_{x_2}^{x_4}f_{2}(x)dx+\cdots+\int_{x_{n-2}}^{x_n}f_{\frac{n}{2}}(x)dx\\\\ &=\frac{b-a}{3n}\left[(y_0+4y_1+y_2)+(y_2+4y_3+y_4)+\cdots+(y_{n-2}+4y_{n-1}+y_n)\right] \end{aligned} ∫abψ(x)dx≈∫x0x2f1(x)dx+∫x2x4f2(x)dx+⋯+∫xn−2xnf2n(x)dx=3nb−a[(y0+4y1+y2)+(y2+4y3+y4)+⋯+(yn−2+4yn−1+yn)]
总结 : 如果我们把六分之一乘进去
∫ a b ψ ( x ) d x ≈ ∫ x 0 x 2 f 1 ( x ) d x + ∫ x 2 x 4 f 2 ( x ) d x + ⋯ + ∫ x n − 2 x n f n 2 ( x ) d x = 2 ( b − a ) n [ ( y 0 + 4 y 1 + y 2 ) 6 + ( y 2 + 4 y 3 + y 4 ) 6 + ⋯ + ( y n − 2 + 4 y n − 1 + y n ) 6 ] \LARGE \begin{aligned} \int_a^b\psi(x)dx &\approx \int_{x_0}^{x_2}f_{1}(x)dx+\int_{x_2}^{x_4}f_{2}(x)dx+\cdots+\int_{x_{n-2}}^{x_n}f_{\frac{n}{2}}(x)dx\\\\ &=\frac{2(b-a)}{n}\left[\frac{(y_0+4y_1+y_2)}{6}+\frac{(y_2+4y_3+y_4)}{6}+\cdots+\frac{(y_{n-2}+4y_{n-1}+y_n)}{6}\right] \end{aligned} ∫abψ(x)dx≈∫x0x2f1(x)dx+∫x2x4f2(x)dx+⋯+∫xn−2xnf2n(x)dx=n2(b−a) 6(y0+4y1+y2)+6(y2+4y3+y4)+⋯+6(yn−2+4yn−1+yn)