#22823 closed defect (fixed)
Symbolic asin/acos do not return symbolic NaN
Reported by: | rws | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.0 |
Component: | calculus | Keywords: | |
Cc: | Merged in: | ||
Authors: | Ralf Stephan | Reviewers: | Travis Scrimshaw |
Report Upstream: | N/A | Work issues: | |
Branch: | e802bf8 (Commits, GitHub, GitLab) | Commit: | |
Dependencies: | #22838 | Stopgaps: |
Description (last modified by )
sage: acos(SR(2.)) NaN sage: type(acos(SR(2.))) <type 'sage.symbolic.expression.Expression'> sage: type(acos(SR(2.)).pyobject()) <type 'sage.rings.real_mpfr.RealNumber'>
Expected would be:
sage: type(acos(SR(2.))) <type 'sage.symbolic.expression.Expression'> sage: type(acos(SR(2.)).pyobject()) <class 'sage.symbolic.constants.NotANumber'>
Same applies to asin
. Compare with:
sage: type(asec(0)) <type 'sage.symbolic.expression.Expression'> sage: type(asec(0).pyobject()) <class 'sage.symbolic.constants.NotANumber'>
Change History (15)
comment:1 follow-up: ↓ 4 Changed 5 years ago by
comment:2 Changed 5 years ago by
- Branch set to u/rws/symbolic_asin_acos_do_not_return_nan_where_possible
comment:3 Changed 5 years ago by
- Commit set to 7ccd5abded9b1451ac82764a49232e1d9300a7a0
- Dependencies set to pynac-0.7.6
comment:4 in reply to: ↑ 1 Changed 5 years ago by
Replying to mforets:
ValueError: point 2 is not in the domainto say that the result here is more informative than NaN, although i suppose that the notion of domain is a feature not implemented for symbolic functions?..
We're far away from that unfortunately.
comment:5 Changed 5 years ago by
Whoah. Are you then saying we also shouldn't allow log(-1)
? After all:
sage: acos(CC(2)) 1.31695789692482*I
I'm not cool with all of a sudden assuming symbolic things couldn't be complex, unless we are very consistent about this everywhere, and I suspect this would break a lot of stuff. Your example with arc secant is a red herring, because
sage: asec(CC(0)) NaN
At the very least this sort of thing should be discussed on sage-devel, in my view.
comment:6 follow-up: ↓ 9 Changed 5 years ago by
Well then, scratch the acos(2) part, the acos(SR(2.1)) part certainly needs fixing. Thanks for the review.
comment:7 Changed 5 years ago by
- Description modified (diff)
- Summary changed from Symbolic asin/acos do not return NaN where possible to Symbolic asin/acos do not return symbolic NaN
comment:8 Changed 5 years ago by
- Branch changed from u/rws/symbolic_asin_acos_do_not_return_nan_where_possible to u/rws/22823
comment:9 in reply to: ↑ 6 Changed 5 years ago by
- Commit changed from 7ccd5abded9b1451ac82764a49232e1d9300a7a0 to e802bf8ff797927fad10b6e5cf952d9ba8a5035a
Well then, scratch the acos(2) part, the acos(SR(2.1)) part certainly needs fixing. Thanks for the review.
I'm not saying we couldn't do that, but we would definitely need discussion on it and you are right that things should be consistent. My guess is that making things consistent with your idea might lead to a lot of work being needed as well as other stuff breaking, but I am not an expert in numerics either.
New commits:
e802bf8 | 22823: Symbolic asin/acos do not return symbolic NaN
|
comment:10 Changed 5 years ago by
- Dependencies changed from pynac-0.7.6 to #22838
- Status changed from new to needs_review
comment:11 follow-up: ↓ 12 Changed 5 years ago by
@kcrisman, are you okay with the current branch getting a positive review and then pushing the other issues to another ticket? The other thing we could do is move the doctests into another ticket.
comment:12 in reply to: ↑ 11 Changed 5 years ago by
@kcrisman, are you okay with the current branch getting a positive review and then pushing the other issues to another ticket? The other thing we could do is move the doctests into another ticket.
Sure, that is no problem at all, assuming all is working fine.
comment:13 Changed 5 years ago by
- Reviewers set to Travis Scrimshaw
- Status changed from needs_review to positive_review
Thanks.
comment:14 Changed 4 years ago by
- Branch changed from u/rws/22823 to e802bf8ff797927fad10b6e5cf952d9ba8a5035a
- Resolution set to fixed
- Status changed from positive_review to closed
comment:15 Changed 4 years ago by
- Commit e802bf8ff797927fad10b6e5cf952d9ba8a5035a deleted
Reverted in pynac-0.7.17. Reason would be consistency with #24428.
with a custom function this happens:
to say that the result here is more informative than NaN, although i suppose that the notion of domain is a feature not implemented for symbolic functions?..