# 梯形公式

（重定向自梯形法

## 公式由来

${\displaystyle \exists \xi \in [a,b]\int \limits _{a}^{b}f(x)dx=(b-a)f(\xi )}$

${\displaystyle \int \limits _{a}^{b}f(x)dx\approx {\frac {b-a}{2}}[f(a)+f(b)]}$

${\displaystyle \int \limits _{a}^{b}f(x)dx\approx (b-a)f({\frac {a+b}{2}})}$

## 复合求积公式

### 每一區間相同

${\displaystyle \int _{a}^{b}f(x)\,dx\approx {\frac {b-a}{N}}\left[{f(a)+f(b) \over 2}+\sum _{k=1}^{N-1}f\left(a+k{\frac {b-a}{N}}\right)\right].}$

${\displaystyle \int _{a}^{b}f(x)\,dx\approx {\frac {b-a}{2N}}\left(f(x_{0})+2f(x_{1})+2f(x_{2})+\cdots +2f(x_{N-1})+f(x_{N})\right)}$

${\displaystyle x_{k}=a+k{\frac {b-a}{N}},{\text{ for }}k=0,1,\dots ,N}$

${\displaystyle R_{n}(f)=-{\frac {b-a}{12}}h^{2}f''(\eta ),\eta \in (a,b)}$

### 每一區間並不相同

${\displaystyle \int _{a}^{b}f(x)\,dx\approx {\frac {1}{2}}\sum _{i=2}^{N}(x_{i}-x_{i-1})(y_{i}+y_{i-1})}$,

${\displaystyle y_{i}=f(x_{i})}$.

## 誤差分析

${\displaystyle {\text{error}}=\int _{a}^{b}f(x)\,dx-{\frac {b-a}{N}}\left[{f(a)+f(b) \over 2}+\sum _{k=1}^{N-1}f\left(a+k{\frac {b-a}{N}}\right)\right]}$

${\displaystyle {\text{error}}=-{\frac {(b-a)^{3}}{12N^{2}}}f''(\xi )}$

${\displaystyle {\text{error}}=-{\frac {(b-a)^{3}}{24}}f''(\xi )}$

N → ∞的情況下，趨向性的估計誤差是：

${\displaystyle {\text{error}}=-{\frac {(b-a)^{2}}{12N^{2}}}{\big [}f'(b)-f'(a){\big ]}+O(N^{-3}).}$

## 参考文献

• 《数值分析》，清华大学出版社，李庆扬等编，书号ISBN 978-7-302-18565-9