Skip to content
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

arc cosine surprising numeric results #20089

Closed
rwst opened this issue Feb 21, 2016 · 7 comments
Closed

arc cosine surprising numeric results #20089

rwst opened this issue Feb 21, 2016 · 7 comments

Comments

@rwst
Copy link

rwst commented Feb 21, 2016

Here under the hood, RR.acos gets called. I think this should return meaningful values even if the value is outside the domain.

sage: cos(1.*I)
1.54308063481524        <--- CC element
sage: acos(_)
1.00000000000000*I
sage: acos(1.54308063481524)
NaN
sage: acos(CC(1.54308063481524))
0.999999999999997*I
sage: acos(RR(1.54308063481524))
NaN

Neither SymPy nor Pari nor Maxima do this:

In [1]: acos(1.543)
Out[1]: 0.999931383282944⋅ⅈ
? acos(1.543)
%1 = 0.99993138328294395810833497263866793658*I
(%i1) acos(1.543);
(%o1)                        0.9999313832829438 %i

Component: symbolics

Issue created by migration from https://trac.sagemath.org/ticket/20089

@rwst rwst added this to the sage-7.1 milestone Feb 21, 2016
@rwst

This comment has been minimized.

@jdemeyer
Copy link

Replying to @rwst:

why are floats of type RR not CC?

Are you suggesting

sage: parent(1.0)
Complex Field with 53 bits of precision

@rwst
Copy link
Author

rwst commented Feb 21, 2016

comment:3

The alternative would be to return complex in RR.acos.

@rwst
Copy link
Author

rwst commented Feb 21, 2016

comment:4

It's also a symptom of inconsistency in symbolic/pynac.pyx where we call RR.function, i.e. mpfr but also mpmath directly. Do you have a preference? Maybe it's best to use mpmath throughout in pynac.pyx.

@rwst
Copy link
Author

rwst commented Mar 5, 2016

comment:5

I have come to a conclusion, and adapted the ticket description.

@rwst

This comment has been minimized.

@rwst
Copy link
Author

rwst commented Aug 3, 2016

comment:6

Ok, since this is at least consistent with arb behaviour I'll file this as oddity not bug. It would be interesting to know what the big Ms return.

@rwst rwst removed this from the sage-7.1 milestone Aug 3, 2016
@vbraun vbraun closed this as completed Jan 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants