Opened 3 years ago
Last modified 3 years ago
#24211 new defect
Some trivial identities and simplifications missed by Sage (pynac ?)
Reported by: | charpent | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-8.2 |
Component: | symbolics | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | #24262 | Stopgaps: |
Description (last modified by )
On 8.1.rc0. Consider :
sage: import sympy sage: [arcsin(t) for t in [0, 1/2, sqrt(2)/2, sqrt(3)/2, 1]] [0, 1/6*pi, arcsin(1/2*sqrt(2)), arcsin(1/2*sqrt(3)), 1/2*pi] sage: [maxima.asin(t).sage() for t in [0, 1/2, sqrt(2)/2, sqrt(3)/2, 1]] [0, 1/6*pi, 1/4*pi, 1/3*pi, 1/2*pi] sage: [sympy.asin(t)._sage_() for t in [0, 1/2, sqrt(2)/2, sqrt(3)/2, 1]] [0, 1/6*pi, 1/4*pi, 1/3*pi, 1/2*pi] sage: [arctan(t) for t in [0, 1/sqrt(3), 1, sqrt(3)]] [0, arctan(1/3*sqrt(3)), 1/4*pi, arctan(sqrt(3))] sage: [maxima.atan(t).sage() for t in [0, 1/sqrt(3), 1, sqrt(3)]] [0, 1/6*pi, 1/4*pi, 1/3*pi] sage: [sympy.atan(t)._sage_() for t in [0, 1/sqrt(3), 1, sqrt(3)]] [0, 1/6*pi, 1/4*pi, 1/3*pi]
[ Edit on 2017-11-23 ] In the same vein :
sage: [arccos(t) for t in [0, 1/2, sqrt(2)/2, sqrt(3)/2, 1]] [1/2*pi, 1/3*pi, arccos(1/2*sqrt(2)), arccos(1/2*sqrt(3)), 0] sage: [maxima.arccos(t).sage() for t in [0, 1/2, sqrt(2)/2, sqrt(3)/2, 1]] [1/2*pi, 1/3*pi, arccos(1/2*sqrt(2)), arccos(1/2*sqrt(3)), 0] sage: [sympy.acos(t)._sage_() for t in [0, 1/2, sqrt(2)/2, sqrt(3)/2, 1]] [1/2*pi, 1/3*pi, 1/4*pi, 1/6*pi, 0] sage: [arctan(t) for t in [0, 1/sqrt(3), 1, sqrt(3)]] [0, arctan(1/3*sqrt(3)), 1/4*pi, arctan(sqrt(3))] sage: [maxima.arctan(t).sage() for t in [0, 1/sqrt(3), 1, sqrt(3)]] [0, arctan(1/3*sqrt(3)), 1/4*pi, arctan(sqrt(3))] sage: [sympy.atan(t)._sage_() for t in [0, 1/sqrt(3), 1, sqrt(3)]] [0, 1/6*pi, 1/4*pi, 1/3*pi]
This is not a bug stricto sensu (the answers are not false), but is certainly a lack of functionality.
The absence of this problem when using sympy
or maxima
fingerpoints to pynac
.
Furthermore, arctan suffers from some lack of simplification:
sage: assume(-pi/2<x, x<pi/2) sage: arctan(tan(x)).simplify() # OK x sage: arctan(sin(x)/cos(x)).simplify() # should return x as above arctan(sin(x)/cos(x)) sage: arctan(sin(x)/cos(x)).simplify_full() arctan(sin(x)/cos(x))
arctan2 has the same issue:
sage: arctan2(sin(x), cos(x)).simplify_full() arctan2(sin(x), cos(x))
In those cases, the problem is *not* solved by recourse to pynac
...
Change History (9)
comment:1 follow-up: ↓ 2 Changed 3 years ago by
comment:2 in reply to: ↑ 1 ; follow-up: ↓ 3 Changed 3 years ago by
comment:3 in reply to: ↑ 2 ; follow-up: ↓ 5 Changed 3 years ago by
Replying to egourgoulhon:
Replying to rws:
Is
sin(x)/cos(x)
simplifiable for all x totan(x)
?I would say yes, see e.g.
Moreover, Sage assumes it is the case, without any assumption on x
:
sage: bool(tan(x) == sin(x)/cos(x)) True
comment:4 Changed 3 years ago by
- Summary changed from Sime trivial identities and simplifications missed by Sage (pynac ?) to Some trivial identities and simplifications missed by Sage (pynac ?)
comment:5 in reply to: ↑ 3 Changed 3 years ago by
Replying to egourgoulhon:
Moreover, Sage assumes it is the case, without any assumption on
x
:sage: bool(tan(x) == sin(x)/cos(x)) True
That comes from Maxima which simplifies tan(x)
to sin(x)/cos(x)
---but not vice versa, as the atan
cases show. It may be difficult to find sin(x)/cos(x)
in all expressions but I haven't looked further into it, and the simple cases should be implemented regardless.
comment:6 Changed 3 years ago by
- Dependencies set to pynac-0.7.13
- Milestone changed from sage-8.1 to sage-8.2
These doctest now work with Pynac master:
sage: [arcsin(t) for t in [0, 1/2, sqrt(2)/2, sqrt(3)/2, 1]] [0, 1/6*pi, 1/4*pi, 1/3*pi, 1/2*pi] sage: [arcsin(-t) for t in [0, 1/2, sqrt(2)/2, sqrt(3)/2, 1]] [0, -1/6*pi, -1/4*pi, -1/3*pi, -1/2*pi] sage: [arctan(t) for t in [0, 1/sqrt(3), 1, sqrt(3)]] [0, 1/6*pi, 1/4*pi, 1/3*pi] sage: [arctan(-t) for t in [0, 1/sqrt(3), 1, sqrt(3)]] [0, -1/6*pi, -1/4*pi, -1/3*pi]
comment:7 Changed 3 years ago by
- Dependencies changed from pynac-0.7.13 to #24262
comment:8 Changed 3 years ago by
comment:9 Changed 3 years ago by
- Description modified (diff)
Edit : added similar examples with arccos/arctan.
Is
sin(x)/cos(x)
simplifiable for all x totan(x)
?