-
Couldn't load subscription status.
- Fork 38
fix acsch, acosh and typo #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
When the imaginary part of the result of this.acos() is greater than zero and the value is small, the conditional branch may fail. For example, the value of |
|
That's a nice finding! Thanks a lot! Could you please add test cases for this to be covered? |
|
and does acot needs to replace atan2(1,a) with atan(1/a) when b==0 according to definition of Inverse Cotangent in Wolfram MathWorld? |
|
|
|
but atan2(1, a) will return a positive number when a<0 which is different from atan(1/a) |
|
Thanks! I still believe For (real (a)): Let (\theta={atan2}(1,a)\in(0,\pi)). Then so This gives the expected range ({acot}(a)\in(0,\pi)). Relation to For (a<0), Bottom line: |
|
but it will creates discontinuity near negative real number |
|
Thanks for the example. The “discontinuity near the negative real number” you’re seeing is actually a consequence of the branch choice for What this library does (by design):
With that choice, there is an unavoidable jump by π along the negative real axis. Your three examples are exactly what we expect: new Complex(-1, 1e-15).acot() // ≈ -π/4 - i·0
new Complex(-1, 0).acot() // = 3π/4 (by the (0, π) real-range)
new Complex(-1, -1e-15).acot() // ≈ -π/4 + i·0Approaching This is also why, in the real-only fallback, using If you prefer continuity off the real axis around negatives, that’s a valid alternative, but it means adopting the other convention (((-π/2, π/2]) on ℝ) and updating expectations/tests accordingly. In other words, it’s a policy change, not a one-line fix. I’m happy to add a note to the docs spelling this out, so this behavior is explicit. |
|
Thank you so much for your patient explaination. When I first started using this library, I assumed it would handle complex numbers more continuously. I just searched for discussions about the principal branch of arccot(z) and found that it isn't strictly defined. Now, let's talk about this PR. I'm sorry I'm not familiar with test cases. Do you think I need to add any more test cases? |
No description provided.