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

doctest special values of trig. functions with arguments (m/n)*pi #18954

Closed
rwst opened this issue Jul 26, 2015 · 14 comments
Closed

doctest special values of trig. functions with arguments (m/n)*pi #18954

rwst opened this issue Jul 26, 2015 · 14 comments

Comments

@rwst
Copy link

rwst commented Jul 26, 2015

Sage immediately returns exact expressions for trig. functions with argument a multiple of pi/3, pi/4, pi/6 and some of pi/5 because they are just square roots. The other values of e.g. sin(n*pi/5) are quite simple too, but they are roots of 4-degree so they were not added.

sage: sin(3*pi/4)
1/2*sqrt(2)
sage: sec(3*pi/5)
-4/(sqrt(5) - 1)
sage: cos(3*pi/5)
-1/4*sqrt(5) + 1/4
sage: sin(3*pi/5)
sin(3/5*pi)
sage: tan(3*pi/5)
tan(3/5*pi)
sage: cot(3*pi/5)
cot(3/5*pi)
sage: cos(pi/6)
1/2*sqrt(3)

However, people expect this so they should be added.

Depends on #18980

Component: symbolics

Author: Ralf Stephan

Branch/Commit: e7ce7ce

Reviewer: Vincent Delecroix

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

@rwst rwst added this to the sage-6.8 milestone Jul 26, 2015
@rwst

This comment has been minimized.

@rwst
Copy link
Author

rwst commented Jul 27, 2015

Dependencies: pynac-0.4.3

@rwst
Copy link
Author

rwst commented Jul 27, 2015

comment:2

New code in Pynac does the following:

sage: sin(pi/5)
1/4*sqrt(-2*sqrt(5) + 10)
sage: sin(pi/8)
1/2*sqrt(-sqrt(2) + 2)
sage: sin(pi/24)
1/4*sqrt(-2*sqrt(6) - 2*sqrt(2) + 8)
sage: sin(pi/30)
-1/8*sqrt(5) + 1/4*sqrt(-3/2*sqrt(5) + 15/2) - 1/8
sage: cos(pi/8)
1/2*sqrt(sqrt(2) + 2)
sage: cos(pi/10)
1/2*sqrt(1/2*sqrt(5) + 5/2)
sage: cos(pi/12)
1/12*sqrt(6)*(sqrt(3) + 3)
sage: cos(pi/15)
1/8*sqrt(5) + 1/4*sqrt(3/2*sqrt(5) + 15/2) - 1/8
sage: cos(pi/24)
1/4*sqrt(2*sqrt(6) + 2*sqrt(2) + 8)
sage: tan(pi/5)
sqrt(-2*sqrt(5) + 5)
sage: tan(pi/8)
sqrt(2) - 1
sage: tan(pi/10)
sqrt(-2/5*sqrt(5) + 1)
sage: tan(pi/16)
-sqrt(2) + sqrt(2*sqrt(2) + 4) - 1
sage: tan(pi/20)
sqrt(5) - 1/2*sqrt(8*sqrt(5) + 20) + 1
sage: tan(pi/24)
sqrt(6) - sqrt(-2*sqrt(6) + 5) - 2

sage: all(sin(rat*pi).n(200)-sin(rat*pi,hold=True).n(200) < 1e-30 for rat in [1/5,2/5,1/30,7/30,11/30,13/30,1/8,3/8,1/24,5/24,7/24,11/24])
True
sage: all(cos(rat*pi).n(200)-cos(rat*pi,hold=True).n(200) < 1e-30 for rat in [1/10,3/10,1/12,5/12,1/15,2/15,4/15,7/15,1/8,3/8,1/24,5/24,11/24])
True
sage: all(tan(rat*pi).n(200)-tan(rat*pi,hold=True).n(200) < 1e-30 for rat in [1/5,2/5,1/10,3/10,1/20,3/20,7/20,9/20,1/8,3/8,1/16,3/16,5/16,7/16,1/24,5/24,7/24,11/24])
True

This ticket should merge them as doctests.

@rwst
Copy link
Author

rwst commented Jul 27, 2015

Upstream: Fixed upstream, but not in a stable release.

@rwst rwst changed the title special values of trig. functions with arguments n*pi/5 special values of trig. functions with arguments (m/n)*pi Jul 28, 2015
@videlec
Copy link
Contributor

videlec commented Sep 13, 2015

comment:4

This is fine with #18980. Could you add doctests for them

sage: sin(pi/5)
1/4*sqrt(-2*sqrt(5) + 10)
sage: sin(2*pi/5)
1/4*sqrt(2*sqrt(5) + 10)

@rwst
Copy link
Author

rwst commented Sep 14, 2015

@rwst
Copy link
Author

rwst commented Sep 14, 2015

Author: Ralf Stephan

@rwst
Copy link
Author

rwst commented Sep 14, 2015

Commit: e7ce7ce

@rwst
Copy link
Author

rwst commented Sep 14, 2015

New commits:

e7ce7ce18954: doctest special values of trig. functions with arguments (m/n)*pi

@rwst
Copy link
Author

rwst commented Sep 14, 2015

Changed upstream from Fixed upstream, but not in a stable release. to none

@rwst
Copy link
Author

rwst commented Sep 14, 2015

Changed dependencies from pynac-0.4.3 to #18980

@rwst rwst changed the title special values of trig. functions with arguments (m/n)*pi doctest special values of trig. functions with arguments (m/n)*pi Sep 14, 2015
@rwst rwst modified the milestones: sage-6.8, sage-6.9 Sep 14, 2015
@videlec
Copy link
Contributor

videlec commented Sep 14, 2015

Reviewer: Vincent Delecroix

@videlec
Copy link
Contributor

videlec commented Sep 14, 2015

comment:7

The patchbot is not happy because it is not able to apply #18980. But it is fine for me.

@vbraun
Copy link
Member

vbraun commented Sep 15, 2015

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