Sunday, May 8, 2011

Complex Number Operations



Introduction

Complex numbers have been a recurring feature on scientific calculators, and for most calculators, the calculations we can readily do on them have been limited - particularly on non-graphing scientific calculators.

If your non graphing calculator has complex number calculations, chances are this is the limit of what the calculator can do:

* Arithmetic (+, -, x, ÷)
* Square, but not square root
* Cube, but not cube root
* Rectangular/Polar conversions
* A separate function for magnitude, angle, real, and imaginary part extraction

The point of this blog is to give you some tricks to extend the calculation of complex numbers:

* Powers and principal root
* Exponential and Natural Logarithm (next week)
* Sine and Cosine (next week)

For any calculators using reverse polish notation (RPN), such the HP 35S, HP 50g, HP 15c, or even apps such as the GO-25 SCI RPN; I will present a "generalized" routine that you can use to perform the calculations. Please adjust as necessary what how your calculator works best.

Sources:

HP 41C Math Pac, Hewlett Packard, 1979



Square of a Complex Number

By simple algebra, we can calculate the square of a complex number as:

(a + bi)^2 = (a^2 - b^2) + 2abi

Remember that i = √-1, so i^2 = -1.

Thankfully, scientific calculators allow this calculation simply by typing in (a + bi)^2.

For calculators using RPN, try this routine: starting with b stored in Register 2 (or letter if you have a HP 35S, 48, 50g...family) and a stored in Register 1

RCL 2
RCL 1
X
2
X (imaginary part)
RCL 1
2
y^x
RCL 2
2
y^x
- (real part)



Power (and Principal Root) of a Complex Number

By De Moive's Theorem, we can calculate the power of any complex number as:

(a + bi)^n = r^n (cos (nθ) + i sin (nθ))

Where: r = a^2 + b^2, θ = arctan (b/a), and n is a real number

Note abs(a + bi) = r and arg(a + bi) = θ (arg is named angle in the TI calculators)

On calculators such as the Casio fx-115ES, TI-36X Pro, and the Sharp EL-W516; unless n = 2 or n = 3, straight input will cause an error message. Use the above formula as the alternate. The nice thing of both the fx-115 and the TI-36X Pro is that we can store complex numbers to variables.

So the key strokes for the fx-115ES would look somewhat like this:
MODE 2
a + bi SHIFT STO A

Then input:
Abs(A)^(n) × (cos(n arg(A))+ i sin(n arg(A)))

For the TI-36X Pro:
a + bi sto→x [x y t z a b c d key]

Then input:
Abs(A)^(n) × (cos(n angle(A))+ i sin(n angle(A)))

For the EL-W516, complex numbers cannot be stored to variables. In addition, there is angle/argument function.
MODE 3

abs(a + bi)^n × (cos(n tan^-1(b ÷ a)) + i sin(n tan^-1(b ÷ a)))

A Sample RPN Routine for (a + bi)^n
Let a be stored in Register 1
Let b be stored in Register 2
Let n be stored in Register 3

RCL 2
RCL 1
→P
RCL 3
y^x
STO 0. (temporary register)
x<>y
RCL 3
×
Enter
SIN
RCL 0
×
x<>y
COS
RCL 0
×

TI-30Xa and HP 12C: Linear Interpolation

TI-30Xa and HP 12C: Linear Interpolation Introduction Given two points (x0, y0) and (x1, y1), and a point, x, we can easily estim...