Loading [MathJax]/extensions/TeX/boldsymbol.js

 

 

 

Algorithm for Simpson's rule

The method can easily be implemented numerically through the following simple algorithm

  • Choose the number of mesh points and fix the step.
  • calculate f(a) and f(b)
  • Perform a loop over n=1 to n-1 ( f(a) and f(b) are known) and sum up the terms 4f(a+h) +2f(a+2h)+4f(a+3h)+\dots +4f(b-h) . Each step in the loop corresponds to a given value a+nh . Odd values of n give 4 as factor while even values yield 2 as factor.
  • Multiply the final result by \frac{h}{3} .