Steps To Reproduce
import numpy as np
a = np.zeros((5, 5), dtype="complex")
np.fill_diagonal(a, 1)
x = var("x")
b = x * a
c = matrix(b)
c.inverse()
Expected Behavior
The inverse should be returned successfully.
[1/x 0 0 0 0]
[0 1/x 0 0 0]
[0 0 1/x 0 0]
[0 0 0 1/x 0]
[0 0 0 0 1/x]
Actual Behavior
Instead, Sage raises
RuntimeError: ECL says: THROW: The catch MACSYMA-QUIT is undefined.
During handling of the above exception, another exception occurred:
TypeError: ECL says: THROW: The catch MACSYMA-QUIT is undefined.
Full traceback
Paste the complete traceback here.
Additional Information
Working Alternative
Converting the NumPy array to a Sage matrix before symbolic multiplication avoids the problem.
import numpy as np
a = np.zeros((5, 5), dtype="complex")
np.fill_diagonal(a, 1)
x = var("x")
b = matrix(a)
c = x * b
c.inverse()
Output
[1/x 0 0 0 0]
[0 1/x 0 0 0]
[0 0 1/x 0 0]
[0 0 0 1/x 0]
[0 0 0 0 1/x]
Observations
The only difference is the order of operations.
Fails
Works
This suggests the failure occurs while converting a symbolic NumPy complex array into a Sage matrix.
Possible Cause
NumPy represents the imaginary unit using Python's 1j, whereas Sage represents it as I.
When a symbolic NumPy complex array is converted into a Sage matrix, Maxima appears unable to interpret the mixed representation correctly, eventually leading to the MACSYMA-QUIT error during symbolic inversion.
Environment
- OS: Ubuntu 22.04
- Sage Version: 9.2 – 10.10.beta6
- Python: 3.x
Related Discussion
https://ask.sagemath.org/question/56850/issue-with-inversion-of-complex-symbolic-array-initialized
Steps To Reproduce
Expected Behavior
The inverse should be returned successfully.
Actual Behavior
Instead, Sage raises
Full traceback
Additional Information
Working Alternative
Converting the NumPy array to a Sage matrix before symbolic multiplication avoids the problem.
Output
Observations
The only difference is the order of operations.
Fails
Works
This suggests the failure occurs while converting a symbolic NumPy complex array into a Sage matrix.
Possible Cause
NumPy represents the imaginary unit using Python's
1j, whereas Sage represents it asI.When a symbolic NumPy complex array is converted into a Sage matrix, Maxima appears unable to interpret the mixed representation correctly, eventually leading to the
MACSYMA-QUITerror during symbolic inversion.Environment
Related Discussion
https://ask.sagemath.org/question/56850/issue-with-inversion-of-complex-symbolic-array-initialized