You are on page 1of 4

Complex Numbers

Define

syms z
z = 1i

z =
  0.000000000000000 + 1.000000000000000i

 
z = sym(1/sqrt(2)-1/sqrt(2)*i)

z =

abs(z)

ans =

z^5

ans =

z = sym(exp(-i*pi/4))

z =

z^10

ans =

Solving complex equations

Method 1

 
clear
syms z
q = solve(z^2-4*z+5)

q =

s=solve(z^8-1)

s =

 
 

Method 2
Another way of accomplishing the same is via polynomials to represent q and s respectively.

q1 = [2, -4,5]

s1 = [1 0 0 0 0 0 0 0 -1].

clear
syms q s;
q1 = [2, -4,5];
s1 = [1 0 0 0 0 0 0 0 -1];
 
q = roots(q1)

q =
  1.000000000000000 + 1.224744871391589i
  1.000000000000000 - 1.224744871391589i

s = roots(s1)
s =
-1.000000000000001 + 0.000000000000000i
-0.707106781186548 + 0.707106781186547i
-0.707106781186548 - 0.707106781186547i
  0.000000000000000 + 1.000000000000000i
  0.000000000000000 - 1.000000000000000i
  1.000000000000000 + 0.000000000000000i
  0.707106781186548 + 0.707106781186548i
  0.707106781186548 - 0.707106781186548i

sym(s)

ans =

Plot using Argand diagram

figure
plot(s, 'o')
grid on
 
xlabel('Real part');
ylabel('Imaginary part')
axis equal
 

Method 3

evalin(symengine, 'solve(z^8-1)')

ans =

You might also like