舞動數學

數值積分: 梯形法則

數值積分: 梯形法則

梯形法則是一種透過將曲線下方的面積劃分為梯形來近似函數積分的方法。
Area=$\frac{1}{2}(a+h)h$
$f(x)=x^3+2x^2+3x+4$
$\displaystyle \int_a^b f(x)dx \approx \sum_{i=0}^{n-1} \frac{1}{2}\left( f(x_i)+f(x_{i+1}) \right) (x_{i+1}-x_i)$
Actual integral value=297.08
n=6 Sum of the areas of trapezoids=305.00 ERROR=7.92
n=11 Sum of the areas of trapezoids=299.06 ERROR=1.98
n=101 Sum of the areas of trapezoids=297.10 ERROR=0.02
As the number of trapezoids increases, the approximation of the integral becomes more accurate.

製作人:林宇星
學習單:蘇麗敏