E
Edwin Young
Hi,
I think there might (emphasize might) be a minor bug in Python's cmath library.
Basically, Python says cmath.asin(0) = 0-0j (+0 real part, -0 imaginary part).
I think it should be 0+0j (+0 for both parts). The official formula is at
http://functions.wolfram.com/ElementaryFunctions/ArcSin/02/
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))
But Python's implementation in cmathmodule.c is essentially:
-(i * log(i*z + sqrt(1 - z*z)))
Which is basically the same as = (-0 - 1i) * log(i*z + sqrt(1 - z*z))
The only difference is +0 vs -0, which not many people will care
about, but I thought I'd mention it.
Regards,
I think there might (emphasize might) be a minor bug in Python's cmath library.
Basically, Python says cmath.asin(0) = 0-0j (+0 real part, -0 imaginary part).
I think it should be 0+0j (+0 for both parts). The official formula is at
http://functions.wolfram.com/ElementaryFunctions/ArcSin/02/
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))
But Python's implementation in cmathmodule.c is essentially:
-(i * log(i*z + sqrt(1 - z*z)))
Which is basically the same as = (-0 - 1i) * log(i*z + sqrt(1 - z*z))
The only difference is +0 vs -0, which not many people will care
about, but I thought I'd mention it.
Regards,