Finding an approximation of an integral using Simpson's rule and Simpson's 3/8th rule of a function f(x) = cos(x) on the interval [0, 1.5]:
>> (cos(0) + 4*cos(0.75) + cos(1.5))/6 * 1.5 ans = 0.999373169290747 >> (cos(0) + 3*cos(0.5) + 3*cos(1.0) + cos(1.5))/8 * 1.5 ans = 0.998323463426858
The correct answer is sin(1.5) ≈ 0.997494986604054 .
Copyright ©2005 by Douglas Wilhelm Harder. All rights reserved.