Post Reply 
Gaussian integration for the HP-11C/15C
11-30-2016, 03:18 PM
Post: #1
Gaussian integration for the HP-11C/15C
Hello,

Does anyone know how to port this program originally coded for the 11C by Valentin Albillo to the 15C?

Code:

    01 LBL A     17 LBL 0     32 RCL 1     
    02 STO 1     18 RCL 1     33 GSB E    
    03  -        19 RCL 3     34  8       
    04 RCL I     20  +        35  *
    05  /        21 GSB E     36 STO-2
    06 STO 0     22  5        37 RCL 0
    07  2        23  *        38 STO+1
    08  /        24 STO-2     39 DSE
    09 STO+1     25 RCL 1     40 GTO 0 
    10  .6       26 RCL 3     41 RCL 2 
    12 SQRT      27  -        42  *
    13  *        28 GSB E     43 18
    14 STO 3     29  5        45  /
    15 CLX       30  *        46 RTN
    16 STO 2     31 STO-2     47 LBL E

I can not figure out why it won't work on the 15c. I thought it was because DSE (step 39) requires a pointer (I) on the 15C. Well, it is not.

Thank you.
Find all posts by this user
Quote this message in a reply
11-30-2016, 07:31 PM
Post: #2
RE: Gaussian integration for the HP-11C/15C
(11-30-2016 03:18 PM)Marcio Wrote:  Does anyone know how to port this program ... to the 15C ... I can not figure out why it won't work on the 15c.
Did you retrieve this listing from this source ...
Archive 16
Numerical integration on the 11C
Message #4 Posted by Valentin Albillo on 17 June 2006, 11:57 p.m.,
in response to message #1 by Gerson W. Barbosa

...
as this POST includes the operating instructions?
There is a reference to the usage of the I Register
Code:
To use it to compute the integral of an arbitrary f(x) between x=a and x=b, using N-subinterval Gaussian integration, just do the following:
1.    Enter your f(x) to be integrated into program memory, starting at
2.             47 LBL E
ending it either with a RTN instruction or with the end of program memory.
3.    Store N, the number of subintervals you want to use, in Register I. N must be an integer number equal or greater than 1. The larger N, the more precise the result will be and the longer it will take to run.
4.             N,  STO I
5.    Enter the limits of integration, a and b, into the stack and call the integration routine:
6.             a, ENTER, b, GSB A
The computation will proceed and the result will be displayed upon termination. Let's see a couple of examples:
Hope this helps.

Best!
SlideRule
Find all posts by this user
Quote this message in a reply
11-30-2016, 07:47 PM (This post was last modified: 11-30-2016 07:48 PM by Gerson W. Barbosa.)
Post: #3
RE: Gaussian integration for the HP-11C/15C
(11-30-2016 03:18 PM)Marcio Wrote:  I can not figure out why it won't work on the 15c. I thought it was because DSE (step 39) requires a pointer (I) on the 15C. Well, it is not.

No problem here. Probably you forgot to store the number of intervals in register I (see SlideRule's post above). Alternatively, you can do that programmatically:

    01 LBL A     16 CLX       31 RCL 1     
    02 STO I     17 STO 2     32 GSB E    
    03 Rv        18 LBL 0     33  8       
    04 STO 1     19 RCL 1     34  *
    05  -        20 RCL+3     35 STO-2
    06 RCL/I     21 GSB E     36 RCL 0
    07 STO 0     22  5        37 STO+1
    08  2        23  *        38 DSE I
    09  /        24 STO-2     39 GTO 0 
    10 STO+1     25 RCL 1     40 RCL*2 
    11  .        26 RCL-3     41  1
    12  6        27 GSB E     42  8
    13 SQRT      28  5        43  /
    14  *        29  *        44 RTN
    15 STO 3     30 STO-2     45 LBL E


Usage:

a ENTER b ENTER n ENTER GSB A

Example:

    47 LBL E         
    48 LN   
    49 RTN   
 

1 ENTER 2 ENTER 3 GSB A --> 0.386294376

Gerson.
Find all posts by this user
Quote this message in a reply
12-01-2016, 12:18 PM
Post: #4
RE: Gaussian integration for the HP-11C/15C
Good morning gentlemen,

I figured out what the problem is, but haven't yet identified what is causing it. The code will run fine the first time but will fail afterwards if I don't clear the registers.

Gerson, can you get the same answer twice?

I should let you know that I am using the app, not the physical 15C. The app is much faster but won't always let you do basic things like integration (which I use regularly) and root finding without crashing and erasing memory. Come on, HP!
Find all posts by this user
Quote this message in a reply
12-01-2016, 03:48 PM
Post: #5
RE: Gaussian integration for the HP-11C/15C
(12-01-2016 12:18 PM)Marcio Wrote:  Gerson, can you get the same answer twice?

Olá Márcio,

Yes, both on the HP-15 LE and on the iPhone app.

Here is another test on the iPhone app using Valentin's program with recall arithmetic above:

    45 LBL E         
    46 e^x  
    47 ENTER
    48 x^2
    49 CHS
    50  1
    51  +
    52 SQRT
    53  /
    54 RTN

  
       2 g LN CHS 0 ENTER 200000 GSB A -> 1.046872016 ( 74 s )

f FIX 4 2 g LN CHS 0 ∫y,x E GSB A FIX 4 -> 1.047120028 ( 75 s )

The exact 10-digit result of this integral is 1.047197551 (π/3).

Regards,

Gerson.
Find all posts by this user
Quote this message in a reply
Post Reply 




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