Post Reply 
RPL program for HP Calculator
07-22-2016, 01:35 PM
Post: #1
RPL program for HP Calculator
Dear All,

I’ve been given a program in my HP50g calculator and I’m not familiar with the RPL language. However, I do need to understand
the program I’ve been given (I found a user’s guide on the net but the code I’ve been given looks sometimes different as what II can find in the user’s guide, which makes me lost), hence my request in getting some help from you please on a couple of (easy) lines, mainly referring to loops (FOR) and conditions (IFTE). I’ve extracted the part where I face difficulties and I’m putting my questions in italic. The context is a (symmetric) matrix called “ZE” whose I need to calculate each cell using parameters “PTCH”, “NS” and “RHC”, which are all three known numbers. Function ASINH refers to arc sinus hyperbolic.

FOR i i NS 1. +
From what value up to (NS+1) ”i” is supposed to go to ?
FOR j i 1. == 0.
What does this mean ? I’m lost in the conditions raised for i and j…

\<< PTCH i 1.5 - *
If my above condition is true, then my parameter PTCH is multiplied by (i-1.5), correct ?
\>> IFTE PTCH i NS 1. + ==
If i= (NS+1), then PTCH is to be multiplied by NS, correct ?
\<< NS *
\>>
\<< i .5 - *
Otherwise (above condition is false), PTCH is to be multiplied by (i-0.5), correct ?
\>> IFTE j 1. == 0.
If j is different from 1, correct ?
\<< PTCH j 1.5 - *
Then PTCH is to be multiplied by (j-1.5), correct ?
\>> IFTE PTCH j NS 1. + ==
\<< NS *
If j=NS+1, then PTCH needs to be multiplied by NS, correct ?
\>>
\<< j .5 - *
Otherwise, PTCH is multiplied by (j-1.5), correct ?

For the above, my issue is also to understand how conditions are inserted within each other…

\>> IFTE \-> z1 z2 z3 z4
I’m lost here… How are variables z1 to z4 calculated ?

\<< z3 z4 'ASINH((z2-z)/RHC)-ASINH((z1-z)/RHC)' 'z' \.S RHO * 2. / \pi \->NUM / z2 z1 - / z4 z3 - / DUP 'ZE' { i j } ROT PUT 'ZE' { j i } ROT PUT
\>>
What is the formulae here? In other words :
- How is “z” determined/calculated ?
- How variables z1 to z4 act in this above formulae ? Can somebody write it differently, e.g. in an Excel sheet ?
NEXT
NEXT ZE INV 'YE' STO
Matrix ZE is to be inversed
\>>
Find all posts by this user
Quote this message in a reply
07-24-2016, 12:45 PM
Post: #2
RE: RPL program for HP Calculator
Hi Lexus17,

some comments to your program:

FOR i i NS 1. +
From what value up to (NS+1) ”i” is supposed to go to ?

No, the right syntax for the "FOR" statement is:

a b FOR j (don't use i because it may interfer with the imagenary unit) NEXT
a is the initial value for the index variable (here) j
b is the end value for the index variable (here) j

Your code fragment means value i on stack value NS on stack and NS is added to 1.
You have to look before the FOR what are limits of the index.


FOR j i 1. == 0.
What does this mean ? I’m lost in the conditions raised for i and j…

Your code fragment means: the index is j and the value of i is tested wether it is 1. or not. The "0." is set on stack (there is no connection to the testing before).

Show us the whole code and tell us for what this program is used, so we can help you, maybe.
Find all posts by this user
Quote this message in a reply
08-04-2016, 09:10 PM
Post: #3
RE: RPL program for HP Calculator
Hi Lexus17,

HERE you have the origin of your program.
It is a little bit unusual coded but it seems to be correct at the first glance.

The most interesting thing for me is the construction

Condition << code1 >> << code2 >> IFTE

f. e.: PTCH i NS 1. + == << NS * >> << i .5 - * >> IFTE

If the condition i = NS + 1 then the value PTCH multiplied with the value of NS in the other case PTCH is multiplied with (i - 0.5).

But for what that program is used...I don't know!

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




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