How to do Simpson's Rule Riemann Sums with Mathematica 3.0?
- To: mathgroup at smc.vnet.net
- Subject: [mg16913] How to do Simpson's Rule Riemann Sums with Mathematica 3.0?
- From: "Vinod Nagubadi" <vinod at nagubadi.com>
- Date: Tue, 6 Apr 1999 01:27:37 -0400
- Organization: EarthLink Network, Inc.
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I figured out how to do Left, Right, and Midpoint Riemann Sums with the equations below. Does anyone know how to modify these to do Trapezoidal and Simpson's Rule Riemann Sums? Thanks a heap! RiemannRight[ f_,a_,b_,n_]:=Module[ {S=0,h=(b-a)/n,x=a} , o[ x=x+h;S=S+h*f[x],{n}] ;N[S]] RiemannLeft[ f_,a_,b_,n_]:=Module[ {S=0,h=(b-a)/n,x=a} , o[ S=S+h*f[x];x=x+h,{n}];N[S]] RiemannMidpt[ f_,a_,b_,n_]:=Module[ {S=0,h=(b-a)/n,x=a} , o[ S=S+h*f[x+h/2];x=x+h,{n}];N[S]] Now all I need are the Trapezoidal and Simpson's Rule. Thanks in advance, Vinod Nagubadi