Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
18954: doctest special values of trig. functions with arguments (m/n)*pi
Browse files Browse the repository at this point in the history
  • Loading branch information
rwst committed Sep 14, 2015
1 parent 559f73b commit e7ce7ce
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/sage/functions/trig.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,43 @@ def __init__(self):
sage: sin(complex(1,1)) # rel tol 1e-15
(1.2984575814159773+0.6349639147847361j)
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(3) + sqrt(2) - 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
"""
GinacFunction.__init__(self, "sin", latex_name=r"\sin",
conversions=dict(maxima='sin',mathematica='Sin'))
Expand Down

0 comments on commit e7ce7ce

Please sign in to comment.