Post Reply 
Trapezoidal Rule for HP-67
09-03-2017, 05:18 PM
Post: #3
RE: Trapezoidal Rule for HP-67
(09-03-2017 08:27 AM)Dieter Wrote:  
(09-02-2017 07:02 PM)Matt Agajanian Wrote:  Although the 67/97 Math Pac I has mag card which calculates an integral with the Trapezoidal Rule, the x,y data points need to be stated.

I assume this is because the Trapezoidal method is a very simple one with quite limited accuracy for analytical functions. On the other hand it works well for purposes where discrete data points are given, e.g. in engineering.

(09-02-2017 07:02 PM)Matt Agajanian Wrote:  Is there a program here in the archives or elsewhere for calculating integrals with the Trapezoidal Rule for the HP-67/97 where the function subroutine can be entered in the program?

Simply write your own:

Code:
LBL A
STO 2
X<>Y
STO 1
X<>Y
RTN
LBL B
INT
2
x<=y?
X<>Y
STO 3
RTN
LBL C
RCL 2
RCL 1
-
RCL 3
STO I
/
STO 4
RCL 1
STO 0
GSB E
2
/
STO 5
DSZ
LBL 1
RCL 4
STO+0
RCL 0
GSB E
STO+5
DSZ
GTO 1
RCL 2
STO 0
GSB E
2
/
STO+5
RCL 4
STO*5
RCL 5
RTN
LBL E
...
RTN

Enter function at LBL E
Here x is in the X-register and can also be recalled from R0 if required.

Enter limits:  a [ENTER] b   [ A ]
Enter number of intervals (≥2):  n  [ B ]
(note: incorrect input (non-integer or less than 2) is automatically corrected)
Calculate integral:  [ C ]

Registers:
R0: x
R1: a
R2: b
R3: n
R4: h = (b–a)/n
R5: function sum, integral

Example:
Integrate f(x) = 1/x from a=1 to b=2 with n=10 intervals

LBL E
1/x
RTN

1 [ENTER] 2  [ A ]
10  [ B ]
[ C ] => 0,6938

Exact solution: ln 2 = 0,693147...

If you add a PAUSE after LBL E you can see how x runs from a to b. ;-)

Dieter

Thank you for this. To be honest, the HP-41 module option seems to imply that 41 x-Functions be present or perhaps the 41CX was needed. Now that I you've posted a version for a standalone 67, I can use this for everything from my own physical 67, 11C or iOS apps from CuVee.

Thanks!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Trapezoidal Rule for HP-67 - Dieter - 09-03-2017, 08:27 AM
RE: Trapezoidal Rule for HP-67 - Matt Agajanian - 09-03-2017 05:18 PM
RE: Trapezoidal Rule for HP-67 - Dieter - 09-03-2017, 05:32 PM
RE: Trapezoidal Rule for HP-67 - Dieter - 09-03-2017, 05:59 PM



User(s) browsing this thread: 1 Guest(s)