学習環境
- Surface、Surface ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro 10.5 + Apple Pencil
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
解析入門(上) (松坂和夫 数学入門シリーズ 4) (松坂 和夫(著)、岩波書店)の第5章(各種の初等関数)、5.4(三角関数(続き)、逆三角関数)、問題1の解答を求めてみる。
コード
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols, sqrt, sin, cos, pi, atan, Limit, plot
print('1.')
a, b = symbols('a, b', nonzero=True)
n = symbols('n', integer=True)
x = symbols('x', real=True)
fs = [(sin(b * x) / sin(a * x), 0),
((x - n * pi) ** 2 / sin(x) ** 2, 0),
(atan(x) / x, 0),
((x - n * pi) ** 2 / sin(x) ** 2, n * pi)]
for i, (f, x0) in enumerate(fs, 1):
print(f'({i})')
for d in ['-', '+']:
l = Limit(f, x, x0, dir=d)
for o in [l, l.doit()]:
pprint(o)
print()
fs = [sin(1 * x) / sin(2 * x),
(1 - cos(x)) / x ** 2,
atan(x) / x,
(x - 2 * pi) ** 2 / sin(x) ** 2]
p = plot(*[(f, (x, -1, -0.1)) for f in fs],
*[(f, (x, 0.1, 1)) for f in fs],
ylim=(0.5, 1.5),
show=False,
legend=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']
for t in zip(fs, colors):
pprint(t)
print()
for o, color in zip(p, colors):
o.line_color = color
p.show()
p.save('sample1.png')
入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))
C:\Users\...>py sample1.py
1.
(1)
⎛sin(b⋅x)⎞
lim ⎜────────⎟
x─→0⁻⎝sin(a⋅x)⎠
b
─
a
⎛sin(b⋅x)⎞
lim ⎜────────⎟
x─→0⁺⎝sin(a⋅x)⎠
b
─
a
(2)
⎛ 2⎞
⎜(-π⋅n + x) ⎟
lim ⎜───────────⎟
x─→0⁻⎜ 2 ⎟
⎝ sin (x) ⎠
⎛ 2⎞
∞⋅sign⎝n ⎠
⎛ 2⎞
⎜(-π⋅n + x) ⎟
lim ⎜───────────⎟
x─→0⁺⎜ 2 ⎟
⎝ sin (x) ⎠
⎛ 2⎞
∞⋅sign⎝n ⎠
(3)
⎛atan(x)⎞
lim ⎜───────⎟
x─→0⁻⎝ x ⎠
1
⎛atan(x)⎞
lim ⎜───────⎟
x─→0⁺⎝ x ⎠
1
(4)
⎛ 2⎞
⎜(-π⋅n + x) ⎟
lim ⎜───────────⎟
x─→π⋅n⁻⎜ 2 ⎟
⎝ sin (x) ⎠
1
⎛ 2⎞
⎜(-π⋅n + x) ⎟
lim ⎜───────────⎟
x─→π⋅n⁺⎜ 2 ⎟
⎝ sin (x) ⎠
1
⎛ sin(x) ⎞
⎜────────, red⎟
⎝sin(2⋅x) ⎠
⎛1 - cos(x) ⎞
⎜──────────, green⎟
⎜ 2 ⎟
⎝ x ⎠
⎛atan(x) ⎞
⎜───────, blue⎟
⎝ x ⎠
⎛ 2 ⎞
⎜(x - 2⋅π) ⎟
⎜──────────, brown⎟
⎜ 2 ⎟
⎝ sin (x) ⎠
C:\Users\...>
0 コメント:
コメントを投稿