I have a complex 2X2 matrix for which I'd like to calculate the determinant. mpmath's det function gives a determinant of zero even though the matrix is non-singular.
We can get the correct value by multiplying term-by-term. Consider the code:
#========================
from __future__ import division
import numpy as np
import mpmath
m3 = np.matrix([[ 5.18895807e-12 +0.00000000e+00j,
1.92716917e+11 +0.00000000e+00j],
[ 0.00000000e+00 -1.93643371e-11j,
0.00000000e+00 -5.16413237e+10j]])
m = mpmath.matrix(m3)
print np.linalg.det(m3)
print mpmath.det(m)
print m[0,0]*m[1,1]- m[1,0]*m[0,1]
#========================
The output is :
3.4638706823j
0
(0.0 + 3.46387068230212j)
mpmath's det function gives a determinant of zero even though the matrix is non-singular. We get the correct value by multiplying term-by-term. This happens for any value of the precision.
Can somebody confirm this bug?
I have made a bug report (Issue#229).
Thank you.
Regards,
Sameer