0) I did not collaborate with anyone for this homework.
1) a)
The error decreases as ‘i’ increases. ‘i’ is the number of terms – 40, and E_i is the error
(difference) between golden ratio and Lucas number ratio. This shows that as ‘i’ increases,
Lucas number’s ratio converges to the Golden Ratio. Since it is a logarithmic graph, the
graph is converging exponentially in reality.
1) b)
𝐿(𝑖) = 𝑎𝑖 , a is a positive constant
Substituting in the recurrence equation:
𝐿(𝑖) = 𝐿(𝑖 − 1) + 𝐿(𝑖 − 2) → 𝑎𝑖 = 𝑎𝑖−1 + 𝑎(𝑖−2)
𝑎𝑖
𝑎𝑖−1
𝑎(𝑖−2)
=
+
𝑎𝑖−2 𝑎(𝑖−2) 𝑎(𝑖−2)
𝑎2 = 𝑎 + 1
𝑎2 − 𝑎 − 1 = 0
𝑎=
1 ± √1 − 4(1)(−1)
1 ± √5
=
2
2
The larger positive root is:
1 + √5
2
Which is equal to the golden ratio.
2) a)
To complete the figure of the square we can add one more coordinate (-1, 1). We do this by
adding -1 to array X, and 1 to array Y.
2) b)
Figure:
Code:
function P = MakePoint(x,y)
% P is a point with x-coordinate P.X and y-coordinate P.Y
P = struct('X', x, 'Y', y);
end
function T = MakeTriangle(P1,P2,P3)
T = struct('A', P1, 'B', P2, 'C', P3);
end
P1 = MakePoint(0,0);
P2 = MakePoint(-1,-1);
P3 = MakePoint(1,-1);
T = MakeTriangle(P1,P2,P3);
M = [T.A.X, T.B.X, T.C.X; T.A.Y, T.B.Y, T.C.Y];
fill(M(1,:), M(2,:), 'r');
hold on
G = @(alpha)[cospi(alpha), -sinpi(alpha);
sinpi(alpha), cospi(alpha)];
cos(pi/2)
% Not zero. The value is 6.1232e-17.
M_green = G(1/2) * M;
fill(M_green(1,:), M_green(2,:), 'g');
hold on
M_cyan = G(1) * M;
fill(M_cyan(1,:), M_cyan(2,:), 'c');
hold on
M_blue = G(3/2) * M;
fill(M_blue(1,:), M_blue(2,:), 'b');
hold on
3) I used the second approach so there is no code.