The Museum of HP Calculators


Complex Operations for the HP-67

This program is Copyright © 1976 by Hewlett-Packard and is used here by permission. This program was originally published in the HP-67 Math Pac 1.

This program is supplied without representation or warranty of any kind. Hewlett-Packard Company and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.

Card Labels
Complex Operations
Shift →|z|  →1/z n→zn n→z1/n →ez
Label a↑b + - × ÷
Key A B C D E

Overview

This program allows for chained calculations involving complex numbers. The four operations of complex arithmetic ( +, - , x, ÷ ) are provided, as well as several of the most used functions of a complex variable z (|z|, 1/z, zn, z1/n and ez). Functions and operations may be mixed in the course of a calculation to allow evaluation of expressions like z3/(z1 + z2), e^z1z2, |z1 + z2| + |z2 ÷ z3|, etc., where z1, z2, z3 are complex numbers of the form a + ib.

Keying in a complex number

A complex number is input to the program by keying in its real part, pressing ENTER↑, keying in its imaginary part, and pressing A. For example, the complex number z1 = 2 + 3i is input as 2 ENTER↑ 3 A. This number is then stored by the program. There is room in the program to remember up to two complex numbers at a time. A second complex number z2 = 5 - i could be input as 5 ENTER↑ 1 CHS A. The program would now contain both the first and the second complex number.

Functions

The complex functions in this program act on just one number. Thus to perform a function, you need simply to input a complex number z and then perform the appropriate function. For example, to find the reciprocal of (2 + 3i), press 2 ENTER↑ 3 A f B. The result is calculated as a + ib = 0.15 - 0.23i. This result is now stored in place of the original number, and further calculations will operate on this result. All complex functions operate in this same manner, with one exception: since the function |z| returns a real number, its result is not stored.

Arithmetic Operations

An arithmetic operation needs two numbers to operate on. Both numbers must be input before the operation can be performed. Suppose that z1 = 2 + 3i, z2 = 5 - i, and we wish to find z1 - z2. This can be calculated by the keystrokes 2 ENTER↑ 3 A 5 ENTER↑ 1 CHS A C. The result z3 = a + ib is found to be -3 + 4i. This result is now stored by the program in place of the second complex number z2. A further calculation z3 x z4 could be performed by inputting z4 and pressing D for multiplication. This type of chaining can be continued indefinitely, and functions can be interspersed with arithmetic operations.

Equations

Let

zk = ak + ibk = rke(iθk) , k = 1 2
z = a + ib = re^iθ

Let the result in each case be u + iv.

z1 + z2 = (al + a2) + i(b1 + b2)
z1 - z2 = (al - a2) + i(b1 - b2)
z1z2 = r1r2ei(θ1 + θ2)
z1/z2 = (r1/r2)ei(θ1 - θ2)
|z| = √(a2+b2)
1/z =a/r2 - ib/r2
zn = rne(inθ)
z1/n = r1/ne(i(θ/n + 360k/n)) , k=0,1,....n-1

(All n roots will be output and temporarily stored, k = 0, 1, ... n-1; at the end of the calculation the final root will be stored.)

ez = ea(cos b + i sin b),  where b is in radians.

Remarks

The logic system for this program may be thought of as a kind of Reverse Polish Notation (RPN) with a stack whose capacity is two complex numbers. Let the bottom register of the complex stack be XC and the top register TC. These are analogous to the X- and T-registers in the calculator's own four-register stack.* A complex number z1 is input to the XC-register by the keystrokes a1 ENTER↑ b1 A. Upon input of a second complex number z2 (as a2 ENTER↑ b2 A) z1 is moved to TC and z2 is placed in XC. The previous contents of TC are lost.

*Each register of the complex stack must actually hold two real numbers: the real and the imaginary part of its complex contents. Thus it takes two of the calculator's registers to represent one register in the complex stack. We will speak of the complex stack registers as though they were each just one register.

Functions operate on the XC-register, and the result (except for |z|) is left in XC; TC is unchanged. Arithmetic operations involve both the XC- and TC- registers; the result of the operation is left in XC and TC is unchanged.

Instructions

Step Instructions Input Data/Units Keys Output Data/Units
1 Load side 1 and side 2.      
2 Key in first complex number (a1 + i b1). a1 ENTER↑  
    b1 A  
3 For a function go to step 7; for arithmetic, go to step 4. A complex result is u + iv.      
  ARITHMETIC      
4 Key in second complex number (a2 + i b2). a2 ENTER↑  
    b2 A  
5 Select one of four operations:      
      Add (+)   B u
        v
      Subtract (-)   C u
        v
      Multiply (×)   D u
        v
      Divide (÷)   E u
        v
6 The result of the operation has been stored; go to step 7 for a function or to step 4 for further arithmetic.      
  FUNCTIONS      
7 Select one of five functions:      
     Magnitude (|z|)   f A |z|
     Reciprocal (1/z)   f B u
        v
     Raise z to an integer power (zn) n f C u
        v
     Find the nth root of z (z1/n)
   Note: n roots (u+iv) will be found.
n f D u
        v
    Raise e to the power z (ez)   f E u
        v
8 The result, if complex, has been stored; go to step 4 for arithmetic or to step 7 for another function.      

Example 1

Evaluate the expression

          z1
       ---------
        z2 + z3

where z1 = 23 + 13i, z2 = -2 + i, z3 = 4 - 3i. (Suggestion: since the program can remember only two numbers at a time, perform the calculation as

        z1 x [l/(z2 + z3)].
Keystrokes             Outputs
2 CHS ENTER↑ 1 A 
4 ENTER↑ 3
CHS A B                 2.00 *** real(z2 + z3)
                       -2.00 *** imag(z2 + z3)

f B                     0.25 *** 1/(z2 + z3)
                        0.25 ***

23 ENTER↑ 13 A D        2.50 *** z1/(z2 + z3)
                        9.00 ***

Example 2

Find the 3 cube roots of 8.

Keystrokes             Outputs
8 ENTER↑ 0 A 3 f D      2.00 ***
                        0.00 ***

                       -1.00 ***
                        1.73 ***

                       -1.00 ***
                       -1.73 ***

Example 3

Evaluate e(z-2), where z = (1 + i)

Keystrokes             Outputs
1 ENTER↑ 1 A 2 f C      0.00 *** (z2)
                        2.00 ***

f B                     0.00 *** (z-2)
                       -0.50 ***

f E                     0.88 *** e(z-2)
                       -0.48 ***

The Program

LINE  KEYS
001  *LBL A     Input A, B
002   RCL D
003   STO B     Last b→RB(b1)
004   R↓
005   STO D     Present b→RD(b2)
006   R↓
007   RCL E     Last a→RC(a1)
008   STO C
009   R↓        Present a→RE(a2)
010   STO E
011   RTN
012  *LBL B     Add (+)
013   RCL C
014   RCL E
015   +
016   STO E     a2←a1+a2
017   PRTX
018   RCL B
019   RCL D
020   +
021   STO D     b2←b1+b2
022   PRTX
023   PRT SPC
024   RTN
025  *LBL C     sub (-)
026   RCL C
027   RCL E
028   -
029   STO E     a2←a1-a2
030   PRTX
031   RCL B
032   RCL D
033   -
034   STO D     b2←b1-b2
035   PRTX
036   PRT SPC
037   RTN
038  *LBL D
039   RCL B     Multiply (x)
040   RCL C
041   →P
042   RCL D     r1, θ1
043   RCL E
044   →P
045  *LBL 9     r2, θ2, r1, θ1
046   X⇔Y
047   R↑
048   +
049   X⇔Y
050   R↑
051   ×
052  *LBL 8
053   →R        r1r2 (θ1 + θ2)
054   STO E     Output routine.
055   PRTX
056   X⇔Y
057   STO D
058   PRTX
059   PRT SPC
060   RTN
061  *LBL E     Divide (÷)
062   RCL B
063   RCL C     r1 θ1
064   →P
065   RCL D
066   RCL E
067   →P        r2 θ2 r2 θ1
068   X⇔Y
069   CHS
070   X⇔Y       1/r2 -θ2 r1 θ1
071   1/X
072   GTO 9
073  *LBL a     |a|
074   RCL D
075   RCL E
076   →P        r = √(a2+b2)
077   PRTX
078   PRT SPC
079   RTN
080  *LBL b     1/z
081   RCL D
082   RCL E
083   →P        r θ
084   X⇔Y
085   CHS
086   X⇔Y
087   1/X       1/r -θ
088   GTO 8
089  *LBL c     zn
090   STO I     n→I
091   RCL D
092   RCL E
093   →P        r θ
094   RCL I
095   YX
096   X⇔Y
097   RCL I
098   ×
099   X⇔Y
100   GTO 8
101  *LBL d     rn nθ
102   STO I     z1/n
103   3
104   6         n→I
105   0
106   X⇔Y
107   ÷
108   STO A
109   RCL D     360/n→RA
110   RCL E
111   →P        r θ
112   RCL I
113   1/X
114   YX
115   X⇔Y
116   RCL I
117   ÷
118   X⇔Y       r1/n θ/n
119  *LBL 7
120   GSB 8     Convert→R  and print
121   DSZ I
122   GTO 0     Loop n times.
123   RTN
124  *LBL 0
125   X⇔Y
126   →P        Back→P(r1/n, θ/n)
127   X⇔Y
128   RCL A
129   +         θ/n + (360/n)k
130   X⇔Y
131   GTO 7
132  *LBL e     ez
133   RAD
134   RCL D
135   RCL E
136   ex        ea b
137   →R
138   PRTX
139   STO E     ea cos b
140   X⇔Y
141   PRTX
142   PRT SPC
143   STO D
144   DEG       ea sin b
145   RTN

Register Use

A   360/n
B   b1
C   a1
D   b2
E   a2
I   n

Go back to the software library
Go back to the main exhibit hall