Algorithm 84: Simpson's integration
暂无分享,去创建一个
rea l p r o c e d u r e SIM (n, a, b, y); va lue n, a, b; rea l a, b; i n t e g e r n; a r r a y y; c o m m e n t This is a method for obtaining the approximate vMue of the definite integral of a continuous function when the integral cannot be evaluated in elementary functions. Given y = f(x) and the f~ y dx to be evaluated. Plot the curve f(x), and divide [a, bI evenly into n equal parts , erecting the ordinates Y0, Y,, ' ' " , y n . Then the approximate value of the definite integral by Simpson's rule s ta tes tha t : b b a f(x) dx = 3I---7-(y0 + 4y~ + 2y2 + ' . + 4y,_~ + y~);