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/symbolic 2x2 block matrix inversionhttps://ask.sagemath.org/question/10799/symbolic-2x2-block-matrix-inversion/Is it possible in SAGE to get the 2x2 block matrix inversion described in [Wikipedia](https://en.wikipedia.org/wiki/Block_matrix_pseudoinverse#Block_matrix_inversion)?
I looked at [this question](http://ask.sagemath.org/question/3245/determinant-of-block-matrices) about the determinant of block matrices, and at [this question](http://ask.sagemath.org/question/505/symbolic-matrices) about symbolic matrices, and tried the following code on the [cloud](http://www.sagenb.org/):
A = matrix(SR, 2, 2, 'a1 a2 a3 a4'.split(' '))
B = matrix(SR, 2, 2, 'b1 b2 b3 b4'.split(' '))
C = matrix(SR, 2, 2, 'c1 c2 c3 c4'.split(' '))
D = matrix(SR, 2, 2, 'd1 d2 d3 d4'.split(' '))
M = block_matrix(SR, 2, 2, [A, B, C, D])
Mi = M.inverse()
Mi.simplify_rational()
But it doesn't seem to be able to exactly reproduce the Wikipedia formula (it returns a horrible formula full of a1, a2, etc). Any idea?timflutreTue, 03 Dec 2013 17:05:46 +0100https://ask.sagemath.org/question/10799/evaluating inverse erfhttps://ask.sagemath.org/question/8118/evaluating-inverse-erf/Hi - The code below results in an expression, y, involving the inverse erf function i.e. exp(sqrt(2) inverse_erf(1/2)) which is approximately 1.96 according to another mathematical package. I tried to get a numerical value for y using y.n() but that crashes. Can anyone please advise how to evaluate such symbolic expressions?
var('z,t')
PDF = exp(-x^2 /2)/sqrt(2*pi)
integralExpr = integrate(PDF,x,z,oo).subs(z==log(t))
y = solve(integralExpr==z,t)[0].rhs().subs(z==1/4)
yRossKWed, 18 May 2011 10:22:39 +0200https://ask.sagemath.org/question/8118/