(参考)Python:FEMでの疎行列計算の利用(3次元骨組構造解析での事例)>簡単な連立一次方程式を解いてみる(1)
https://qiita.com/damyarou/items/85c7902cc658d748115e
(参考)Sparse Matrices
http://docs.sympy.org/latest/modules/matrices/sparse.html
fullscript.py
from sympy import *
var("A B C")
A=Matrix(([ 1, 5, 0, 0, 0],
[ 0, 2, 8, 0, 0],
[ 0, 0, 3, 9, 0],
[ 0, 0, 0, 4, 10],
[ 0, 0, 0, 0, 5]))
B =Matrix(([1],[2],[3],[4],[5]))
C=A.inv() * B
print("C=[",float(C[0]),float(C[1]),float(C[2]),float(C[3]),float(C[4]),"]")
# C=[ 106.0 -21.0 5.5 -1.5 1.0 ]