MathGroup Archive 1996

[Date Index] [Thread Index] [Author Index]

Search the Archive

Simpson's Rule

  • Subject: [mg3334] Simpson's Rule
  • From: gt8301c at (M. Dean Charbonnet, Jr.)
  • Date: 28 Feb 1996 09:37:38 -0600
  • Approved:
  • Distribution: local
  • Newsgroups: wri.mathgroup
  • Organization: Georgia Institute of Technology
  • Sender: daemon at

I have programmed into Mathematica a way for it to evaluate a definite
integral using Simpson's Rule. This works fine for any integral which
adheres to the Fundamental theorem of calculus. When given an integral
which does not work with the fundamental theorem of calculus, how do I get
Mathematica to compute this integral using my formula for simpson's rule?

This is my formula:

simp[f_,{x_,a_,b_,n_Integer}]  := Module[{s=0,ne,k, j},
ne = n + If[IntegerQ[n/2],0,1];k:=2 (b-a)/ne;
Do[s=s+N[(f/.x->(a + j k))] +
N[(f/.x->(a + (j-1) k))] +
N[4 (f/.x->(a + (j-(1/2)) k))],{j,1,ne/2}];

Thank you,


*  M. Dean Charbonnet, Jr. *
* gt8301c at *

  • Prev by Date: Simpson's Rule
  • Next by Date: Voronoi polygons
  • Previous by thread: Simpson's Rule
  • Next by thread: Voronoi polygons