Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Issue with inversion of complex symbolic array initialized with numpy

Hello!

I am trying to invert a symbolic matrix that is initialized with a combination of numpy arrays and I get an error. Below i present a simple code that gives the error.

import numpy as np

a = np.zeros((5,5) , dtype = 'complex')
np.fill_diagonal(a,1)

b = var('x')*a

c = matrix(b)
c.inverse()

Gives the error:

ECL says: THROW: The catch MACSYMA-QUIT is undefined.

What I have noticed up until now is that the issue stems from the data type. When I try casting the numpy array to float before turning it into a matrix, it works. However, my actual code makes use of complex coefficients. I believe it might have to do with how the imaginary part is represented in SageMath in comparison to numpy. ( j vs I )

When I manually create the symbolic array with I for the imaginary part, the .inverse() has no issue.