(参考)[初投稿]質問・python 掃き出し法
https://qiita.com/snq7amf522dvzpjbwshb/items/5c267d8286857eda9a71
(参考)Numerical Evaluation
https://docs.sympy.org/latest/modules/evalf.html
(参考)sympy matrix element (fraction--> float)? how to
https://stackoverflow.com/questions/61752705/sympy-matrix-element-fraction-float-how-to
pychramのsympyで
from sympy import *
print(Matrix([[3,1,1,2],[5,5,3,4],[2,0,6,2],[1,3,2,1]]).inv())
print(Matrix([[3,1,1,2],[5,5,3,4],[2,0,6,2],[1,3,2,1]]).inv().n(3))
# Matrix([[11/4, -7/4, -1/4, 2], [1/8, -1/8, -1/8, 1/2], [3/8, -3/8, 1/8, 1/2], [-31/8, 23/8, 3/8, -7/2]])
# Matrix([[2.75, -1.75, -0.250, 2.00], [0.125, -0.125, -0.125, 0.500], [0.375, -0.375, 0.125, 0.500], [-3.88, 2.88, 0.375, -3.50]])
SympyOnlineで
https://live.sympy.org/
(入力)
Matrix([[3,1,1,2],[5,5,3,4],[2,0,6,2],[1,3,2,1]]).inv().n(3)
print(Matrix([[3,1,1,2],[5,5,3,4],[2,0,6,2],[1,3,2,1]]).inv().n(3))
(結果)
省略
Matrix([[2.75, -1.75, -0.250, 2.00], [0.125, -0.125, -0.125, 0.500], [0.375, -0.375, 0.125, 0.500], [-3.88, 2.88, 0.375, -3.50]])