As of: 15Mar1998
Hi Folks
Here, I'll demo some of the capabilities of Maple. Remember to type
with(linalg) ;
before running the commands shown below. BTWay, you can print the
exam from the class webpage.
Best Wishes,
-J.King
================================================================
soleil: soleil: Tue Mar 10 19:52:34 EST 1998
soleil: soleil: {{Maple}} |\^/| Maple V Release 3 (University of Florida)
._|\| |/|_. Copyright (c) 1981-1994 by Waterloo Maple Software and the
\ MAPLE / University of Waterloo. All rights reserved. Maple and Maple V
<____ ____> are registered trademarks of Waterloo Maple Software.
| Type ? for help.
20884
# Some answers (and a few solns) to LinAlg 3114, exam B, of 05Mar1998.
#####################################################
################ Start of Answers for B1 ##############
# (a) eta, lambda, sigma, mu, gamma (along with the uppercase versions).
# (b)
[ 2 0 -4 ]
[ ]
F := [ 1 1 1 ]
[ ]
[ 3 -1 -9 ]
> gaussjord(");
[ 1 0 -2 ]
[ ]
[ 0 1 3 ]
[ ]
[ 0 0 0 ]
################
# (c)
# The given matrix A is invertible IFF xz <> 5y.
> A := evalm([[
x , 5 ], [
y , z
]]) ; Ainv := inverse(A) ;
[ x 5 ]
A := [ ]
[ y z ]
[ z 5 ]
[ --------- - --------- ]
[ x z - 5 y x z - 5 y ]
Ainv := [ ] = (1 / det(A))*Etc
[ y x ]
[ - --------- --------- ]
[ x z - 5 y x z - 5 y ]
################
# (d)
> F :=
evalm([
[ 1 , -2 , 3 , 5 ],
[ 0 , 1 , 0 , 0 ],
[ 0 , 0 , 1 , 0 ],
[ 0 , 0 , 0 , 1]
]) ; Finv := inverse(F) ;
[ 1 -2 3 5 ]
[ ]
[ 0 1 0 0 ]
F := [ ]
[ 0 0 1 0 ]
[ ]
[ 0 0 0 1 ]
[ 1 2 -3 -5 ]
[ ]
[ 0 1 0 0 ]
Finv := [ ]
[ 0 0 1 0 ]
[ ]
[ 0 0 0 1 ]
################
# (e1 & 2)
# Easily, D^100 is simply the diagonal matrix with entries 3^100 and 1.
# In order to compute A^100, we use matrix-algebra to note that (for
# n an arbitrary non-negative integer)
# A^n = P * D^n * Pinv .
# Look at "Dmatrix", below. When x=3, then Dmatrix is the given D. When
# x=3^100, then Dmatrix equals D^100. (Note: "D" is a reserved symbol in
# Maple.)
> Dmatrix := evalm([[x,0],[0,1]]); P := evalm([[1,2],[1,3]]);
> Pinv := inverse(P);
[ x 0 ]
Dmatrix := [ ]
[ 0 1 ]
[ 1 2 ]
P := [ ]
[ 1 3 ]
[ 3 -2 ]
Pinv := [ ]
[ -1 1 ]
> Atothe100 := evalm(P &* Dmatrix &* Pinv) ;
[ 3 x - 2 - 2 x + 2 ]
Atothe100 := [ ]
[ 3 x - 3 - 2 x + 3 ]
# Now simply plug "3^100" in for "x". Because I don't want Maple to actually
# evaluate 3^100, I bind x to the *string* 3^100. (A trick worth remembering,
# BTWay.)
> x := `3^100` ;
x := 3^100
> evalm(Atothe100);
[ 3 x - 2 - 2 x + 2 ]
[ ]
[ 3 x - 3 - 2 x + 3 ]
# Didn't work. I want Maple to evaluate *each* entry in the matrix. So I will
# "map" the `eval' operator over the entries in the matrix. (This is one of
# the annoyances of Maple.) OTOHand, this "delayed" evaluation is what allows
# Maple to use letters as variables.
> map(eval,Atothe100);
[ 3 3^100 - 2 - 2 3^100 + 2 ]
[ ]
[ 3 3^100 - 3 - 2 3^100 + 3 ]
# Finally, lets restore x to his pristine value.
> x := 'x';
x := x
# BTWay, you should type
# ?string
# to the Maple prompt. This will show you something useful to you.
################
# (f)
# Lots of pairs work. F'irinstance, take two square roots of the zero matrix.
> sqrof0a := matrix(2,2,[0,1,0,0]); sqrof0b := matrix(2,2,[0,0,0,0]);
[ 0 1 ]
sqrof0a := [ ]
[ 0 0 ]
[ 0 0 ]
sqrof0b := [ ]
[ 0 0 ]
> evalm(sqrof0a^2) = evalm(sqrof0b^2);
[ 0 0 ] [ 0 0 ]
[ ] = [ ]
[ 0 0 ] [ 0 0 ]
# ... which is certainly true. I'll discuss more interesting examples in
# class.
################
# (g)
#
# This is back-substitution, and so the number of multiplications is
# approximately the number of non-zero terms. This latter is about (1/2)n^2.
################
# (h)
#
# Since {v_1, v_2} is the *standard* basis, the entries for the matrix of T
# are simply the given coefficients. So MatrixForT =
[ 2 0 3 ]
[ -1 4 5 ]
################ End of Answers for B1 ################
#####################################################
#####################################################
################ Start of Answers for B4 ##############
Matrix R corresponds to rotation (anti-clockwise, about the origin) by
angle Pi/6; better, by (1/12)-th of a circle. [This is immediate; just
draw six equilateral triangle meeting at a point, and use the Pythagorian Theorem.]
Matrix A corresponds to rotation by (1/8)-th of a circle. [Just draw
the 8 isosceles right triangles, sharing acute vertices at the origin.]
The associated linear transformations commute, [SIMPLE, BUT
w.r.t. composition, and thus the corresponding IMPORTANT
matrices commute w.r.t. matrix-multiplication. OBSERVATION.]
Thus
(RA)^36 = (R^36)*(A^36) FOR THESE TWO PARTICULAR MATRICES,
even though matrix-multiplication is not commutative in general.
Now R^12=I. Thus R^36 = (R^12)^3 = I^3 = I.
Similarly A^8=I and so A^32=I. Thus A^36 = (A^32)*(A^4) = A^4.
Consequently
(RA)^36 = (R^36)*(A^36) = I*(A^4) = A^4.
Now A^4 corresponds to rotation by (4/8)-ths of a full circle. That is,
A^4 corresponds to rotation half-way around a circle. This transformation
sends e_1 to negative e_1 and e_2 to -e_2. Thus its matrix is -I. So
(RA)^36 = -I ,
which equals [-1 0 ; 0 -1] in Matlab notation.
################ End of Answers for B4 ################
#####################################################
#####################################################
################ Start of Answers for B2 ##############
################ End of Answers for B2 ################
#####################################################