       Simpson's Rule

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

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}];
N[(k/6)]*s]

Thank you,

Dean

--
****************************
*  M. Dean Charbonnet, Jr. *
* gt8301c at prism.gatech.edu *
****************************

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