slow-starter

なにをやるにもslow start……。

数学1A_003

pythonを使いつつ、数学1Aの基礎を復習

# coding: utf-8
import numpy as np

t = float('inf')

print('deg      rad      sin      cos       tan    ')
print('-------  -------  -------  --------  -------')

fmt = '  '.join(['%7.2f'] * 5)
for deg in range(0, 361, 30):
    rad = np.radians(deg)
    if deg in (90, 270):
        t = float('inf')
    else:
        t = np.tan(rad)
    print(fmt % (deg, rad, np.sin(rad), np.cos(rad), t))
# deg      rad      sin      cos       tan    
# -------  -------  -------  --------  -------
#    0.00     0.00     0.00     1.00     0.00
#   30.00     0.52     0.50     0.87     0.58
#   60.00     1.05     0.87     0.50     1.73
#   90.00     1.57     1.00     0.00      inf
#  120.00     2.09     0.87    -0.50    -1.73
#  150.00     2.62     0.50    -0.87    -0.58
#  180.00     3.14     0.00    -1.00    -0.00
#  210.00     3.67    -0.50    -0.87     0.58
#  240.00     4.19    -0.87    -0.50     1.73
#  270.00     4.71    -1.00    -0.00      inf
#  300.00     5.24    -0.87     0.50    -1.73
#  330.00     5.76    -0.50     0.87    -0.58
#  360.00     6.28    -0.00     1.00    -0.00