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
- 参考書籍 : 改訂版チャート式基礎からの数学1+A
- 参考 : ラジアン - Wikipedia
- 参考 : Pythonで三角関数を計算(sin, cos, tan, arcsin, arccos, arctan) | note.nkmk.me
- 参考 : NumPyの数学関数・定数まとめ - DeepAge
- 参考 : http://programming-study.com/technology/python-print/
- 参考 : math – 数学に関する関数 - Python Module of the Week numpy の numpy.linspace関数を利用したndarrayを使ってみたけど、自分の今の知識ではうまく処理(or 消化)できなかった……。
- 参考 : 線形に等間隔な数列を生成するnumpy.linspace関数の使い方 - DeepAge
- 参考 : NumPy 配列の基礎 — 機械学習の Python との出会い
- 参考 : Pythonのリストと配列とnumpy.ndarrayの違いと使い分け | note.nkmk.me
- 参考 : numpy と matplotlib で三角関数をグラフで表示 - Qiita