(30b) Numerical Integration
|
08-23-2015, 02:40 AM
(This post was last modified: 06-15-2017 01:34 PM by Gene.)
Post: #1
|
|||
|
|||
(30b) Numerical Integration
This program will evaluate a formula stored in subroutine 99 for the definite integral using the Trapezoidal rule.
EXAMPLE 1. Enter the main program listed below 2. Enter a formula into subroutine 99. A routine to evaluate the formula sin(x)/ln(x) would look like this: Lbl 99 Input Sin Swap Ln / RTN 3. Enter the lower, then the upper limit of integration. To evaluate sin(x)/ln(x) at the limits 1.2 and 10 (lower limit 1st): 1.2 Input 10 Input 4. Run the program- shift key+ Prgm, use the up/down arrow keys to select the proper program, and press = It takes about 15 seconds to calculate simple integrals. Accuracy can be increased as noted below, but calculation time will also increase. MAIN PROGRAM LISTING (comments start with //): Intergrat //enter this using the MSG command STO 1 //store the lower and higher limits of integration Swap STO 2 - //the span (low, high) is divided up by the number of partitions 1 EEX 3 //1000 partitions. Increasing # of partitions will increase accuracy / STO 2 0 STO 5 //zero out storage register 5 RCL 0 Call 99 //evaluate the function at X1 STO 3 //result= XY1 Lbl 50 RCL 0 RCL 2 //h increment + STO 0 //next X1 Call 99 //evaluate function at X2 STO 4 //XY2 RCL 3 //XY1 + //take the average 2 / RCL 2 //calculate the area * STO +5 //add to area RCL 4 //XY2 becomes- STO 3 //XY1 RCL 0 //reached upper limit? RCL 1 ?< GT50 RCL 5 //display definite integral Stop |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)