1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

掃き出し法(sympyで)Numerical Evaluation

Posted at

(参考)[初投稿]質問・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]])

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?