The Museum of HP Calculators

HP Forum Archive 21

[ Return to Index | Top of Index ]

can't calculate integral on hp 41
Message #1 Posted by Hans Holzach on 15 May 2012, 2:19 p.m.

this is quite embarrassing: while i was able to calculate mr barbosa's integral on my hp 15, 42 and 71, i completely failed when i tried it on the 41 (with math pac). i get an error due to a division by zero. the 41 seems to handle the stack's content differently than the hp 15 when calculating integrals.

i would be very happy about some help!

thank you very much, hans

      
Re: can't calculate integral on hp 41
Message #2 Posted by Luiz C. Vieira (Brazil) on 15 May 2012, 2:31 p.m.,
in response to message #1 by Hans Holzach

Hi.

Would you, please, let us know what is the expression/equation you want to integrate and how did you program it in your HP41, I mean, the program listing for the expression/equation?

(after editing) And also the upper and lower integration limits.

Cheers.

Luiz (Brazil)

Edited: 15 May 2012, 2:34 p.m.

            
Re: can't calculate integral on hp 41
Message #3 Posted by Hans Holzach on 15 May 2012, 3:11 p.m.,
in response to message #2 by Luiz C. Vieira (Brazil)

hi luiz,

please follow the link in my first post to mr barbosa's integral.

what i did on my hp 15c:

lbl a
enter
pi
x
cos
x^2
acos
x<>y
pi
x
sin
3
x
/
2
1/x
+
rtn

then calculated the integral between 0 and 1. works perfectly.

the same program on the 41cx with math pac does not work. it prompts a data error because the hp 41 seems to handle the stack content differently. although the "enter" at the beginning duplicates x to the x and the y register, the x register is empty (=0) after the x<>x and therefore i get the data error.

maybe you should also know that i was always last in math...

regards, hans

Edited: 15 May 2012, 3:12 p.m.

                  
Re: can't calculate integral on hp 41
Message #4 Posted by Luiz C. Vieira (Brazil) on 15 May 2012, 3:36 p.m.,
in response to message #3 by Hans Holzach

Hallo, Hans.

Allow me to add a few remarks.

You are correct, after pressing ENTER you duplicate the X-register contents into Y-register. But as you have the PI entered in the stack right after ENTER - so stack lift is disabled - then you will still have a single copy of the X-register contents into the Y-register. So, when × (multiplication) after PI is performed, the Y-register contents return to its original value.

In fact this is irrelevant for the HP15C's integral computation because the integral function itself fills the stack registers with the same value, teh one your custom function will be evaluated for, before calling it, so you do not need to worry about stack contents. IIRC, the HP41 Math Pac integral program does the same, i.e., the stack is filled with the number to evaluate, that's why the integral program works fine. If you want to evaluate the program for a single value, you simply fill the stack registers with and run it.

The major difference between the HP15C (and the other Voyagers) in relation to the HP41 is that numbers keyed in as program lines do not terminate digit entry. If you need further explanation about this let me know, it is not relevant related to this subject.

Cheers.

Luiz (Brasilien)

Edited: 15 May 2012, 3:38 p.m.

                  
Additonal: can't calculate integral on hp 41
Message #5 Posted by Luiz C. Vieira (Brazil) on 15 May 2012, 5:16 p.m.,
in response to message #3 by Hans Holzach

Hallo, Hans;

I read my follow up right now and I missed one part I'd have to add (I forgot, sorry).

If you add another ENTER after the one you already have in your listing, the program will work fine with one single value to be evaluated in the X-register.

Cheers.

      
Re: can't calculate integral on hp 41
Message #6 Posted by Gerson W. Barbosa on 15 May 2012, 8:41 p.m.,
in response to message #1 by Hans Holzach

Hans,

I think the Math Pack is the worst option in this case, since its numerical integrator is based on the Simpson's Method, which is not the most efficient one, as we you know. The numerical integrator program on the Advantage Pack uses the same method used by the HP-15C, so the program need not be changed. Also, the results should be the same. Anyway, if you don't have the Advantage Pack you can try Les Wright's program:

01 LBL'SS
02 PI
03 *
04 ENTER
05 COS
06 STO* X
07 ACOS
08 SWAP
09 SIN
10 3
11 *
12 /
13 .5
14 +
.END.

XEQ ALPHA INTG ALPHA EEX CHS 10 ENTER CHS 1 + shift A 50 shift B SS R/S --> 0.9892701033

If you choose 1000 subintervals instead of 50 the result will be
0.9952412223
But you won't try this on a real HP-41.

Regards,

Gerson.

            
Re: can't calculate integral on hp 41
Message #7 Posted by Matt Agajanian on 15 May 2012, 10:23 p.m.,
in response to message #6 by Gerson W. Barbosa

Is Les Wright's program an integration method or just the integrand? If he has written an integration program where might I find it?

                  
Re: can't calculate integral on hp 41
Message #8 Posted by Paul Dale on 15 May 2012, 10:45 p.m.,
in response to message #7 by Matt Agajanian

Try the articles section of this site.

Or the original source, the PPC ROM manual.

- Pauli

                  
Re: can't calculate integral on hp 41
Message #9 Posted by Les Wright on 15 May 2012, 11:16 p.m.,
in response to message #7 by Matt Agajanian

That's just my approach to the integrand. I use a port of the PPC ROM routine IG on the 34S as one of my integration options. It handles Gerson's integral well enough. However, in experimenting with EMU41, the original PPC ROM IG routine doesn't like Gerson's integral much at all. In watching the interim results, I get a pretty good 5 or 6 digit result in SCI 9, but in subsequent extrapolations (each of which takes twice as long since twice as many points as the last cycle are sampled) things diverge and the results worsen. It's as though the 10-digit environment just encourages accumulated round-off error that works against convergence. Since IG needs two rounded extrapolations that agree in all desired digits, the routine never terminates.

I haven't dug out the HP15C-LE or 35S or 34C or Advantage Pac to test things out, so I don't know how they fare. I suspect the Advantage Pac will do better, since it is in MCODE and carries more digits internally.

Les

                        
Re: can't calculate integral on hp 41
Message #10 Posted by Ángel Martin on 16 May 2012, 1:51 a.m.,
in response to message #9 by Les Wright

Yes the MCODE version in the Advantage uses 13-digit math routines so it has better accuracy/precision. It's also relatively slow - unless running on the CL or TURBoed emulator, and basically yields the same results posted in the other posts.

There are two other modules available for the 41 dealing with Integration:

- The SOLINTG module, a 4k extract from the Advantage containing just SOLVE and INTEG, plus associates.

- The INTEGRATOR module, an 8k-worth of dedicated collection of programs from JM Baillard, featuring different algorithms/methods, simple, double, triple integrals, and much more. A must if you're interested in the subject.

Best, 'AM

Edited: 16 May 2012, 1:53 a.m.

                              
Re: can't calculate integral on hp 41
Message #11 Posted by Les Wright on 16 May 2012, 2:02 a.m.,
in response to message #10 by Ángel Martin

Ángel, I am awaiting a replacement NoV-64 from Diego (the first one came with a wonky programmer and wouldn't erase), and when I get it I will be sure to check out the ROMs you mention. I believe they are at TOS? Before then, if I get time, I should check them out in EMU41 or V41.

Les

                                    
Re: can't calculate integral on hp 41
Message #12 Posted by Ángel Martin on 16 May 2012, 2:28 a.m.,
in response to message #11 by Les Wright

Perfect plan Les, yes that's where they are... TOS.

Peruse the QRG and manuals, that´ll give you a good idea of their contents.

http://hp41.claughan.com/file/SIROM_Manual.pdf
http://hp41.claughan.com/file/INTEGRATOR_QRG.pdf
http://hp41.claughan.com/file/INTEGRATOR_MANUAL.html

Edited: 16 May 2012, 2:40 a.m.

      
thank you!
Message #13 Posted by Hans Holzach on 16 May 2012, 2:59 p.m.,
in response to message #1 by Hans Holzach

thank you all very much for your replies! that was most helpful and instructive! seems like i should get an advantage pac...

best regards,
hans


[ Return to Index | Top of Index ]

Go back to the main exhibit hall