ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 28 Apr 2021 13:31:54 +0200Issue with inversion of complex symbolic array initialized with numpyhttps://ask.sagemath.org/question/56850/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.yorgos_sotWed, 28 Apr 2021 13:31:54 +0200https://ask.sagemath.org/question/56850/Problem with conjugate_transpose of a symbolic matrixhttps://ask.sagemath.org/question/10115/problem-with-conjugate_transpose-of-a-symbolic-matrix/ dAbar=diagAbar.subs(t=0);dAbar
[ 3.18953143618644*I*sech(x3) - 3.00000000000000 - 2.68953143618644*I
0 0]
[ 0
-3.18953143618644*I*sech(x3) - 3.00000000000000 + 2.68953143618644*I
0]
[ 0
0 -4]
TdiagAbar=dAbar.conjugate_transpose() + dAbar
Traceback (click to the left of this block for traceback)
...
AttributeError:
'sage.rings.complex_interval.ComplexIntervalFieldElement' object has no
attribute 'sech'
I hope their is an easy answer. Thanks, nonlinearDionysusSat, 11 May 2013 23:46:41 +0200https://ask.sagemath.org/question/10115/