[SciPy-user] do complex numbers default to double precision?

Robert Kern rkern at ucsd.edu
Thu Jun 30 08:02:58 CDT 2005

Ryan Krauss wrote:
> I have a matrix that is a function of a complex valued input.  I am 
> trying to find that value of that input that drives the determinant of 
> the matrix to zero.  I am searching for this value using fmin. The error 
> I am trying to minimize is the abs(det(complex matrix)).  I don't seem 
> to be able to drive this error lower that roughly 9e-17, regardless of 
> the values for ftol and xtol I use.
> Am I hitting some internal limitation?  Are complex values by default 
> single or double precision?

Python complexes are double precision. Numeric can do both (Complex32 
and Complex64), but defaults to double precision.

For double precision, eps (the smallest number that can be added to 1.0 
and return a number greater than 1.0) is 2.**-52 or 2.22e-16. Anything 
smaller than eps, scaled by some constant related to the problem like 
norm(A, inf), can usually be considered to zero. If you actually need to 
make distinctions smaller than that, you need to use something better 
than double precision. Nothing in Scipy does that, yet.

Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

More information about the SciPy-user mailing list