0
0

「sympyのfactor()」を調べた。

Posted at

DOC

factor() takes a polynomial and factors it into irreducible factors over the rational numbers. For example:
https://docs.sympy.org/latest/tutorials/intro-tutorial/simplification.html#factor

sympyの Matrix.inv()のfactor()

# ver0.1
from sympy import *

var('a,b,c,d',real=True)
A=Matrix([[a,b],[c,d]])
print("#",        A                )
print("#",        A.inv()          )
print("#", factor(A.inv())         ) 
# print("#",       (A.inv()).factor())  # エラーがでます。
# print("#",        A.inv() .factor())  # エラーがでます。
# Matrix([[a, b], [c, d]])
# Matrix([[d/(a*d - b*c), -b/(a*d - b*c)], [-c/(a*d - b*c), a/(a*d - b*c)]])
# Matrix([[d/(a*d - b*c), -b/(a*d - b*c)], [-c/(a*d - b*c), a/(a*d - b*c)]])
# AttributeError: 'MutableDenseMatrix' object has no attribute 'factor'
# AttributeError: 'MutableDenseMatrix' object has no attribute 'factor'
0
0
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
0
0