Erik Max Francis <ma*@alcyone.com> writes:
Edwin Young wrote:
I think it should be 0+0j (+0 for both parts). The official formula is
at
http://functions.wolfram.com/Element...ons/ArcSin/02/
Well this is Mathematica's official formula ... :-).
Mathworld doesn't document how Mathematica works, it's a repository of
generic mathetical info. "Official" is the wrong word, but I don't
have a more authoritative reference to hand.
and is asin(z) = -i * log(i*z + sqrt(1 - z*z))
Which is slightly ambiguous. I read it as:
(+0 - 1i) * log(i*z + sqrt(1 - z*z))
How is the original equation amiguous?
It's not clear if the leading - sign affects the entire expression or
indicates that i is negative. Python's implementation uses the former
- I argue that the latter is more correct. The difference in result is
just whether you get +0 or -0.
I've also noticed that cmath.acos has the same issue, and that the
formula used for cmath.asinh is not quite accurate around 0 :
cmath.asinh(0) gives 4.44089e-16+0j, rather than 0 as expected.
Does anyone know the history of the cmath implementation? There are
some interesting formulas used for some of the trig functions and I'm
curious to know where they came from.
--
Edwin