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/can't display the inverse of complex matrixhttps://ask.sagemath.org/question/47326/cant-display-the-inverse-of-complex-matrix/ Hi
it seems that Sagemath is able to calculate this matrix inverse, but it is unable to display it.
Maybe someone will explain me why ? it is not easy to find what I do wrong because there is no error message for n=8
an it's ok for n=4
#FFT
w=var('w')
n=8
FFT=matrix(SR,n,n)
#show (FFT)
for i in (0..n-1):
for j in (0..n-1):
FFT[i,j]=w^(i*j)
FFTc=1/sqrt(n) *FFT.subs(w=e^(2*I*pi/n))
#show(" FFTc : ",FFTc)
FFTc.change_ring(CC)
show(" FFTc.right_kernel().matrix() : ",FFTc.right_kernel().matrix())
show (" FFTc.determinant() for n =",str(n),": ",FFTc.determinant())
FFTcI=copy(FFTc).inverse()
#show (" FFT w :",FFT)
show (" FFTc with w=e^(2*I*pi/",str(n),") : ",FFTc)
show (" FFTc inverse with w=e^(2*I*pi/",str(n),") : ",FFTcI)
ortolljWed, 31 Jul 2019 18:19:16 +0200https://ask.sagemath.org/question/47326/eigenvectors of complex matrixhttps://ask.sagemath.org/question/29989/eigenvectors-of-complex-matrix/Hi!
I would like to find the complex eigenvectors of this matrix:
A=matrix(CDF,[[2-i,0,i],[0,1+i,0],[i,0,2-i]]).
I have used the command A.eigenvectors_right() and I get the following eigenvectors (rounded off):
(-0.70711+9.4136e-17i , 0 , 0.70711), (0,1,0), (0.70711 , 0 , 0.70711)
In my checklist I should get the vectors: t1*(-1,0,1), t2*(0,1,0), t3*(1,0,1), where the t-values are complex factors.
How do I compute this kind of result?
Sincerly SimonismonWed, 14 Oct 2015 09:11:18 +0200https://ask.sagemath.org/question/29989/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/