Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 76
# Alex Moberg, Introduction to Linear Algebra in Sage # (1) Solve the following systems of linear equations by putting them in row reduced echelon form: x-2y+z=0, 2xy-8z=8, -4x+5y+9z=-9 A=matrix(3,4,[1,-2,1,0,0,2,-8,8,-4,5,9,-9]) print A.rref()
[ 1 0 0 29] [ 0 1 0 16] [ 0 0 1 3]
# (2) Let A equal the following matrix and let B equal the vector <6, 15, 24>. Use Sage to find all solutions to the equation Ax=B. A=matrix(3,3,[1,2,3,4,5,6,7,8,9]);show(A) B=vector([6,15,24]) A\B C=matrix(3,4,[1,2,3,6,4,5,6,15,7,8,9,24]);show(C.rref())
(123456789)\displaystyle \left(\begin{array}{rrr} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{array}\right)
(0, 3, 0)
(101001230000)\displaystyle \left(\begin{array}{rrrr} 1 & 0 & -1 & 0 \\ 0 & 1 & 2 & 3 \\ 0 & 0 & 0 & 0 \end{array}\right)
# (3) Let A and B equal the following matrices. Compute A+3B, B-2A, AB, and B-3I. A=matrix(2,2,[1,2,-2,1]); show(A); B=matrix(2,2,[3,5,-1,4]); show(B) A+3*B B-2*A A*B I=identity_matrix(2) B-3*I
(1221)\displaystyle \left(\begin{array}{rr} 1 & 2 \\ -2 & 1 \end{array}\right)
(3514)\displaystyle \left(\begin{array}{rr} 3 & 5 \\ -1 & 4 \end{array}\right)
[10 17] [-5 13] [1 1] [3 2] [ 1 13] [-7 -6] [ 0 5] [-1 1]
# (4) Let U equal the vector <1,1,0> and V equal the vector <2,0,-1>. Compute the dot product of U*V, the cross product of U x V and the magnitude of V. U=vector([1,1,0]) V=vector([2,0,-1]) U.dot_product(V) U.cross_product(V) norm(V)
2 (-1, 1, -2) sqrt(5)
# (5) Let V equal the vector <-2,4,2,2> and W equal the vector <0,3,5,2>. Combine vector operations to compute the angle theta between V and W. V=vector([-2,4,2,2]) W=vector([0,3,5,2]) dotProductVW=V.dot_product(W) cosOftheta=dotProductVW/ (norm(V)*norm(W)) theta=arccos(cosOftheta) print(n(theta))
0.648350216380485