[Matrix-SIG] umath bug => bug in Numeric module
Konrad Hinsen
hinsen@cnrs-orleans.fr
Fri, 13 Nov 1998 16:11:51 +0100
> umath.arcsin(3) gives 'ValueError: math domain error'
> I would expect a complex number.
Try:
>>> umath.arcsin(3.+0j)
(1.57079632679-1.76274717404j)
The philosophy of all umath functions is to return complex values
only for complex arguments. The reason is that in many circumstances
only real numbers should be used and arguments leading to complex
results should be considered an error. You will also notice
that "sqrt(-1)" is an error, you need to write "sqrt(-1+0j)" to
get the result 1j.
> The corresponding functions in math module work correctly.
The module math does not handle complex numbers at all, and
math.asin(3) raises a math domain error. I suppose you mean
cmath, which is a specialized module for complex math.
--
-------------------------------------------------------------------------------
Konrad Hinsen | E-Mail: hinsen@cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron | Fax: +33-2.38.63.15.17
45071 Orleans Cedex 2 | Deutsch/Esperanto/English/
France | Nederlands/Francais
-------------------------------------------------------------------------------