On Fri, Aug 17, 2012 at 5:56 AM, Sameer Grover
<[email protected]> wrote:
> I have a complex 2X2 matrix for which I'd like to calculate the determinant.
> Consider the following code:
>
> #========================
> from __future__ import division
> import numpy as np
> import sympy.mpmath as 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.
>
> Can somebody confirm this bug?

Seems that I am getting the same as you are:

>>> from __future__ import division
>>> import numpy as np
>>> import sympy.mpmath as 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)
3.4638706823j
>>> print mpmath.det(m)
0
>>> print m[0,0]*m[1,1]- m[1,0]*m[0,1]
(0.0 + 3.46387068230212j)


I am using SymPy a35203f.

Ondrej

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to