The problem is indeed the use of Maxima, through the evil Symbolic Ring
. If you look at its source code:
sage: A = Matrix(CDF, [[1,2,3],[3,2,0],[1,2,1]])
sage: C = I*A
sage: C.exp??
You will see that it always use Maxima, even if you replace CDF
by RDF
, RR
, QQ
or ZZ
. The reason is that all those C
are matrices are defined over the the Symbolic Ring
, because of the coercion with the number I
which is unfortunately symbolic by default:
sage: A.parent()
Full MatrixSpace of 3 by 3 dense matrices over Complex Double Field
sage: C.parent()
Full MatrixSpace of 3 by 3 dense matrices over Symbolic Ring
So if you want to take the benefits of scipy
, you should put C
back into a good ring:
sage: D = C.change_ring(CDF)
sage: D.exp()
[ 0.651747342998 - 1.54379760025*I -0.732155536636 - 0.455927080561*I 0.599292752801 + 1.47303558858*I]
[ 0.174911238362 + 0.933804036222*I 1.13443260356 - 0.693298035819*I -1.27314454332 - 1.61769465706*I]
[ -0.648998777944 - 0.58745124185*I -0.166313517385 + 0.263048322578*I 1.50051037188 - 0.465334495539*I]
You can use A = Matrix(CDF,[[1,2,3.],[3,2,0],[1,2,1]]); (CDF(I)*A).exp()