学習環境
- Surface 3 (4G LTE)、Surface 3 タイプ カバー、Surface ペン(端末)
- Windows 10 Pro (OS)
- 数式入力ソフト(TeX, MathML): MathType
- MathML対応ブラウザ: Firefox、Safari
- MathML非対応ブラウザ(Internet Explorer, Google Chrome...)用JavaScript Library: MathJax
- Pythonからはじめる数学入門(参考書籍)
解析入門 原書第3版 (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第2部(微分と基本的な関数)、第4章(正弦と余弦)、1(正弦関数および余弦関数)、練習問題1-18.を取り組んでみる。
コード(Emacs)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from sympy import symbols, pi, sin, cos, solve, pprint
x = symbols('x')
for i, (a, b) in enumerate([(sin(pi - x), sin(x)),
(cos(pi - x), -cos(x)),
(sin(2 * pi - x), -sin(x)),
(sin(-x), -sin(x)),
(cos(-x), cos(x))],
13):
print('({0}) {1}'.format(i, a == b))
print('(18)')
a = symbols('a', real=True)
pprint(solve(sin(x) - sin(a), x, dict=True))
n = symbols('n', integer=True)
a = pi / 2
print(sin(a) == sin(a + 2 * n * pi))
a = -pi / 2
print(sin(a) == sin(a + 2 * n * pi))
入出力結果(Terminal, IPython)
$ ./sample1.py
(13) True
(14) True
(15) True
(16) True
(17) True
(18)
[{x: a}, {x: -asin(sin(a)) + π}]
True
True
$
0 コメント:
コメントを投稿