# Math4AI-HW2(Test)

## 1032 days ago by admin

# random한 정수 원소로 이루어진 10x10 행렬 생성 A = random_matrix(ZZ, 10, 10) print "random하게 생성한 10x10 행렬" print A print # 가역행렬인지 확인 print "A.is_invertible 함수" print A.is_invertible() print # det(A) print "det(A) 연산 결과" print A.det() print # Gauss-Jordan 소거법 print "Gauss-Jordan 소거법" print A.rref() print # det(A)가 0이 아닌 경우 if A.det() != 0: # 역행렬 계산 B = A.inverse() print "A의 역행렬 B" print B print print "AB 행렬 곱 연산결과" print A*B print print "BA 행렬 곱 연산결과" print B*A
 random하게 생성한 10x10 행렬 [-21 -1 1 0 -2 -21 1 3 -31 -2] [ 1 1 0 1 -1 0 0 6 0 0] [ -6 -1 0 1 -2 1 8 2 -2 1] [ 3 18 1 2 -1 11 0 0 -1 0] [ 2 2 -1 -3 3 -3 -2 6 0 -1] [ 1 -2 0 -1 0 1 0 -2 -9 7] [ 6 -5 -1 1 1 -1 -3 56 -1 -1] [ 7 -1 -1 -2 -3 0 -1 -2 7 1] [ 1 -1 -2 1 -6 1 0 0 0 -1] [ -8 2 3 0 -1 -1 1 0 -1 0] A.is_invertible 함수 False det(A) 연산 결과 -780408054 Gauss-Jordan 소거법 [1 0 0 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 0 0 0 0] [0 0 0 1 0 0 0 0 0 0] [0 0 0 0 1 0 0 0 0 0] [0 0 0 0 0 1 0 0 0 0] [0 0 0 0 0 0 1 0 0 0] [0 0 0 0 0 0 0 1 0 0] [0 0 0 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 0 0 1] A의 역행렬 B [ 31727498/390204027 -170902768/390204027 2070635/390204027 4171660/43356003 -35892434/130068009 -9490234/130068009 10266262/130068009 104758382/390204027 -26347459/130068009 -66492442/390204027] [ -7770971/390204027 148260616/390204027 4833869/780408054 -281753/86712006 39855607/260136018 5399771/260136018 -15029237/260136018 -24435053/390204027 4327288/130068009 31871393/780408054] [ 68738014/390204027 -489975101/390204027 -13192478/390204027 9328238/43356003 -93364699/130068009 -22228334/130068009 28427936/130068009 234338575/390204027 -62771552/130068009 -33196385/390204027] [ -23054006/390204027 397241080/390204027 -20586332/390204027 -4775674/43356003 8348354/130068009 3667264/130068009 -15581530/130068009 -108159227/390204027 5358175/130068009 -10558211/390204027] [ -13040321/390204027 75053407/390204027 2685203/780408054 -3372317/86712006 26725351/260136018 3279023/260136018 -9039533/260136018 -57372500/390204027 -7349414/130068009 -31149673/780408054] [ -1575104/390204027 -199009454/390204027 524236/390204027 2568659/43356003 -12378589/130068009 1309/130068009 8455592/130068009 -8282/390204027 5154214/130068009 -798272/390204027] [ 22181654/390204027 -121441678/390204027 52951061/390204027 2894317/43356003 -21088880/130068009 -9387502/130068009 6143158/130068009 76286366/390204027 -22475419/130068009 -50544607/390204027] [ -2323807/390204027 15109751/390204027 2906894/390204027 -156878/43356003 3496492/130068009 793766/130068009 1385020/130068009 -4922767/390204027 1552097/130068009 7590020/390204027] [ -26350805/390204027 196332442/390204027 -448843/780408054 -7317005/86712006 49656031/260136018 7216637/260136018 -19336385/260136018 -50254289/390204027 10839373/130068009 79692497/780408054] [ -44364743/390204027 408698002/390204027 -4158097/780408054 -12868007/86712006 93405745/260136018 52196105/260136018 -38164661/260136018 -103416224/390204027 19409221/130068009 132114335/780408054] AB 행렬 곱 연산결과 [1 0 0 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 0 0 0 0] [0 0 0 1 0 0 0 0 0 0] [0 0 0 0 1 0 0 0 0 0] [0 0 0 0 0 1 0 0 0 0] [0 0 0 0 0 0 1 0 0 0] [0 0 0 0 0 0 0 1 0 0] [0 0 0 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 0 0 1] BA 행렬 곱 연산결과 [1 0 0 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 0 0 0 0] [0 0 0 1 0 0 0 0 0 0] [0 0 0 0 1 0 0 0 0 0] [0 0 0 0 0 1 0 0 0 0] [0 0 0 0 0 0 1 0 0 0] [0 0 0 0 0 0 0 1 0 0] [0 0 0 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 0 0 1] random하게 생성한 10x10 행렬 [-21 -1 1 0 -2 -21 1 3 -31 -2] [ 1 1 0 1 -1 0 0 6 0 0] [ -6 -1 0 1 -2 1 8 2 -2 1] [ 3 18 1 2 -1 11 0 0 -1 0] [ 2 2 -1 -3 3 -3 -2 6 0 -1] [ 1 -2 0 -1 0 1 0 -2 -9 7] [ 6 -5 -1 1 1 -1 -3 56 -1 -1] [ 7 -1 -1 -2 -3 0 -1 -2 7 1] [ 1 -1 -2 1 -6 1 0 0 0 -1] [ -8 2 3 0 -1 -1 1 0 -1 0] A.is_invertible 함수 False det(A) 연산 결과 -780408054 Gauss-Jordan 소거법 [1 0 0 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 0 0 0 0] [0 0 0 1 0 0 0 0 0 0] [0 0 0 0 1 0 0 0 0 0] [0 0 0 0 0 1 0 0 0 0] [0 0 0 0 0 0 1 0 0 0] [0 0 0 0 0 0 0 1 0 0] [0 0 0 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 0 0 1] A의 역행렬 B [ 31727498/390204027 -170902768/390204027 2070635/390204027 4171660/43356003 -35892434/130068009 -9490234/130068009 10266262/130068009 104758382/390204027 -26347459/130068009 -66492442/390204027] [ -7770971/390204027 148260616/390204027 4833869/780408054 -281753/86712006 39855607/260136018 5399771/260136018 -15029237/260136018 -24435053/390204027 4327288/130068009 31871393/780408054] [ 68738014/390204027 -489975101/390204027 -13192478/390204027 9328238/43356003 -93364699/130068009 -22228334/130068009 28427936/130068009 234338575/390204027 -62771552/130068009 -33196385/390204027] [ -23054006/390204027 397241080/390204027 -20586332/390204027 -4775674/43356003 8348354/130068009 3667264/130068009 -15581530/130068009 -108159227/390204027 5358175/130068009 -10558211/390204027] [ -13040321/390204027 75053407/390204027 2685203/780408054 -3372317/86712006 26725351/260136018 3279023/260136018 -9039533/260136018 -57372500/390204027 -7349414/130068009 -31149673/780408054] [ -1575104/390204027 -199009454/390204027 524236/390204027 2568659/43356003 -12378589/130068009 1309/130068009 8455592/130068009 -8282/390204027 5154214/130068009 -798272/390204027] [ 22181654/390204027 -121441678/390204027 52951061/390204027 2894317/43356003 -21088880/130068009 -9387502/130068009 6143158/130068009 76286366/390204027 -22475419/130068009 -50544607/390204027] [ -2323807/390204027 15109751/390204027 2906894/390204027 -156878/43356003 3496492/130068009 793766/130068009 1385020/130068009 -4922767/390204027 1552097/130068009 7590020/390204027] [ -26350805/390204027 196332442/390204027 -448843/780408054 -7317005/86712006 49656031/260136018 7216637/260136018 -19336385/260136018 -50254289/390204027 10839373/130068009 79692497/780408054] [ -44364743/390204027 408698002/390204027 -4158097/780408054 -12868007/86712006 93405745/260136018 52196105/260136018 -38164661/260136018 -103416224/390204027 19409221/130068009 132114335/780408054] AB 행렬 곱 연산결과 [1 0 0 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 0 0 0 0] [0 0 0 1 0 0 0 0 0 0] [0 0 0 0 1 0 0 0 0 0] [0 0 0 0 0 1 0 0 0 0] [0 0 0 0 0 0 1 0 0 0] [0 0 0 0 0 0 0 1 0 0] [0 0 0 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 0 0 1] BA 행렬 곱 연산결과 [1 0 0 0 0 0 0 0 0 0] [0 1 0 0 0 0 0 0 0 0] [0 0 1 0 0 0 0 0 0 0] [0 0 0 1 0 0 0 0 0 0] [0 0 0 0 1 0 0 0 0 0] [0 0 0 0 0 1 0 0 0 0] [0 0 0 0 0 0 1 0 0 0] [0 0 0 0 0 0 0 1 0 0] [0 0 0 0 0 0 0 0 1 0] [0 0 0 0 0 0 0 0 0 1]