HW 2 by 엄지민, 10X10 행렬 생성하여 가역 여부 판단하기

641 days ago by admin

# random한 유리수 원소로 이루어진 7x7 행렬 생성 A = random_matrix(QQ, 7, 7, num_bound=20, den_bound=4) print "random하게 생성한 7x7 행렬" print A # 가역행렬인지 확인 print "A.is_invertible 함수" print A.is_invertible() # det(A) print "det(A) 연산 결과" print A.det() # Gauss-Jordan 소거법 print "Gauss-Jordan 소거법" print A.rref() # Gauss Jordan 소거법을 이용하여 역행렬 생성하기 Id=identity_matrix(7) print "Gauss Jordan 소거법을 이용한 역행렬" print A.augment(I) C=A.augment(Id).rref() print C # det(A)가 0이 아닌 경우 if A.det() != 0: # 역행렬 계산 B = A.inverse() print "A의 역행렬 B" print B print "AB 행렬 곱 연산결과" print A*B print "BA 행렬 곱 연산결과" print B*A # Id를 첨가함으로써 생성한 역행렬과 역행렬을 비교해보기 print A.augment(Id) print C==B.augment(Id) 
       
random하게 생성한 7x7 행렬
[   -7  -3/2   -10     6  13/3    12  -1/3]
[ -1/2    -1   -20   -11  11/4   -13   3/2]
[  8/3   5/2     5    -2   7/4    -4 -17/3]
[-17/2     2  -9/4    -4  11/4    -6   7/4]
[    4     0   -18   -14    -9     6   9/2]
[ 13/2     2   5/2  -5/2     7  -2/3  -5/2]
[   17    20 -13/3     7    -6  13/4  -1/3]
A.is_invertible 함수
True
det(A) 연산 결과
-7068637287461/82944
Gauss-Jordan 소거법
[1 0 0 0 0 0 0]
[0 1 0 0 0 0 0]
[0 0 1 0 0 0 0]
[0 0 0 1 0 0 0]
[0 0 0 0 1 0 0]
[0 0 0 0 0 1 0]
[0 0 0 0 0 0 1]
Gauss Jordan 소거법을 이용한 역행렬
[   -7  -3/2   -10     6  13/3    12  -1/3     1     0     0     0     0
0     0]
[ -1/2    -1   -20   -11  11/4   -13   3/2     0     1     0     0     0
0     0]
[  8/3   5/2     5    -2   7/4    -4 -17/3     0     0     1     0     0
0     0]
[-17/2     2  -9/4    -4  11/4    -6   7/4     0     0     0     1     0
0     0]
[    4     0   -18   -14    -9     6   9/2     0     0     0     0     1
0     0]
[ 13/2     2   5/2  -5/2     7  -2/3  -5/2     0     0     0     0     0
1     0]
[   17    20 -13/3     7    -6  13/4  -1/3     0     0     0     0     0
0     1]
[                           1                            0              
0                            0                            0             
0                            0  -168044405886/7068637287461  
127659402974/7068637287461  -265402657014/7068637287461 
-476631837872/7068637287461   -30782792278/7068637287461  
305655930852/7068637287461    44052562536/7068637287461]
[                           0                            1              
0                            0                            0             
0                            0    60650514750/7068637287461 
-182625385908/7068637287461   158340765996/7068637287461  
626336857696/7068637287461    83406071032/7068637287461   
77509403568/7068637287461   258672161808/7068637287461]
[                           0                            0              
1                            0                            0             
0                            0  -206397593280/7068637287461 
-272738052668/7068637287461   -49115027016/7068637287461  
186105677948/7068637287461    23407263922/7068637287461  
155226026928/7068637287461   -57110514240/7068637287461]
[                           0                            0              
0                            1                            0             
0                            0   101969780274/7068637287461  
202594501546/7068637287461  -221498259222/7068637287461 
-360316065844/7068637287461  -370797507678/7068637287461 
-324830562630/7068637287461   113979403848/7068637287461]
[                           0                            0              
0                            0                            1             
0                            0   132876543228/7068637287461   
34260239384/7068637287461  -356240442924/7068637287461  
202059422992/7068637287461  -125747470192/7068637287461  
730351394736/7068637287461   -37032273696/7068637287461]
[                           0                            0              
0                            0                            0             
1                            0   217015247808/7068637287461 
-292521569088/7068637287461    24685394112/7068637287461   
72390141312/7068637287461   241791736272/7068637287461  
229715850840/7068637287461   -31646208348/7068637287461]
[                           0                            0              
0                            0                            0             
0                            1  -382578828768/7068637287461 
-115583993176/7068637287461 -1395047075184/7068637287461  
354710798176/7068637287461   -35676344374/7068637287461  
493040962680/7068637287461    55133096496/7068637287461]
A의 역행렬 B
[ -168044405886/7068637287461   127659402974/7068637287461 
-265402657014/7068637287461  -476631837872/7068637287461  
-30782792278/7068637287461   305655930852/7068637287461   
44052562536/7068637287461]
[   60650514750/7068637287461  -182625385908/7068637287461  
158340765996/7068637287461   626336857696/7068637287461   
83406071032/7068637287461    77509403568/7068637287461  
258672161808/7068637287461]
[ -206397593280/7068637287461  -272738052668/7068637287461  
-49115027016/7068637287461   186105677948/7068637287461   
23407263922/7068637287461   155226026928/7068637287461  
-57110514240/7068637287461]
[  101969780274/7068637287461   202594501546/7068637287461 
-221498259222/7068637287461  -360316065844/7068637287461 
-370797507678/7068637287461  -324830562630/7068637287461  
113979403848/7068637287461]
[  132876543228/7068637287461    34260239384/7068637287461 
-356240442924/7068637287461   202059422992/7068637287461 
-125747470192/7068637287461   730351394736/7068637287461  
-37032273696/7068637287461]
[  217015247808/7068637287461  -292521569088/7068637287461   
24685394112/7068637287461    72390141312/7068637287461  
241791736272/7068637287461   229715850840/7068637287461  
-31646208348/7068637287461]
[ -382578828768/7068637287461  -115583993176/7068637287461
-1395047075184/7068637287461   354710798176/7068637287461  
-35676344374/7068637287461   493040962680/7068637287461   
55133096496/7068637287461]
AB 행렬 곱 연산결과
[1 0 0 0 0 0 0]
[0 1 0 0 0 0 0]
[0 0 1 0 0 0 0]
[0 0 0 1 0 0 0]
[0 0 0 0 1 0 0]
[0 0 0 0 0 1 0]
[0 0 0 0 0 0 1]
BA 행렬 곱 연산결과
[1 0 0 0 0 0 0]
[0 1 0 0 0 0 0]
[0 0 1 0 0 0 0]
[0 0 0 1 0 0 0]
[0 0 0 0 1 0 0]
[0 0 0 0 0 1 0]
[0 0 0 0 0 0 1]
[   -7  -3/2   -10     6  13/3    12  -1/3     1     0     0     0     0
0     0]
[ -1/2    -1   -20   -11  11/4   -13   3/2     0     1     0     0     0
0     0]
[  8/3   5/2     5    -2   7/4    -4 -17/3     0     0     1     0     0
0     0]
[-17/2     2  -9/4    -4  11/4    -6   7/4     0     0     0     1     0
0     0]
[    4     0   -18   -14    -9     6   9/2     0     0     0     0     1
0     0]
[ 13/2     2   5/2  -5/2     7  -2/3  -5/2     0     0     0     0     0
1     0]
[   17    20 -13/3     7    -6  13/4  -1/3     0     0     0     0     0
0     1]
False
random하게 생성한 7x7 행렬
[   -7  -3/2   -10     6  13/3    12  -1/3]
[ -1/2    -1   -20   -11  11/4   -13   3/2]
[  8/3   5/2     5    -2   7/4    -4 -17/3]
[-17/2     2  -9/4    -4  11/4    -6   7/4]
[    4     0   -18   -14    -9     6   9/2]
[ 13/2     2   5/2  -5/2     7  -2/3  -5/2]
[   17    20 -13/3     7    -6  13/4  -1/3]
A.is_invertible 함수
True
det(A) 연산 결과
-7068637287461/82944
Gauss-Jordan 소거법
[1 0 0 0 0 0 0]
[0 1 0 0 0 0 0]
[0 0 1 0 0 0 0]
[0 0 0 1 0 0 0]
[0 0 0 0 1 0 0]
[0 0 0 0 0 1 0]
[0 0 0 0 0 0 1]
Gauss Jordan 소거법을 이용한 역행렬
[   -7  -3/2   -10     6  13/3    12  -1/3     1     0     0     0     0     0     0]
[ -1/2    -1   -20   -11  11/4   -13   3/2     0     1     0     0     0     0     0]
[  8/3   5/2     5    -2   7/4    -4 -17/3     0     0     1     0     0     0     0]
[-17/2     2  -9/4    -4  11/4    -6   7/4     0     0     0     1     0     0     0]
[    4     0   -18   -14    -9     6   9/2     0     0     0     0     1     0     0]
[ 13/2     2   5/2  -5/2     7  -2/3  -5/2     0     0     0     0     0     1     0]
[   17    20 -13/3     7    -6  13/4  -1/3     0     0     0     0     0     0     1]
[                           1                            0                            0                            0                            0                            0                            0  -168044405886/7068637287461   127659402974/7068637287461  -265402657014/7068637287461  -476631837872/7068637287461   -30782792278/7068637287461   305655930852/7068637287461    44052562536/7068637287461]
[                           0                            1                            0                            0                            0                            0                            0    60650514750/7068637287461  -182625385908/7068637287461   158340765996/7068637287461   626336857696/7068637287461    83406071032/7068637287461    77509403568/7068637287461   258672161808/7068637287461]
[                           0                            0                            1                            0                            0                            0                            0  -206397593280/7068637287461  -272738052668/7068637287461   -49115027016/7068637287461   186105677948/7068637287461    23407263922/7068637287461   155226026928/7068637287461   -57110514240/7068637287461]
[                           0                            0                            0                            1                            0                            0                            0   101969780274/7068637287461   202594501546/7068637287461  -221498259222/7068637287461  -360316065844/7068637287461  -370797507678/7068637287461  -324830562630/7068637287461   113979403848/7068637287461]
[                           0                            0                            0                            0                            1                            0                            0   132876543228/7068637287461    34260239384/7068637287461  -356240442924/7068637287461   202059422992/7068637287461  -125747470192/7068637287461   730351394736/7068637287461   -37032273696/7068637287461]
[                           0                            0                            0                            0                            0                            1                            0   217015247808/7068637287461  -292521569088/7068637287461    24685394112/7068637287461    72390141312/7068637287461   241791736272/7068637287461   229715850840/7068637287461   -31646208348/7068637287461]
[                           0                            0                            0                            0                            0                            0                            1  -382578828768/7068637287461  -115583993176/7068637287461 -1395047075184/7068637287461   354710798176/7068637287461   -35676344374/7068637287461   493040962680/7068637287461    55133096496/7068637287461]
A의 역행렬 B
[ -168044405886/7068637287461   127659402974/7068637287461  -265402657014/7068637287461  -476631837872/7068637287461   -30782792278/7068637287461   305655930852/7068637287461    44052562536/7068637287461]
[   60650514750/7068637287461  -182625385908/7068637287461   158340765996/7068637287461   626336857696/7068637287461    83406071032/7068637287461    77509403568/7068637287461   258672161808/7068637287461]
[ -206397593280/7068637287461  -272738052668/7068637287461   -49115027016/7068637287461   186105677948/7068637287461    23407263922/7068637287461   155226026928/7068637287461   -57110514240/7068637287461]
[  101969780274/7068637287461   202594501546/7068637287461  -221498259222/7068637287461  -360316065844/7068637287461  -370797507678/7068637287461  -324830562630/7068637287461   113979403848/7068637287461]
[  132876543228/7068637287461    34260239384/7068637287461  -356240442924/7068637287461   202059422992/7068637287461  -125747470192/7068637287461   730351394736/7068637287461   -37032273696/7068637287461]
[  217015247808/7068637287461  -292521569088/7068637287461    24685394112/7068637287461    72390141312/7068637287461   241791736272/7068637287461   229715850840/7068637287461   -31646208348/7068637287461]
[ -382578828768/7068637287461  -115583993176/7068637287461 -1395047075184/7068637287461   354710798176/7068637287461   -35676344374/7068637287461   493040962680/7068637287461    55133096496/7068637287461]
AB 행렬 곱 연산결과
[1 0 0 0 0 0 0]
[0 1 0 0 0 0 0]
[0 0 1 0 0 0 0]
[0 0 0 1 0 0 0]
[0 0 0 0 1 0 0]
[0 0 0 0 0 1 0]
[0 0 0 0 0 0 1]
BA 행렬 곱 연산결과
[1 0 0 0 0 0 0]
[0 1 0 0 0 0 0]
[0 0 1 0 0 0 0]
[0 0 0 1 0 0 0]
[0 0 0 0 1 0 0]
[0 0 0 0 0 1 0]
[0 0 0 0 0 0 1]
[   -7  -3/2   -10     6  13/3    12  -1/3     1     0     0     0     0     0     0]
[ -1/2    -1   -20   -11  11/4   -13   3/2     0     1     0     0     0     0     0]
[  8/3   5/2     5    -2   7/4    -4 -17/3     0     0     1     0     0     0     0]
[-17/2     2  -9/4    -4  11/4    -6   7/4     0     0     0     1     0     0     0]
[    4     0   -18   -14    -9     6   9/2     0     0     0     0     1     0     0]
[ 13/2     2   5/2  -5/2     7  -2/3  -5/2     0     0     0     0     0     1     0]
[   17    20 -13/3     7    -6  13/4  -1/3     0     0     0     0     0     0     1]
False
print I.augment(B)# random한 유리수 원소로 이루어진 10x10 행렬 생성 A = random_matrix(QQ, 10, 10) print "random하게 생성한 10x10 행렬" print A # 가역행렬인지 확인 print "A.is_invertible 함수" print A.is_invertible() # det(A) print "det(A) 연산 결과" print A.det() # Gauss-Jordan 소거법 print "Gauss-Jordan 소거법" print A.rref() # Gauss Jordan 소거법을 이용하여 역행렬 생성하기 I=identity_matrix(10) print "Gauss Jordan 소거법을 이용한 역행렬" C=A.augment(I).rref() print C # det(A)가 0이 아닌 경우 if A.det() != 0: # 역행렬 계산 B = A.inverse() print "A의 역행렬 B" print B print "AB 행렬 곱 연산결과" print A*B print "BA 행렬 곱 연산결과" print B*A #I를 첨가함으로써 생성한 역행렬과 역행렬을 비교해보기 if C==I.augment(B): print 'True' else: print 'False' 
       
random하게 생성한 10x10 행렬
[   1   -2    1    1    0   -2   -1    1    2    0]
[   2    0   -1    0    1    0   -1    1   -2 -1/2]
[   1    1    0    1    2    2    0   -1    1    1]
[   2 -1/2    1   -2    0    0    0    1    1   -2]
[   2  1/2    0    2    0 -1/2    0   -1 -1/2   -1]
[   1    0  1/2    0    1    0    0    2    0   -2]
[   0    1    0    0    0    2    0    1    1    0]
[   0 -1/2    0    0    0    1    0    1    2   -1]
[  -1 -1/2    0    0    0    2    0    0    0   -2]
[  -1  1/2    0    0    0   -2   -2   -2 -1/2 -1/2]
A.is_invertible 함수
True
det(A) 연산 결과
67059/8
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]
Gauss Jordan 소거법을 이용한 역행렬
[             1              0              0              0            
0              0              0              0              0           
0     2243/67059     8825/67059     1760/67059     8503/44706   
10753/67059    -4115/22353       374/7451   -2107/134118      -578/7451 
-5534/67059]
[             0              1              0              0            
0              0              0              0              0           
0    -4922/22353    -2942/22353     -992/22353      -161/7451    
2474/22353      1642/7451      2348/7451      797/22353     -2274/7451  
3932/22353]
[             0              0              1              0            
0              0              0              0              0           
0    26875/67059   -21503/67059     5362/67059     8861/44706   
-2827/67059     3593/22353      3561/7451 -150215/134118      2625/7451 
-2686/67059]
[             0              0              0              1            
0              0              0              0              0           
0     3169/22353    -1085/22353     -533/22353    -3553/14902    
4529/22353       717/7451       871/7451    -3515/44706       686/7451  
-1042/22353]
[             0              0              0              0            
1              0              0              0              0           
0  -11681/134118    -515/134118    22175/67059    -7867/89412 
-28135/134118    15311/44706    -6409/14902   36445/268236    
-933/14902     3049/67059]
[             0              0              0              0            
0              1              0              0              0           
0     7339/67059     5077/67059     4204/67059     2987/44706   
-1291/67059    -4495/22353      2011/7451  -35057/134118      2311/7451 
-6208/67059]
[             0              0              0              0            
0              0              1              0              0           
0    -6131/22353    -5018/22353      481/22353      -305/7451    
1910/22353      1352/7451     -3512/7451     5675/22353     -1346/7451  
-5602/22353]
[             0              0              0              0            
0              0              0              1              0           
0     1663/22353     1321/22353    -3080/22353    -1841/14902   
-2053/22353      1613/7451      1762/7451    -1901/44706      -691/7451 
-1492/22353]
[             0              0              0              0            
0              0              0              0              1           
0    -4901/67059    -5291/67059     3808/67059      515/44706    
1319/67059     -775/22353      -681/7451   71035/134118     -1657/7451  
5096/67059]
[             0              0              0              0            
0              0              0              0              0           
1      1101/7451       319/7451       452/7451     -341/14902     
-947/7451     -1223/7451      1237/7451    -3911/14902      -557/7451   
-710/7451]
A의 역행렬 B
[    2243/67059     8825/67059     1760/67059     8503/44706   
10753/67059    -4115/22353       374/7451   -2107/134118      -578/7451 
-5534/67059]
[   -4922/22353    -2942/22353     -992/22353      -161/7451    
2474/22353      1642/7451      2348/7451      797/22353     -2274/7451  
3932/22353]
[   26875/67059   -21503/67059     5362/67059     8861/44706   
-2827/67059     3593/22353      3561/7451 -150215/134118      2625/7451 
-2686/67059]
[    3169/22353    -1085/22353     -533/22353    -3553/14902    
4529/22353       717/7451       871/7451    -3515/44706       686/7451  
-1042/22353]
[ -11681/134118    -515/134118    22175/67059    -7867/89412 
-28135/134118    15311/44706    -6409/14902   36445/268236    
-933/14902     3049/67059]
[    7339/67059     5077/67059     4204/67059     2987/44706   
-1291/67059    -4495/22353      2011/7451  -35057/134118      2311/7451 
-6208/67059]
[   -6131/22353    -5018/22353      481/22353      -305/7451    
1910/22353      1352/7451     -3512/7451     5675/22353     -1346/7451  
-5602/22353]
[    1663/22353     1321/22353    -3080/22353    -1841/14902   
-2053/22353      1613/7451      1762/7451    -1901/44706      -691/7451 
-1492/22353]
[   -4901/67059    -5291/67059     3808/67059      515/44706    
1319/67059     -775/22353      -681/7451   71035/134118     -1657/7451  
5096/67059]
[     1101/7451       319/7451       452/7451     -341/14902     
-947/7451     -1223/7451      1237/7451    -3911/14902      -557/7451   
-710/7451]
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]
Traceback (click to the left of this block for traceback)
...
TypeError: matrix has denominators so can't change to ZZ.
random하게 생성한 10x10 행렬
[   1   -2    1    1    0   -2   -1    1    2    0]
[   2    0   -1    0    1    0   -1    1   -2 -1/2]
[   1    1    0    1    2    2    0   -1    1    1]
[   2 -1/2    1   -2    0    0    0    1    1   -2]
[   2  1/2    0    2    0 -1/2    0   -1 -1/2   -1]
[   1    0  1/2    0    1    0    0    2    0   -2]
[   0    1    0    0    0    2    0    1    1    0]
[   0 -1/2    0    0    0    1    0    1    2   -1]
[  -1 -1/2    0    0    0    2    0    0    0   -2]
[  -1  1/2    0    0    0   -2   -2   -2 -1/2 -1/2]
A.is_invertible 함수
True
det(A) 연산 결과
67059/8
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]
Gauss Jordan 소거법을 이용한 역행렬
[             1              0              0              0              0              0              0              0              0              0     2243/67059     8825/67059     1760/67059     8503/44706    10753/67059    -4115/22353       374/7451   -2107/134118      -578/7451    -5534/67059]
[             0              1              0              0              0              0              0              0              0              0    -4922/22353    -2942/22353     -992/22353      -161/7451     2474/22353      1642/7451      2348/7451      797/22353     -2274/7451     3932/22353]
[             0              0              1              0              0              0              0              0              0              0    26875/67059   -21503/67059     5362/67059     8861/44706    -2827/67059     3593/22353      3561/7451 -150215/134118      2625/7451    -2686/67059]
[             0              0              0              1              0              0              0              0              0              0     3169/22353    -1085/22353     -533/22353    -3553/14902     4529/22353       717/7451       871/7451    -3515/44706       686/7451    -1042/22353]
[             0              0              0              0              1              0              0              0              0              0  -11681/134118    -515/134118    22175/67059    -7867/89412  -28135/134118    15311/44706    -6409/14902   36445/268236     -933/14902     3049/67059]
[             0              0              0              0              0              1              0              0              0              0     7339/67059     5077/67059     4204/67059     2987/44706    -1291/67059    -4495/22353      2011/7451  -35057/134118      2311/7451    -6208/67059]
[             0              0              0              0              0              0              1              0              0              0    -6131/22353    -5018/22353      481/22353      -305/7451     1910/22353      1352/7451     -3512/7451     5675/22353     -1346/7451    -5602/22353]
[             0              0              0              0              0              0              0              1              0              0     1663/22353     1321/22353    -3080/22353    -1841/14902    -2053/22353      1613/7451      1762/7451    -1901/44706      -691/7451    -1492/22353]
[             0              0              0              0              0              0              0              0              1              0    -4901/67059    -5291/67059     3808/67059      515/44706     1319/67059     -775/22353      -681/7451   71035/134118     -1657/7451     5096/67059]
[             0              0              0              0              0              0              0              0              0              1      1101/7451       319/7451       452/7451     -341/14902      -947/7451     -1223/7451      1237/7451    -3911/14902      -557/7451      -710/7451]
A의 역행렬 B
[    2243/67059     8825/67059     1760/67059     8503/44706    10753/67059    -4115/22353       374/7451   -2107/134118      -578/7451    -5534/67059]
[   -4922/22353    -2942/22353     -992/22353      -161/7451     2474/22353      1642/7451      2348/7451      797/22353     -2274/7451     3932/22353]
[   26875/67059   -21503/67059     5362/67059     8861/44706    -2827/67059     3593/22353      3561/7451 -150215/134118      2625/7451    -2686/67059]
[    3169/22353    -1085/22353     -533/22353    -3553/14902     4529/22353       717/7451       871/7451    -3515/44706       686/7451    -1042/22353]
[ -11681/134118    -515/134118    22175/67059    -7867/89412  -28135/134118    15311/44706    -6409/14902   36445/268236     -933/14902     3049/67059]
[    7339/67059     5077/67059     4204/67059     2987/44706    -1291/67059    -4495/22353      2011/7451  -35057/134118      2311/7451    -6208/67059]
[   -6131/22353    -5018/22353      481/22353      -305/7451     1910/22353      1352/7451     -3512/7451     5675/22353     -1346/7451    -5602/22353]
[    1663/22353     1321/22353    -3080/22353    -1841/14902    -2053/22353      1613/7451      1762/7451    -1901/44706      -691/7451    -1492/22353]
[   -4901/67059    -5291/67059     3808/67059      515/44706     1319/67059     -775/22353      -681/7451   71035/134118     -1657/7451     5096/67059]
[     1101/7451       319/7451       452/7451     -341/14902      -947/7451     -1223/7451      1237/7451    -3911/14902      -557/7451      -710/7451]
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]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "_sage_input_4.py", line 10, in <module>
    exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("IyByYW5kb23tlZwg7Jyg66as7IiYIOybkOyGjOuhnCDsnbTro6jslrTsp4QgMTB4MTAg7ZaJ66CsIOyDneyEsQpBID0gcmFuZG9tX21hdHJpeChRUSwgMTAsIDEwKQpwcmludCAicmFuZG9t7ZWY6rKMIOyDneyEse2VnCAxMHgxMCDtlonroKwiCnByaW50IEEKCiMg6rCA7Jet7ZaJ66Cs7J247KeAIO2ZleyduApwcmludCAiQS5pc19pbnZlcnRpYmxlIO2VqOyImCIKcHJpbnQgQS5pc19pbnZlcnRpYmxlKCkKCiMgZGV0KEEpCnByaW50ICJkZXQoQSkg7Jew7IKwIOqysOqzvCIKcHJpbnQgQS5kZXQoKQoKIyBHYXVzcy1Kb3JkYW4g7IaM6rGw67KVCnByaW50ICJHYXVzcy1Kb3JkYW4g7IaM6rGw67KVIgpwcmludCBBLnJyZWYoKQoKIyBHYXVzcyBKb3JkYW4g7IaM6rGw67KV7J2EIOydtOyaqe2VmOyXrCDsl63tlonroKwg7IOd7ISx7ZWY6riwIApJPWlkZW50aXR5X21hdHJpeCgxMCkKcHJpbnQgIkdhdXNzIEpvcmRhbiDshozqsbDrspXsnYQg7J207Jqp7ZWcIOyXre2WieugrCIKQz1BLmF1Z21lbnQoSSkucnJlZigpCnByaW50IEMKCgojIGRldChBKeqwgCAw7J20IOyVhOuLjCDqsr3smrAKaWYgQS5kZXQoKSAhPSAwOgogICAgIyDsl63tlonroKwg6rOE7IKwCiAgICBCID0gQS5pbnZlcnNlKCkKCiAgICBwcmludCAiQeydmCDsl63tlonroKwgQiIKICAgIHByaW50IEIKCiAgICBwcmludCAiQUIg7ZaJ66CsIOqzsSDsl7DsgrDqsrDqs7wiCiAgICBwcmludCBBKkIKCiAgICBwcmludCAiQkEg7ZaJ66CsIOqzsSDsl7DsgrDqsrDqs7wiCiAgICBwcmludCBCKkEKICAgIAogICAgI0nrpbwg7LKo6rCA7ZWo7Jy866Gc7I2oIOyDneyEse2VnCDsl63tlonroKzqs7wg7Jet7ZaJ66Cs7J2EIOu5hOq1kO2VtOuztOq4sAogICAgaWYgQz09SS5hdWdtZW50KEIpOgogICAgICAgIHByaW50ICdUcnVlJwogICAgCiAgICBlbHNlOgogICAgICAgIHByaW50ICdGYWxzZSc="),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in <module>
    
  File "/tmp/tmpQDCxMB/___code___.py", line 41, in <module>
    if C==I.augment(B):
  File "matrix_integer_dense.pyx", line 4489, in sage.matrix.matrix_integer_dense.Matrix_integer_dense.augment (sage/matrix/matrix_integer_dense.c:34956)
  File "matrix_rational_dense.pyx", line 1358, in sage.matrix.matrix_rational_dense.Matrix_rational_dense.change_ring (sage/matrix/matrix_rational_dense.c:14489)
TypeError: matrix has denominators so can't change to ZZ.