Как округлить матричные элементы в sympy?
from sympy import *
from mpmath import *
A=Matrix([[5,4,1],
[4,6,4],
[1,4,5]])
print(A)
print(type(A.evalf(3)))
B=sqrtm(A)
print(B)
print(type(B))
print(B.evalf(3))
вывод -----------------------------------------------------------------------------------
Matrix([[5, 4, 1], [4, 6, 4], [1, 4, 5]])
<class 'sympy.matrices.dense.MutableDenseMatrix'>
Traceback (most recent call last):
File "C:/Users/xxx/.PyCharmCE2018.2/config/scratches/scratch_9.py", line 11, in <module>
print(B.evalf(3))
AttributeError: 'matrix' object has no attribute 'evalf'
[ 2.0 1.0 3.33606965638267e-20]
[ 1.0 2.0 1.0]
[3.34095591577049e-20 1.0 2.0]
<class 'mpmath.matrices.matrices.matrix'>
Хочу --------------------------------------------------------------------------------------
[2.000 1.000 0.000]
[1.000 2.000 1.000]
[0.000 1.000 2.000]
Заранее спасибо и извините за плохой английский!