Consider the cubic F(z) = x^5 - 1. Its roots arc the three cubic roots of unity:
ID: 3832399 • Letter: C
Question
Consider the cubic F(z) = x^5 - 1. Its roots arc the three cubic roots of unity: root m = e^i(2pi m/3), m = 0, 1, 2 i.e. 1, e^i(2pi/3), e^i(2pi 2/3) which, by Ruler's formula, are: 1, cos(2 pi/3) plusminus i sin(2 pi/3) = (-1 plusminus i Squareroot3)/2. Pick maxIT = 20, radius of convergence R = 1, (TOL not needed, accuracy is of no concern here). Consider a window: [-1, 1] times [-1, 1] on the xy-plane. For integer M. construct a grid of (M+ l) times (M+1) z-grid points: x_j + i (as complex numbers). Initialize an array for colors: Colors = zeros(M + 1, M + 1) Take each z-grid point as starting point zo and compute its orbit under the Newton iteration: z_n+1 = z_n - F(z_n) 1/F(z_n). n = 0:max IT. For each iterate z, : if is within radius R of root_m, m=0, 1, 2 then set color for the starting z_0 to be m: Colors(ky, x) = m Once all the z-grid points have been processed and assigned a color, plot the Colors array: pcolor(Colors).Explanation / Answer
MATLAB code:
%% MATLAB code:
clc;
clear;
close all;
syms x;
%% change the value of M as per requirement
M=5;
%% Maximum iteration
maxIT=20;
R=1;
x0=1;
X=linspace(-1,1,M+1);
Y=linspace(-1,1,M+1);
my_grid=meshgrid(X,Y);
Colors=zeros(M+1,M+1);
f = inline(x^3-1);
df = inline(3*x^2);
x(1) = x0 - (f(x0)/df(x0));
ex(1) = abs(x(1)-x0);
k = 2;
while (k <= maxIT)
x(k) = x(k-1) - (f(x(k-1))/df(x(k-1)));
ex(k) = abs(x(k)-x(k-1));
k = k+1;
end
for i=0:1:M
for j=0:1:M
for m=0:1:3
rootm=exp(i*2*pi*m/3);
if rootm<pi/5
m_val=m;
else
m_val=2;
end
end
Colors(i+1,j+1)= m_val;
end
end
pcolor(Colors)