Trapezoidal rule for three intervals
\[\frac{h}{2}[(y_0+y_2)+2y_1]\]
Example \[\int_{1}^{3}\frac{1}{x} dx \] . Evaluate using trapezoidal rule
x |
1 |
2 |
3 |
y=f(x) |
1 |
0.5 |
0.33 |
\[y_n\] |
\[y_0\] |
\[y_1\] |
\[y_2\] |
I= 0.5(1+0.33+2*0.5)=1.165
Trapezoidal rule using 5 intervals
\[\frac{h}{2}[(y_0+y_5)+2(y_1+y_2+y_3+y_4)\]
Example \[\int_{1}^{3}lnx dx \] . Evaluate using trapezoidal rule with 5 intervals.
x |
2.5 |
2.8 |
3.1 |
3.4 |
3.7 |
4 |
y=f(x) |
0.1963 |
1.0296 |
1.1314 |
1.2237 |
1.3083` |
1.3863 |
\[y_n\] |
\[y_0\] |
\[y_1\] |
\[y_2\] |
\[y_3\] |
\[y_4\] |
\[y_5\] |
I=0.15[(0.9163+1.3863)+2(1.0296+1.1314+1.2237+1.3083)]=1.7533
Note \[y_0\]=a \[y_1\]=b \[y_2\]=c \[y_3\]=d \[y_4\]=g \[y_5\]=f in the equation