- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 559
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
asin(2.0) should not return NaN #15344
Comments
comment:5
This touches several issues. Maybe we should agree for now to get different results with a There are already other parts where complex is returned on float input, right. However changing the output of Now |
comment:6
Replying to @rwst:
Indeed,
To my mind, Sage is doing wrong here
I do not think that this is the real problem. As explained before,
The above binded functions should know about there domain, range, singularities, etc. |
comment:7
Replying to @videlec:
All nice but before even thinking about that this should be fixed:
Or provide custom formal sets representing the reals/complexes. |
comment:9
Please review #24443. |
comment:10
Replying to @rwst:
You did a double mistake here. In Sage
Next,
|
comment:11
Replying to @videlec:
What good does it to have that domain on a symbolic function versus having a formal real set domain? Having a domain affects not only FP evaluation but also normal immediate evaluation of symbolic argument, and only a formal domain has useful implications.
That shows that the documentation of |
comment:12
I don't even see the point of having |
comment:13
Replying to @rwst:
It is good because a formal real set has a lot of concrete implementations |
comment:14
Replying to @videlec:
I don't mind other symbolic domains that are subsets of the formal reals---again, what good is it to have a purely floating-point domain like |
comment:15
|
Currently, asin(2.0) returns NaN, whereas asin(CC(2.0)) returns the more expected value of 1.57079632679490 - 1.31695789692482*I (that's π/2 − acosh(2)·I).
I can understand the logic of not wanting to return a complex value for a real argument, but since sqrt(-1.0) already returns 1.0*I, there are already parts of Sage which break that logic.
Conversely, this convention of returning NaN causes many difficulties when plotting functions. For example, plot(imag(asin(x)),(x,0,3)) does not at all return what is expected. And, of course, plot(imag(asin(CC(x))),(x,0,3)) does not work, so one has to write plot(lambda t: imag(asin(CC(t))),(0,3)), which, in this simple example, might be a very minor inconvenience, but can become a great annoyance when dealing with more complicated situations.
The fact that Sage sometimes considers values as reals even though they were obtained by complex computations adds insult to injury:
(if asin(2) persists in returning NaN, then at least (1+I)*(1-I) should refrain from looking too much like an integer until it is explicitly coerced as such).
Component: symbolics
Keywords: functions
Issue created by migration from https://trac.sagemath.org/ticket/15344
The text was updated successfully, but these errors were encountered: