imranal
imranal

Reputation: 656

Finding the inverse of a symbolic matrix with SymPy

I am trying to find the inverse of the following matrix

g  = Matrix([[r**2,0],[0,r**2*sin(theta)**2]])

where the respective terms are of type:

<class 'sympy.core.power.Pow'>
<class 'sympy.core.numbers.Zero'>
<class 'sympy.core.numbers.Zero'>
<class 'sympy.core.mul.Mul'>

When I try to execute the command

g.inv()

I get the following error message :

AttributeError: 'int' object has no attribute 'is_Rational'

I am receiving the matrix g as a function parameter. The weird part is that if I hardcode the matrix, I receive no error, and the correct inverse is calculated.

Upvotes: 0

Views: 2199

Answers (1)

imranal
imranal

Reputation: 656

This was answered by Francesco Bonazzi :

Get the latest development version of SymPy. This bug has been corrected.

Upvotes: 1

Related Questions