HP Calculators

I am a big fan of HP calculators. I own a HP32SII, HP42S, HP15C, HP49g, and a HP50g. Below are some programs and the tips for these calculators.

HP42S Software

 

TVM — Time Value Money

Program listed is from here.

Here:

  • N is the number of payments. If there is a payment every month for 7 years, N=7x12.

  • I% is the yearly interrest rate. If an interrest rate is given to be monthly, it must be divided by 12, and so on.

  • PV is the present value of the payment.

  • PMT is how much is payed for every payment.

  • FV is the future value, when every payment is done.

  • B/E is a number that decides, if a payment is at the beginning or the end. BEGIN: B/E=1, END: B/E=0. Normally, this is 0.

TVM — Time Value Money
00 {91-Byte Prgm }
01 LBL "TVM"
02 MVAR "N"
03 MVAR "I%"
04 MVAR "PV"
05 MVAR "PMT"
06 MVAR "FV"
07 MVAR "B/E"
08 RCL "I%"
09 100
10 /
11 LN1+X
12 RCL* "N"
13 E^X-1
14 RCL* "PMT"
15 RCL "I%"
16 100
17 /
18 1/X
19 RCL+ "B/E"
20 *
21 RCL "PV"
22 RCL "I%"
23 100
24 /
25 LN1+X
26 RCL* "N"
27 E^X
28 *
29 +
30 RCL+ "FV"
31 END

HP50g

 

Sequences

EDIT: This program works on a HP 48s without the SEQ as well!

To calculate a sequence, say

\[ \frac{n^2}{4}\qquad n=0\ldots3 \]

one can use the program SEQ(x^2/4, 0, 3, 1) build into the calculator. Well, I didn't know the program was there (doh) so I wrote my own. On the stack is, for example

N
0
3
N^2/4

The program looks like this:

Sequence Calculation
<<
    -> N NSTART NSTOP EXPR
    <<
        NSTART NSTOP
        FOR I
            EXPR N I 2 ->LIST | EVAL
        NEXT
    >>
>>
  1. Input variables are loaded from the stack.

  2. A for loop is run from NSTART to NSTOP.

  3. The loop variable is substituded into the expression and evaluated.

This should serve as an example of how to use a for loop on a HP50g :-)

Assign Subvariable Program a USER Key

Example: A program stored in

HOME/EE/PRL

for calculating parallel resistors, should be assigned to USER->P.

This is done as follows (in RPN mode):

{
    <<
        EE PRL UPDIR
    >>
    44
}
STOKEYS

because the P key is in the 4th row by the 4th column.

Greek Letters and the Angle Sign for Complex Numbers

To access some greek letters, first press

ALPHA  ->  XXX

where -> is “shift right” and XXX is different keys on the calculator. These include

F1, F2, F3, F4, F5, F6
HIST
EVAL
SYMB
SIN
COS
TAN
EEX.

To get the angle sign for complex polar notation, use

ALPHA  ->  6

The main source of this is here (thanks) :)

Convolution on HP50g

I found this very simple convolution program here by rcobo. It really is quite neat :-)

<<  \-> A B
    \<< 'A' 'B' \-> C D
       \<<    'C*D' EVAL
       \>>
    \>>
 \>>

'CONV' STO

To use it, just put two vetcors on the stack as lists and execute CONV.

{1 1 1 1}
{1 2 1 2}
CONV

and you get the resulting list

{1 3 4 6 5 3 2}

HP32SII Software

 
Discriminant
t =
z = a
y = b
x = c

A01 LBL A
A02 x<>y
A03 x^2
A04 ROLLDN
A05 *
A06 4
A07 *
A08 ROLLUP
A09 x<>y
A10 -
A11 RTN
Bin to hex and dec
B01 LBL B
B02 BIN
B03 INPUT B
B04 HEX
B05 VIEW B
B06 DEC
B07 VIEW B
B08 CLx
B09 RTN
Hex to bin and dec
H01 LBL B
H02 HEX
H03 INPUT B
H04 BIN
H05 VIEW B
H06 DEC
H07 VIEW B
H08 CLx
H09 RTN
Dec to bin and hex
D01 LBL B
D02 DEC
D03 INPUT B
D04 BIN
D05 VIEW B
D06 HEX
D07 VIEW B
D08 DEC
D09 CLx
D10 RTN
Parallel resistors
t =
z =
y = R1
x = R2

P01 LBL P
P02 1/x
P03 x<>y
P04 1/x
P05 +
P06 1/x
P07 RTN
Solving quadratic equations (real)
Q01 LBL Q
Q02 STO C
Q03 ROLLDN
Q04 STO B
Q05 ROLLDN
Q06 STO A
Q07 2
Q08 STO* A
Q09 RCL B
Q10 x^2
Q11 2
Q12 RCL* A
Q13 RCL* C
Q14 -
Q15 PSE
Q16 SQRT
Q17 STO D
Q18 RCL- B
Q19 RCL: A
Q20 RCL D
Q21 +/-
Q22 RCL- B
Q23 RCL: A
Q24 RTN
Rotate a vector by an angle
z = y_i-component
y = x_i-component
x = angle

R01 LBL R
R02 ROLLDN
R03 y,x->0,r
R04 x<>y
R05 ROLLUP
R06 +
R07 x<>y
R08 0,r->y,x
R09 RTN
Complex quadratic equation solver
LBL Q
STO C
ROLLDN
STO B
ROLLDN
STO A
ROLLDN

; Calculate D
RCL B
SQ
4
RCL* A
RCL* C
-
STO D
PSE

x < 0 ; COMPLEX
GTO Z
GTO Y ; ELSE REAL
RTN

; Real roots
LBL Y
RCL D
SQRT
STO D  ; D = sqrt(D)
2
RCL* A
STO A  ; A = 2A

RCL B
+/-
ENTER  ; Two times -b
RCL- D
RCL/ A  ; First result
x<>y
RCL+ D
RCL/ A  ; Second result
RTN

; Complex roots (x + yi, x - yi)
LBL Z
RCL D ; -b -
+/-
SQRT
+/- ; imag part done
RCL B
+/- ; real part done

0 ; empty imag
ENTER
2
RCL* A
CMPLX/
RTN