0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

「三角関数表(正弦tan) 0°〜180°」をsympyで計算しました。

Last updated at Posted at 2023-11-15

・tan 15°...は、√の計算をします。
・私は、90°を超えるtan? を考えた事ありませんでした。180°を超える場合も。

Doc

The tangent function.
Returns the tangent of x (measured in radians).
https://docs.sympy.org/latest/modules/functions/elementary.html#sympy.functions.elementary.trigonometric.tan

sympyで(5°づつ。0°〜180°)

from sympy import *
pitch=5
for i in range(Integer(180/pitch)+1):
    j=pitch*i
    jstr=str(j).rjust(3, ' ')+"°"
    myStr=str(      tan(j*pi/180).simplify() )
    if  j==90:
        myFlt='zoo'
    else:     
        myFlt=str(float(tan(j*pi/180)))
    if  'pi' in myStr: 
         print("#",jstr,15*" ",'{:<47}'.format(myStr)+myFlt)
    else:      
         print("#",jstr       ,'{:<63}'.format(myStr)+myFlt)

#   0° 0                                                              0.0
#   5°                 tan(pi/36)                                     0.08748866352592401
#  10°                 tan(pi/18)                                     0.17632698070846498
#  15° 2 - sqrt(3)                                                    0.2679491924311227
#  20°                 tan(pi/9)                                      0.36397023426620234
#  25°                 tan(5*pi/36)                                   0.4663076581549986
#  30° sqrt(3)/3                                                      0.5773502691896257
#  35°                 tan(7*pi/36)                                   0.7002075382097098
#  40°                 tan(2*pi/9)                                    0.83909963117728
#  45° 1                                                              1.0
#  50°                 tan(5*pi/18)                                   1.19175359259421
#  55°                 tan(11*pi/36)                                  1.4281480067421146
#  60° sqrt(3)                                                        1.7320508075688772
#  65°                 tan(13*pi/36)                                  2.1445069205095586
#  70°                 tan(7*pi/18)                                   2.747477419454622
#  75° sqrt(3) + 2                                                    3.732050807568877
#  80°                 tan(4*pi/9)                                    5.671281819617709
#  85°                 tan(17*pi/36)                                  11.430052302761343
#  90° zoo                                                            zoo
#  95°                 -(cos(pi/18) + 1)/sin(pi/18)                   -11.430052302761343
# 100°                 -tan(4*pi/9)                                   -5.671281819617709
# 105° -2 - sqrt(3)                                                   -3.732050807568877
# 110°                 -1/tan(pi/9)                                   -2.747477419454622
# 115°                 -1/cos(2*pi/9) - tan(2*pi/9)                   -2.1445069205095586
# 120° -sqrt(3)                                                       -1.7320508075688772
# 125°                 -1/cos(pi/9) - tan(pi/9)                       -1.4281480067421146
# 130°                 -1/cos(pi/18) - tan(pi/18)                     -1.19175359259421
# 135° -1                                                             -1.0
# 140°                 -tan(2*pi/9)                                   -0.83909963117728
# 145°                 -tan(7*pi/36)                                  -0.7002075382097098
# 150° -sqrt(3)/3                                                     -0.5773502691896257
# 155°                 -tan(5*pi/36)                                  -0.4663076581549986
# 160°                 -tan(pi/9)                                     -0.36397023426620234
# 165° -2 + sqrt(3)                                                   -0.2679491924311227
# 170°                 -tan(pi/18)                                    -0.17632698070846498
# 175°                 -tan(pi/36)                                    -0.08748866352592401
# 180° 0                                                              0.0

sympyで(1°づつ。0°〜180°)

・√の出力の角度のみprint。

from sympy import *
pitch=1
for i in range(Integer(180/pitch)+1):
    j=pitch*i    
    jstr=str(j).rjust(3, ' ')+"°"
    myStr=str(tan(j*pi/180) )
    if  j==90:
        print("#",jstr,'zoo')
    elif  'pi' not in myStr: 
        print("#",jstr,  tan(j*pi/180).simplify())

#   0° 0
#   3° (-sqrt(15) - sqrt(10 - 2*sqrt(5)) - sqrt(3) + 8)/(-sqrt(5) - 1 + sqrt(6)*sqrt(5 - sqrt(5)))
#   6° (-9 + sqrt(5) + sqrt(6*sqrt(5) + 30))/(-sqrt(2)*sqrt(sqrt(5) + 5) - sqrt(3) + sqrt(15))
#   9° -sqrt(5)*sqrt(2*sqrt(5) + 10)/4 - sqrt(2*sqrt(5) + 10)/4 + 1 + sqrt(5)
#  12° (-sqrt(1 - 2*sqrt(5)/5) + sqrt(3)/3)/(sqrt(3)*sqrt(1 - 2*sqrt(5)/5)/3 + 1)
#  15° 2 - sqrt(3)
#  18° sqrt(25 - 10*sqrt(5))/5
#  21° (-8 - sqrt(3) + sqrt(2*sqrt(5) + 10) + sqrt(15))/(-sqrt(6)*sqrt(sqrt(5) + 5) - 1 + sqrt(5))
#  24° (-sqrt(5 - 2*sqrt(5)) + sqrt(3))/(1 + sqrt(3)*sqrt(5 - 2*sqrt(5)))
#  27° -sqrt(5)*sqrt(10 - 2*sqrt(5))/4 - 1 + sqrt(10 - 2*sqrt(5))/4 + sqrt(5)
#  30° sqrt(3)/3
#  33° (-sqrt(15) - sqrt(3) + sqrt(10 - 2*sqrt(5)) + 8)/(1 + sqrt(5) + sqrt(6)*sqrt(5 - sqrt(5)))
#  36° sqrt(5 - 2*sqrt(5))
#  39° (-sqrt(2*sqrt(5) + 10) - sqrt(3) + sqrt(15) + 8)/(-1 + sqrt(5) + sqrt(6)*sqrt(sqrt(5) + 5))
#  42° (-sqrt(30 - 6*sqrt(5)) + sqrt(5) + 9)/(sqrt(3) + sqrt(2)*sqrt(5 - sqrt(5)) + sqrt(15))
#  45° 1
#  48° -(sqrt(3) + sqrt(2*sqrt(5) + 5))/(-sqrt(3)*sqrt(2*sqrt(5) + 5) + 1)
#  51° (-sqrt(15) + sqrt(3) + sqrt(2*sqrt(5) + 10) + 8)/(-1 + sqrt(5) + sqrt(6)*sqrt(sqrt(5) + 5))
#  54° sqrt(10*sqrt(5) + 25)/5
#  57° (-sqrt(10 - 2*sqrt(5)) + sqrt(3) + sqrt(15) + 8)/(1 + sqrt(5) + sqrt(6)*sqrt(5 - sqrt(5)))
#  60° sqrt(3)
#  63° -1 - sqrt(10 - 2*sqrt(5))/4 + sqrt(5)*sqrt(10 - 2*sqrt(5))/4 + sqrt(5)
#  66° (-sqrt(5) + sqrt(6*sqrt(5) + 30) + 9)/(-sqrt(3) + sqrt(2)*sqrt(sqrt(5) + 5) + sqrt(15))
#  69° (-8 - sqrt(15) - sqrt(2*sqrt(5) + 10) + sqrt(3))/(-sqrt(6)*sqrt(sqrt(5) + 5) - 1 + sqrt(5))
#  72° sqrt(2*sqrt(5) + 5)
#  75° sqrt(3) + 2
#  78° (sqrt(5) + sqrt(30 - 6*sqrt(5)) + 9)/(-sqrt(2)*sqrt(5 - sqrt(5)) + sqrt(3) + sqrt(15))
#  81° sqrt(2*sqrt(5) + 10)/4 + 1 + sqrt(5)*sqrt(2*sqrt(5) + 10)/4 + sqrt(5)
#  84° (sqrt(3)/3 + sqrt(2*sqrt(5)/5 + 1))/(-sqrt(3)*sqrt(2*sqrt(5)/5 + 1)/3 + 1)
#  87° (sqrt(3) + sqrt(10 - 2*sqrt(5)) + sqrt(15) + 8)/(-sqrt(5) - 1 + sqrt(6)*sqrt(5 - sqrt(5)))
#  90° zoo
#  93° (sqrt(10 - 2*sqrt(5)) + sqrt(3)*(1 + sqrt(5)) + 8)/(-sqrt(6)*sqrt(5 - sqrt(5)) + 1 + sqrt(5))
#  96° (sqrt(5 - 2*sqrt(5)) + sqrt(3))/(-sqrt(3)*sqrt(5 - 2*sqrt(5)) + 1)
#  99° -sqrt(5) - sqrt(5)*sqrt(2*sqrt(5) + 10)/4 - 1 - sqrt(2*sqrt(5) + 10)/4
# 102° (-9 - sqrt(30 - 6*sqrt(5)) - sqrt(5))/(-sqrt(2)*sqrt(5 - sqrt(5)) + sqrt(3) + sqrt(15))
# 105° -2 - sqrt(3)
# 108° -sqrt(2*sqrt(5) + 5)
# 111° (-sqrt(3) + sqrt(2*sqrt(5) + 10) + sqrt(15) + 8)/(-sqrt(6)*sqrt(sqrt(5) + 5) - 1 + sqrt(5))
# 114° (-9 - sqrt(6*sqrt(5) + 30) + sqrt(5))/(-sqrt(3) + sqrt(2)*sqrt(sqrt(5) + 5) + sqrt(15))
# 117° -sqrt(5) - sqrt(5)*sqrt(10 - 2*sqrt(5))/4 + sqrt(10 - 2*sqrt(5))/4 + 1
# 120° -sqrt(3)
# 123° (-8 - sqrt(15) - sqrt(3) + sqrt(10 - 2*sqrt(5)))/(1 + sqrt(5) + sqrt(6)*sqrt(5 - sqrt(5)))
# 126° -sqrt(10*sqrt(5) + 25)/5
# 129° (-8 - sqrt(2*sqrt(5) + 10) - sqrt(3) + sqrt(15))/(-1 + sqrt(5) + sqrt(6)*sqrt(sqrt(5) + 5))
# 132° -(sqrt(1 - 2*sqrt(5)/5) + sqrt(3)/3)/(-sqrt(3)*sqrt(1 - 2*sqrt(5)/5)/3 + 1)
# 135° -1
# 138° (-9 - sqrt(5) + sqrt(30 - 6*sqrt(5)))/(sqrt(3) + sqrt(2)*sqrt(5 - sqrt(5)) + sqrt(15))
# 141° (-8 - sqrt(15) + sqrt(3) + sqrt(2*sqrt(5) + 10))/(-1 + sqrt(5) + sqrt(6)*sqrt(sqrt(5) + 5))
# 144° -sqrt(5 - 2*sqrt(5))
# 147° (-8 - sqrt(10 - 2*sqrt(5)) + sqrt(3) + sqrt(15))/(1 + sqrt(5) + sqrt(6)*sqrt(5 - sqrt(5)))
# 150° -sqrt(3)/3
# 153° -sqrt(5) - sqrt(10 - 2*sqrt(5))/4 + 1 + sqrt(5)*sqrt(10 - 2*sqrt(5))/4
# 156° (-sqrt(2*sqrt(5)/5 + 1) + sqrt(3)/3)/(sqrt(3)*sqrt(2*sqrt(5)/5 + 1)/3 + 1)
# 159° (-sqrt(15) - sqrt(2*sqrt(5) + 10) + sqrt(3) + 8)/(-sqrt(6)*sqrt(sqrt(5) + 5) - 1 + sqrt(5))
# 162° -sqrt(25 - 10*sqrt(5))/5
# 165° -2 + sqrt(3)
# 168° (-sqrt(2*sqrt(5) + 5) + sqrt(3))/(1 + sqrt(3)*sqrt(2*sqrt(5) + 5))
# 171° -sqrt(5) - 1 + sqrt(2*sqrt(5) + 10)/4 + sqrt(5)*sqrt(2*sqrt(5) + 10)/4
# 174° (-sqrt(6*sqrt(5) + 30) - sqrt(5) + 9)/(-sqrt(2)*sqrt(sqrt(5) + 5) - sqrt(3) + sqrt(15))
# 177° (-8 + sqrt(3) + sqrt(10 - 2*sqrt(5)) + sqrt(15))/(-sqrt(5) - 1 + sqrt(6)*sqrt(5 - sqrt(5)))
# 180° 0

参考

>Important Angles
勉強中

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?