num_int - B Using Numerical Integration to Approximate A...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Using Numerical Integration to Approximate Z B A f ( x ) dx The following programs for the TI-83 and TI-85/86 compute three diFerent approximations of the integral. Program Input: * A, the lower limit of integration B, the upper limit of integration N, the number of segments of equal length into which [ A,B ] is divided (except for Simpson’s Rule; see footnote **) f ( x ) , the function being integrated. Program Output: a list of three numbers: MP , TR and SI , where MP = the approximation using the Midpoint Rule; TR = the approximation using the Trapezoidal Rule; SI = the approximation using Simpson’s Rule. The Program Itself: for the TI-83 PROGRAM: NUMINT :Prompt A,B,N :(B-A)/N H :0 S :0 T :For(I,1,N,1) :S + Y 1 (A+I*H) S :T + Y 1 (A+(I-.5)*H) T :End :H*T U :H*(S+.5*(Y 1 (A)-Y 1 (B))) V :Disp U :Disp V :Disp (2*U+V)/3 :Stop for the TI-85/86 PROGRAM: NUMINT :InpSt ‘‘enter function’’,STRING :St>Eq (STRING,Y 1 ) :prompt A,B,N :(B-A)/N H :0 S :0 T :For(I,1,N,1) :evalF(Y 1 ,x,A+I*H) F :S + F S :evalF(Y 1 ,x,A+(I-.5)*H) G :T + G T :End :H*T U :evalF(Y 1 ,x,A) C :evalF(Y 1 ,x,B) D :H*(S+.5*(C-D)) V :(2*U+V)/3 W :Disp U :Disp V :Disp W :Stop Comments: 1. After entering the program, it is essential to test it for typographical errors by calculating
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/24/2011 for the course PHYSICS 123 taught by Professor Madey during the Fall '08 term at Rutgers.

Page1 / 2

num_int - B Using Numerical Integration to Approximate A...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online