# week11

## 1123 days ago by wldnd1217

#1 A=matrix(3,4,[3,-5,-2,7,2,3,-2,5,9,-3,3,-4]) B=matrix(3,4,[2,-3,4,5,1,7,-9,3,4,5,-4,5]) print(3*A) print(2*A+3*B) print(5*A-2*B)
 [ 9 -15 -6 21] [ 6 9 -6 15] [ 27 -9 9 -12] [ 12 -19 8 29] [ 7 27 -31 19] [ 30 9 -6 7] [ 11 -19 -18 25] [ 8 1 8 19] [ 37 -25 23 -30] [ 9 -15 -6 21] [ 6 9 -6 15] [ 27 -9 9 -12] [ 12 -19 8 29] [ 7 27 -31 19] [ 30 9 -6 7] [ 11 -19 -18 25] [ 8 1 8 19] [ 37 -25 23 -30]
#2 A=matrix(3,4,[3,-5,-2,7,2,3,-2,5,9,-3,3,-3]) B=matrix(4,5,[2,-3,4,5,-1,1,7,-9,3,3,4,5,-4,5,-2,3,2,1,-5,7]) print(A*B)
 [ 14 -40 72 -45 35] [ 14 15 -6 -16 46] [ 18 -39 48 66 -45] [ 14 -40 72 -45 35] [ 14 15 -6 -16 46] [ 18 -39 48 66 -45]
#3 A=matrix(3,3,[8,-5,-7,9,1,-2,5,-3,6]) print(A^0) print(A^2) print(A^3) print((A^2)^4) print(A^8)
 [1 0 0] [0 1 0] [0 0 1] [-16 -24 -88] [ 71 -38 -77] [ 43 -46 7] [-784 320 -368] [-159 -162 -883] [ -35 -282 -167] [-20452976 -9380640 -34955184] [ 28036983 -28932590 -30789429] [ 17002395 -18304566 -11127905] [-20452976 -9380640 -34955184] [ 28036983 -28932590 -30789429] [ 17002395 -18304566 -11127905] [1 0 0] [0 1 0] [0 0 1] [-16 -24 -88] [ 71 -38 -77] [ 43 -46 7] [-784 320 -368] [-159 -162 -883] [ -35 -282 -167] [-20452976 -9380640 -34955184] [ 28036983 -28932590 -30789429] [ 17002395 -18304566 -11127905] [-20452976 -9380640 -34955184] [ 28036983 -28932590 -30789429] [ 17002395 -18304566 -11127905]
#4 A=matrix(3,4,[1,7,-9,3,4,5,-4,5,3,2,1,-5]) B=matrix(4,5,[1,3,-4,5,-2,2,-3,2,5,-1,5,7,-9,3,3,3,2,1,-5,5]) C=A*B D=A.transpose() F=B.transpose() print bool(C.transpose()==F*D)
 True True
#5 A=matrix(4,4,[3,-5,-2,7,2,3,-2,5,9,-3,3,-4,7,2,4,5]) B=matrix(4,4,[2,-3,4,5,1,7,-9,3,4,5,-4,5,3,2,1,-5]) print bool((A*B).trace()==(B*A).trace())
 True True
#6 H=diagonal_matrix([5,-1,-2,4,3]) print(H)
 [ 5 0 0 0 0] [ 0 -1 0 0 0] [ 0 0 -2 0 0] [ 0 0 0 4 0] [ 0 0 0 0 3] [ 5 0 0 0 0] [ 0 -1 0 0 0] [ 0 0 -2 0 0] [ 0 0 0 4 0] [ 0 0 0 0 3]
#7 A=matrix(3,3,[1,-2,-4,-2,3,-7,-4,-7,6]) B=matrix(3,3,[0,2,-4,-2,0,5,4,-5,0]) I=matrix(3,3,[1,0,0,0,1,0,0,0,1]) print bool(A==A.transpose()) print bool(I==I.transpose()) print bool(B==-B.transpose())
 True True True True True True
#12.2 Determinant #1 #a) A=matrix(4,4,[3,-5,-2,4,2,3,-2,-5,5,-3,3,6,1,2,4,-2]) print(A.det())
 -411 -411
#b) A=matrix(4,4,[3,-5,-2,4,2,3,-2,-5,5,-3,3,6,1,2,4,-2]) print((A.transpose()).det())
 -411 -411
 [ -12 -66 -48 -3] [ 177 -54 -114 147] [ -29 46 21 -110] [ 113 5 -96 131] [ -12 -66 -48 -3] [ 177 -54 -114 147] [ -29 46 21 -110] [ 113 5 -96 131]
 [ 4/137 22/137 16/137 1/137] [ -59/137 18/137 38/137 -49/137] [ 29/411 -46/411 -7/137 110/411] [-113/411 -5/411 32/137 -131/411] [ 4/137 22/137 16/137 1/137] [ -59/137 18/137 38/137 -49/137] [ 29/411 -46/411 -7/137 110/411] [-113/411 -5/411 32/137 -131/411]
 ('x=', 3) ('y=', 2) ('z=', 1) ('x=', 3) ('y=', 2) ('z=', 1)