Wednesday, December 5, 2012

Numeric CAS - Part 12: Roots of a Complex Numbers

Complex Roots

Goal: Find all the complex roots of the complex number z.

This the solution to the equation:

x^n - z = 0

Where z = a + bi

Using de Moivre's Theorem:

Let r = abs(z) = √(x^2 + y^2) and
θ = arg(z) = arctan(y/x) where -π/2 ≤ θ ≤ π/2,

Then z^(1/n) = r^(1/n) * cos((2 k π + θ)/n) + i * r^(1/n) * sin((2 k π + θ)/n)
Where k = 0, 1, ... , n-1

Example:
Find the three roots of 1. ( ∛1 ) (n=3)

Roots: ≈ 1, -0.5 + 0.8660i, -0.5 - 0.8660i

Find the four roots of 2 + 7i. (n=4)

Roots: ≈ 1.5576 + 0.5216i, -0.5216 + 1.5576i, -1.5576 - 0.5216i, 0.5216 - 1.5576i


Casio Prizm:

CROOTS
Complex Roots
11/23/2012

(Prizm, fx-9860g, fx-9750gii - 92 bytes)
Rad
a+bi
"a+bi"? → Z
"ROOT"? → N
For 0 → K To N-1
N x√ (Abs Z) × e^( i (Arg Z + 2Kπ) ÷ N) ◢
Next

Alternative (done on CFX-9850G, older Casios - 94 bytes)
Rad
"A+Bi"? → Z
"ROOT"? → N
For 0 → K To N-1
N x√ (Abs Z) × ( cos ((Arg Z + 2Kπ) ÷ N) + i sin ((Arg Z + 2Kπ) ÷ N)) ◢
Next


TI-84+:

CROOTS
Complex Roots (TI-83+/TI-84+)
11/23/2012
76 Bytes

Radian
a+bi
Input "a+bi:", Z
Input "ROOT:", N
For(K,0,N-1)
Pause N x√ (abs(Z)) * e^(i(angle(Z)+2Kπ )/N)
End


HP 39gii:

PROGRAM CROOTS
All the N complex roots of Z
11/23/2012

Input: CROOTS(Z,N)

EXPORT CROOTS(Z,N)
BEGIN
LOCAL L3,K;
0 → HAngle; // set calculator to Radians mode
{ } → L3;
FOR K FROM 0 TO N-1 DO
CONCAT(L3, {N NTHROOT (ABS(Z)) * e^( i ( ARG(Z) + 2 * K * π )/N) → L3;
END;
RETURN L3;
END;




This concludes the Numeric CAS series... For now.

Until next time, Eddie

This blog is property of Edward Shore. 2012

No comments:

Post a Comment

Eclipse and HHC 2017

Eclipse On August 21, 2017 there will be a solar eclipse.  Totality (where the moon completely covers the sun) will occur in the northern...