% (a) Define the rotation matrix A for θ = π/7
theta_a = pi/7;
A
= [cos(theta_a
), -sin(theta_a
); sin(theta_a
), cos(theta_a
)];
% Rotate the vector v = [1; 3] counter-clockwise by an angle of π/7
v = [1; 3];
rotated_v = A * v;
% Display the result
disp('Rotated vector v:');
disp(rotated_v);
% (b) Define the rotation matrix B for θ = π/10
theta_b = pi/10;
B
= [cos(theta_b
), -sin(theta_b
); sin(theta_b
), cos(theta_b
)];
% Check if AB = BA
AB = A * B;
BA = B * A;
disp('AB =');
disp(AB);
disp('BA =');
disp(BA);
disp('AB equals BA:');
disp(isequal(AB, BA));
% (c) Since AB does not equal BA, it indicates that the order of rotations matters.
% (d) Compute the composition C = AB
C = AB;
% Extract the (1,1) entry of C and calculate t
disp('Angle of rotation t in radians:');
disp(t);
% Compute t/pi to express it as a rational multiple of π
rat_t = t / pi;
disp('t/pi as a rational multiple:');
disp(rat_t);
% (e) Switch back to format short
format short;
% Verify that inv(A) is equal to R_{-π/7}
inv_A = inv(A);
R_neg_theta_a
= [cos(-theta_a
), -sin(-theta_a
); sin(-theta_a
), cos(-theta_a
)];
disp('Inverse of A:');
disp(inv_A);
disp('R_{-π/7}:');
disp(R_neg_theta_a);
disp('Inverse of A equals R_{-π/7}:');
disp(isequal(inv_A, R_neg_theta_a));
% (f) Define the reflection matrix L_θ for θ = π/7
L_0 = [1, 0; 0, -1]; % Reflection about the x1-axis
L_theta = A * L_0 * inv_A;
disp('Reflection matrix L_{π/7}:');
disp(L_theta);
% (g) Check if L_{π/7} * L_{0} equals L_{0} * L_{π/7}
L_theta_L0 = L_theta * L_0;
L0_L_theta = L_0 * L_theta;
disp('L_{π/7} * L_{0} =');
disp(L_theta_L0);
disp('L_{0} * L_{π/7} =');
disp(L0_L_theta);
disp('L_{π/7} * L_{0} equals L_{0} * L_{π/7}:');
disp(isequal(L_theta_L0, L0_L_theta));
% (h) Determine the angle of rotation for the composition L_{π/7} * L_{0}
angle_rotation
= acos(L_theta
(1, 1));disp('Angle of rotation for L_{π/7} * L_{0} in radians:');
disp(angle_rotation);
% Compute the angle as a rational multiple of π
rat_angle_rotation = angle_rotation / pi;
disp('Angle of rotation as a rational multiple of π:');
disp(rat_angle_rotation);
JSAoYSkgRGVmaW5lIHRoZSByb3RhdGlvbiBtYXRyaXggQSBmb3IgzrggPSDPgC83CnRoZXRhX2EgPSBwaS83OwpBID0gW2Nvcyh0aGV0YV9hKSwgLXNpbih0aGV0YV9hKTsgc2luKHRoZXRhX2EpLCBjb3ModGhldGFfYSldOwoKJSBSb3RhdGUgdGhlIHZlY3RvciB2ID0gWzE7IDNdIGNvdW50ZXItY2xvY2t3aXNlIGJ5IGFuIGFuZ2xlIG9mIM+ALzcKdiA9IFsxOyAzXTsKcm90YXRlZF92ID0gQSAqIHY7CgolIERpc3BsYXkgdGhlIHJlc3VsdApkaXNwKCdSb3RhdGVkIHZlY3RvciB2OicpOwpkaXNwKHJvdGF0ZWRfdik7CgolIChiKSBEZWZpbmUgdGhlIHJvdGF0aW9uIG1hdHJpeCBCIGZvciDOuCA9IM+ALzEwCnRoZXRhX2IgPSBwaS8xMDsKQiA9IFtjb3ModGhldGFfYiksIC1zaW4odGhldGFfYik7IHNpbih0aGV0YV9iKSwgY29zKHRoZXRhX2IpXTsKCiUgQ2hlY2sgaWYgQUIgPSBCQQpBQiA9IEEgKiBCOwpCQSA9IEIgKiBBOwoKZGlzcCgnQUIgPScpOwpkaXNwKEFCKTsKZGlzcCgnQkEgPScpOwpkaXNwKEJBKTsKZGlzcCgnQUIgZXF1YWxzIEJBOicpOwpkaXNwKGlzZXF1YWwoQUIsIEJBKSk7CgolIChjKSBTaW5jZSBBQiBkb2VzIG5vdCBlcXVhbCBCQSwgaXQgaW5kaWNhdGVzIHRoYXQgdGhlIG9yZGVyIG9mIHJvdGF0aW9ucyBtYXR0ZXJzLgoKJSAoZCkgQ29tcHV0ZSB0aGUgY29tcG9zaXRpb24gQyA9IEFCCkMgPSBBQjsKCiUgRXh0cmFjdCB0aGUg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