Post Reply 
Trapezoidal Rule for HP-67
09-02-2017, 07:02 PM
Post: #1
Trapezoidal Rule for HP-67
Hi all.

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. 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?

Thanks
Find all posts by this user
Quote this message in a reply
09-03-2017, 08:27 AM (This post was last modified: 09-03-2017 08:45 AM by Dieter.)
Post: #2
RE: Trapezoidal Rule for HP-67
(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
Find all posts by this user
Quote this message in a reply
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
09-03-2017, 05:32 PM (This post was last modified: 09-03-2017 05:36 PM by Dieter.)
Post: #4
RE: Trapezoidal Rule for HP-67
(09-03-2017 05:18 PM)Matt Agajanian Wrote:  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.

?!? – wait a minute. I think we are talking about a program for the HP67/97 here? Now you mention a HP41 module – ?!? Auch which module do you mean here?

BTW the HP41 Math and Math/Stat ROMs of course do not require any other module, let alone an X-Functions ROM or a 41CX. Why do you think they do?

(09-03-2017 05:18 PM)Matt Agajanian Wrote:  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.

If you really want to do numerical integration with such an, err... "unsophisticated" method, that is. On the 41C you may instead take a look at the Advantage ROM and the Romberg method implemented there.

Dieter
Find all posts by this user
Quote this message in a reply
09-03-2017, 05:44 PM
Post: #5
RE: Trapezoidal Rule for HP-67
(09-03-2017 05:32 PM)Dieter Wrote:  
(09-03-2017 05:18 PM)Matt Agajanian Wrote:  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.

?!? – wait a minute. I think we are talking about a program for the HP67/97 here? Now you mention a HP41 module – ?!? Auch which module do you mean here?

BTW the HP41 Math and Math/Stat ROMs of course do not require any other module, let alone an X-Functions ROM or a 41CX. Why do you think they do?

(09-03-2017 05:18 PM)Matt Agajanian Wrote:  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.

If you really want to do numerical integration with such an, err... "unsophisticated" method, that is. On the 41C you may instead take a look at the Advantage ROM and the Romberg method implemented there.

Dieter


My goof. After I posted this, I realised that it's the Romberg Integration program from 41's Advantage module I was referring to. But, I seem to recall that the Romberg application requires a certain other module to be in the 41 to function properly. Or did I misread something?
Find all posts by this user
Quote this message in a reply
09-03-2017, 05:59 PM (This post was last modified: 09-03-2017 06:16 PM by Dieter.)
Post: #6
RE: Trapezoidal Rule for HP-67
(09-03-2017 05:44 PM)Matt Agajanian Wrote:  My goof. After I posted this, I realised that it's the Romberg Integration program from 41's Advantage module I was referring to.

Now I'm even more confused. What exactly do you mean here?
Are we talking about the Trapezoidal method for discrete data points in the HP67 program mentioned in your first post?
Or is it the integration routine in the HP41 Advantage Pac? Or the Romberg program in the PPC-ROM?
What kind of program are you looking for, and for which calculator?

(09-03-2017 05:44 PM)Matt Agajanian Wrote:  But, I seem to recall that the Romberg application requires a certain other module to be in the 41 to function properly. Or did I misread something?

I think you did. The much more sophisticated integration program in the Advantage ROM does not need any special add-on (BTW, this is not a plain-vanilla Romberg algorithm). A classic Romberg program is part of the PPC-ROM ("IG"). Nothing special required here either. It just requires a certain number of data registers.

BTW, I originally confused the last two programs. Of course you cannot review the Advantage ROM since this is machine code. But you can do so with the PPC-ROM as the source is printed in the ROM's manual.

Dieter
Find all posts by this user
Quote this message in a reply
09-03-2017, 06:04 PM
Post: #7
RE: Trapezoidal Rule for HP-67
(09-03-2017 05:59 PM)Dieter Wrote:  
(09-03-2017 05:44 PM)Matt Agajanian Wrote:  My goof. After I posted this, I realised that it's the Romberg Integration program from 41's Advantage module I was referring to.

Now I'm even more confused. What exactly do you mean here?
Are we talking about the Trapezoidal method for discrete data points in the HP67 program mentioned in your first post?
Or is it the integration routine in the HP41 Advantage Pac? Or the Romberg program in the PPC-ROM?
What kind of program are you looking for, and for which calculator?

(09-03-2017 05:44 PM)Matt Agajanian Wrote:  But, I seem to recall that the Romberg application requires a certain other module to be in the 41 to function properly. Or did I misread something?

I think you did. The much more sophisticated integration program in the Advantage ROM does not need any special add-on (BTW, this is not a plain-vanilla Romberg algorithm). It just requires a certain number of registers. A classic Romberg program is part of the PPC-ROM ("IG"). Nothing special required here either.

Dieter

Thank you for clarifying that. And, honestly Dieter and MoHPC group, thank you for being helpful answering my many questions during the past few days. I appreciate that.
Find all posts by this user
Quote this message in a reply
Post Reply 




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