Simpson’s 3/8 Rule for Numerical Integrations

by admin in , , on April 29, 2019

This code calculates the Numerical Integration of a given equation on a predefined interval using Simpson’s 3/8 Rule. This codes uses variable step size so it gives accurate results.  This method called the second Simpson’s rule and more accurate than 1/3 rule.

Code Outputs:

  • Chart of Integration History
  • Chart of Residuals
  • Printed values of Final Iteration value, Accuracy and Number of Iterations.

Result is: 0.97609, Accuracy: 9.42e-05, NO Iterations: 19

Input Requirements:

  • The equation you intended to integrate
  • Integration interval [a b].
  • predefined error (default 0.0001).
  • Maximum number of iterations (default 50000).

About Simpson’s  Method:

For Simpson’s voting rule, see Minimax Condorcet. For Simpson’s rules used in ship stability, see Simpson’s rules (ship stability). Simpson’s rule can be derived by approximating the integrand (x) (in blue) by the quadratic interpolant P(x) (in red).


Simpson’s 3/8 Rule:

Simpson’s 3/8 rule is another method for numerical integration proposed by Thomas Simpson. It is based upon a cubic interpolation rather than a quadratic interpolation. Simpson’s 3/8 rule is as follows:

where b − a = 3h. The error of this method is:

where xi is some number between a and b. Thus, the 3/8 rule is about twice as accurate as the standard method, but it uses one more function value. A composite 3/8 rule also exists, similarly as above.

A further generalization of this concept for interpolation with arbitrary-degree polynomials are the Newton–Cotes formulas.

Composite Simpson’s 3/8 Rule:

Dividing the interval [a, b] into n subintervals of length h = (b-a)/n and introducing the nodes xi = a + ih we have

While the remainder for the rule is shown as:

Note, we can only use this if n is a multiple of three. The 3/8th rule is also called Simpson’s second rule.


[1] Atkinson, Kendall E. (1989). An Introduction to Numerical Analysis (2nd ed.). John Wiley & Sons. ISBN 0-471-50023-2.

[2] Burden, Richard L.; Faires, J. Douglas (2000). Numerical Analysis (7th ed.). Brooks/Cole. ISBN 0-534-38216-9.

[3] Pate, McCall (1918). The naval artificer’s manual: (The naval artificer’s handbook revised) text, questions and general information for deck. United States. Bureau of Reconstruction and Repair. p. 198.

[4] Matthews, John H. (2004). ‘Simpson’s 3/8 Rule for Numerical Integration’. Numerical Analysis – Numerical Methods Project. California State University, Fullerton. Archived from the original on 4 December 2008. Retrieved 11 November 2008.

[5] Press, William H.; Flannery, Brian P.; Vetterling, William T.; Teukolsky, Saul A. (1989). Numerical Recipes in Pascal: The Art of Scientific Computing. Cambridge University Press. ISBN 0-521-37516-9.

[6] Süli, Endre; Mayers, David (2003). An Introduction to Numerical Analysis. Cambridge University Press. ISBN 0-521-00794-1.

[7] Kaw, Autar; Kalu, Egwu; Nguyen, Duc (2008). ‘Numerical Methods with Applications’.

[8] Weisstein, Eric W. (2010). ‘Newton-Cotes Formulas’. MathWorld–A Wolframtite Web Resource. MathWorld. Retrieved 2 August 2010.

3 Sales

Share Now!

Release Information

  • Price


  • Released

    April 29, 2019

  • Last Updated

    May 28, 2019

Share Your Valuable Opinions