can't calculate integral on hp 41



#2

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


#3

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.


#4

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.


#5

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.

#6

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.

#7

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.


#8

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


#9

Try the articles section of this site.

Or the original source, the PPC ROM manual.


- Pauli

#10

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


#11

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.


#12

Á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


#13

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.

#14

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


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP-41(CL): The easiest way to transfer FOCAL programs from a Linux PC to the HP-41 Geir Isene 13 1,828 12-05-2013, 02:40 AM
Last Post: Hans Brueggemann
  Integral Richard Berler 32 2,406 09-22-2013, 08:59 PM
Last Post: Les Koller
  Calculate with handwriting Mic 24 1,813 01-27-2013, 09:43 AM
Last Post: Eddie W. Shore
  Trying to calculate max energy that a wind turbine can get cyrille de Brébisson 4 553 08-06-2012, 06:03 PM
Last Post: Nigel J Dowrick
  Another tough integral Gerson W. Barbosa 59 2,893 05-20-2012, 05:59 PM
Last Post: Gerson W. Barbosa
  Polynomial Derivative and Integral for the HP 35S Eddie W. Shore 0 245 05-24-2011, 10:29 PM
Last Post: Eddie W. Shore
  Indefinite integral calculation with 49g+/ 50g ferroburak 7 673 11-10-2009, 02:27 PM
Last Post: David Hayden
  Question about how HP Math pacs calculate Bessel Functions! Namir 5 584 11-05-2009, 12:25 AM
Last Post: Ángel Martin
  What do the following have in common, other than they are used to calculate? Geoff Quickfall 15 1,144 05-04-2009, 02:09 PM
Last Post: Geoff Quickfall
  Solving for an Integral: 28S solution Marcus von Cube, Germany 2 359 03-02-2008, 10:49 AM
Last Post: Marcus von Cube, Germany

Forum Jump: