#15344: asin(2.0) shound not return NaN
----------------------------+-----------------------------
Reporter: davidamadore | Owner:
Type: defect | Status: new
Priority: major | Milestone: sage-5.13
Component: numerical | Keywords: functions
Merged in: | Authors:
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
----------------------------+-----------------------------
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:
{{{
sage: N(asin((1+I)*(1-I)))
NaN
sage: asin((1.+1.*I)*(1.-1.*I))
1.57079632679490 - 1.31695789692482*I
}}}
(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).
--
Ticket URL: <http://trac.sagemath.org/ticket/15344>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.