Post Reply 
[WP-34S] My first integral on this calculator
05-18-2014, 08:25 PM
Post: #1
[WP-34S] My first integral on this calculator
Hi all,
I managed to run my first integral on my new WP-34S!

I must say that, despite using HP RPN calculators since the 70's, I quit using calculators for many years, and only recently started to look again to these devices, by acquiring the 49+, 48GII, 50G and Prime.
So I have missed the HP-15C and 42S series and I was not aware on how to use integrals in these machines.

As the WP-34S is loosely based in the HP-15C and 42S machines, I had to spend some time digging it until I could use the WP-34S as I intended.
I was expecting the WP-34S to be more closer to the 42S than to the 15C, but it seems that this is not the case.

So I took this example where a simple integral is used to compute the "angle of twist" problem from page 125 of the HP-42S Programming Examples guide, and have adapted that HP-42S program code to run in the WP-34S but using the HP-15C style (so, no local variables at all).

I know this is basic stuff for HP-15C / 42S experts, but I believe that probably more people will have the same questions as I had when I tried to take a simple integral in this excellent RPN WP-34S (for me it so much easier to do it using "pretty print"/"equation editors"/"templates" as I do on my HP-Prime, 50G, and even on a Casio FX-991DE Plus...!).

To invoke the integral:
1. Create the program and name it 'TOR'
2. Load the lower and upper limits Limits (in this example, Lower (Y):0 Upper (X):2
3. Invoke it from the entry mode: h + 2 ENTER TOR

WP-34S result: 0.02805957296 (HP-42S result as stated in the guide: 0.0281)
Time to complete: about 5 seconds

My WP-34S program code for the "Angle of twist" problem:
LBL'TOR'
1
3
*
8
+
*
1
5
+
*
9
+
*
6
+
7
.
9
5
2
1
EEX
8
+/-
/
8
3
EEX
9
/
RTN
END

Jose Mesquita
RadioMuseum.org member

Find all posts by this user
Quote this message in a reply
05-19-2014, 07:40 AM
Post: #2
RE: [WP-34S] My first integral on this calculator
Nice program, just a few comments:
  1. integrate is invoked with [g] [2] not with [h] [2],
  2. you can enter integers up to 255 as constants, this will save a few steps,
  3. also to follow the 42s program example you can store the “J” and “G” values in registers (for ex. A & B) instead of hardcoding them in the program, this should save some execution time:

Code:
001 LBL"TOR"
002 #013
003 x
004 8
005 +
006 x
007 #015
008 +
009 x
010 9 
011 +
012 x 
013 6
014 +
015 RCL/ A
016 RCL/ B
017 RTN

Launch :
  • 7.9521 EEX 8 +/- STO A
  • 83 EEX 9 STO B
  • 0 ENTER 2
  • g 2 “TOR”
Find all posts by this user
Quote this message in a reply
05-19-2014, 08:20 AM
Post: #3
RE: [WP-34S] My first integral on this calculator
Thanks for the corrections and optimizations, Didier!

My intention was to show my (hard) path to discover how to use the integrals in the WP-34S, as the existing documentation assumes people knows all this stuff already and so it doesn't include concrete examples of usage for integration, derivatives, matrices, etc.

Of course my stupid basic program is not the way to go... setting the variables hardcoded into the program... I did it that way just to test the integration mechanism.
When I have time, I will create a new one that will create the UI (user interface) similar to what the HP-42S is doing, asking to supply the values for the different variables in the formula.
Somehow I was expecting the WP-34S to be doing integration using similar UI as seen in the HP-42S, but no luck.

Jose Mesquita
RadioMuseum.org member

Find all posts by this user
Quote this message in a reply
05-19-2014, 08:39 AM
Post: #4
RE: [WP-34S] My first integral on this calculator
(05-19-2014 08:20 AM)jebem Wrote:  Somehow I was expecting the WP-34S to be doing integration using similar UI as seen in the HP-42S, but no luck.

That exactly is the point. Please read p. 128 (of 244) of the manual - it's clearly stated there for ∫:

"Integrates the function given in the routine specified. Lower and upper integration limits must be supplied in Y and X, respectively. ∫ returns the (approximated) integral in X and an upper limit of its uncertainty in Y. Please refer to the HP-34C Owner’s Handbook and Programming Guide (Section 9 and Appendix B) or the HP-15C Owner’s Handbook (Section 14 and Appendix E) for more information about automatic
integration and some caveats."


No reference to HP-42S.

d:-)
Find all posts by this user
Quote this message in a reply
05-19-2014, 08:39 AM
Post: #5
RE: [WP-34S] My first integral on this calculator
(05-19-2014 08:20 AM)jebem Wrote:  Somehow I was expecting the WP-34S to be doing integration using similar UI as seen in the HP-42S, but no luck.

The screen isn't up to this Sad


- Pauli
Find all posts by this user
Quote this message in a reply
05-19-2014, 08:41 AM
Post: #6
RE: [WP-34S] My first integral on this calculator
(05-19-2014 08:39 AM)Paul Dale Wrote:  
(05-19-2014 08:20 AM)jebem Wrote:  Somehow I was expecting the WP-34S to be doing integration using similar UI as seen in the HP-42S, but no luck.

The screen isn't up to this Sad

Cheers, Pauli! Did we tell them already we love this screen?

d;-)
Find all posts by this user
Quote this message in a reply
05-19-2014, 08:42 AM
Post: #7
RE: [WP-34S] My first integral on this calculator
(05-19-2014 07:40 AM)Didier Lachieze Wrote:  you can enter integers up to 255 as constants, this will save a few steps,

I'm pretty sure this is faster than using digits. Even for single digit numbers. Once you enter a digit, all the command line processing has to be performed including the text to number conversions. The constant command has a much easier time of it and I think it converts using short integer operations that are very quick.


Quote:also to follow the 42s program example you can store the “J” and “G” values in registers (for ex. A & B) instead of hardcoding them in the program, this should save some execution time:

Couldn't you store the product of these two in a register and divide by that at the end for a little extra performance?


- Pauli
Find all posts by this user
Quote this message in a reply
05-19-2014, 10:23 AM
Post: #8
RE: [WP-34S] My first integral on this calculator
To post #7:

Do constants such as # 002 require less memory than 2?
Find all posts by this user
Quote this message in a reply
05-19-2014, 10:26 AM
Post: #9
RE: [WP-34S] My first integral on this calculator
(05-19-2014 10:23 AM)Gerald H Wrote:  Do constants such as # 002 require less memory than 2?

One step each, so no. # 020 is shorter than 2 0 however.


- Pauli
Find all posts by this user
Quote this message in a reply
05-19-2014, 02:43 PM
Post: #10
RE: [WP-34S] My first integral on this calculator
(05-19-2014 08:41 AM)walter b Wrote:  
(05-19-2014 08:39 AM)Paul Dale Wrote:  The screen isn't up to this Sad

Cheers, Pauli! Did we tell them already we love this screen?

d;-)

Hi Pauli and Walter,

I'm not let down by the WP-34S project, it was just my lack of proper detailed reading and my excessive hope! You know, I saw the reference to the "HP-42S" in one of the guides and have jumped to conclusions...

To the contrary, I'm happy with the excellent WP-34S performance and huge number of advanced features, specially considering the constrains imposed by the HP-30B hardware (memory and display).
Thank you so much again for sharing your project!

My only real issue here is related to the poor keyboard quality of my HP-30B machine, bought used in TAS in Europe for 25 Euros (inc. s&h).
One full row refuses to work if I put the screws in the back cover (that was the initial problem, before I have opened it; this is a pcb track broken somewhere...). As if it was not enough, I found out that the up most left key ("A") needs to be pressed beyond reasonable to register itself.
I guess I will have to scrap it one of these days and start all over, this time with a new in the box HP-30B calculator while they can still be found for sell.
Well, at least I do not need to order another keyboard overlay from Eric because initially I ordered two sets just in case...

Jose Mesquita
RadioMuseum.org member

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




User(s) browsing this thread: