Simpson's Rule
- To: mathgroup at smc.vnet.net
- Subject: [mg3334] Simpson's Rule
- From: gt8301c at acmey.gatech.edu (M. Dean Charbonnet, Jr.)
- Date: Wed, 28 Feb 1996 03:35:22 -0500
- Organization: Georgia Institute of Technology
- Sender: owner-wri-mathgroup at wolfram.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 * **************************** ==== [MESSAGE SEPARATOR] ====