学習環境
- Surface
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
解析入門 原書第3版 (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第4部(級数)、第15章(級数)、7(べき級数の微分と積分)の練習問題4を求めてみる。
コード
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols, summation, oo, plot, Derivative
print('4.')
x, n = symbols('x, n')
t = (-1) ** n * x ** (2 * n + 1) / (2 * n + 1)
f = summation(t, (n, 0, oo))
f1 = Derivative(f, x, 1).doit()
for o in [f, f1]:
pprint(o)
print()
def g(m):
return sum([t.subs({n: k}) for k in range(m + 1)])
fs = [1 / (1 + x ** 2)] + [g(m) for m in range(9)]
p = plot(*fs,
(x, -2, 2),
ylim=(-2, 2),
legend=False,
show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']
for o, color in zip(p, colors):
o.line_color = color
for o in zip(fs, colors):
pprint(o)
print()
p.show()
p.save('sample4.png')
入出力結果(Zsh、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))
% ./sample4.py
4.
⎛⎧ atan(x) ⎞
⎜⎪ ─────── for x ≥ -1 ∧ x ≤ 1⎟
⎜⎪ x ⎟
⎜⎪ ⎟
⎜⎪ ∞ ⎟
⎜⎪ ____ ⎟
⎜⎪ ╲ ⎟
x⋅⎜⎨ ╲ n 2⋅n ⎟
⎜⎪ ╲ (-1) ⋅x ⎟
⎜⎪ ╱ ────────── otherwise ⎟
⎜⎪ ╱ 2⋅n + 1 ⎟
⎜⎪ ╱ ⎟
⎜⎪ ‾‾‾‾ ⎟
⎜⎪n = 0 ⎟
⎝⎩ ⎠
⎛⎧ 1 atan(x) ⎞
⎜⎪ ────────── - ─────── for x ≥ -1 ∧ x ≤ 1⎟ ⎛⎧
⎜⎪ ⎛ 2 ⎞ 2 ⎟ ⎜⎪
⎜⎪ x⋅⎝x + 1⎠ x ⎟ ⎜⎪
⎜⎪ ⎟ ⎜⎪
⎜⎪⎧ 1 atan(x) ⎟ ⎜⎪⎧ at
⎜⎪⎪────────── - ─────── for x ≥ -1 ∧ x ≤ 1 ⎟ ⎜⎪⎪ ──
⎜⎪⎪ ⎛ 2 ⎞ 2 ⎟ ⎜⎪⎪
⎜⎪⎪x⋅⎝x + 1⎠ x ⎟ ⎜⎪⎪
⎜⎪⎪ ⎟ ⎜⎪⎪ ∞
x⋅⎜⎨⎪ ∞ ⎟ + ⎜⎨⎪ ____
⎜⎪⎪ ____ ⎟ ⎜⎪⎪ ╲
⎜⎪⎨ ╲ otherwise ⎟ ⎜⎪⎨ ╲
⎜⎪⎪ ╲ n 2⋅n ⎟ ⎜⎪⎪ ╲
⎜⎪⎪ ╲ 2⋅(-1) ⋅n⋅x ⎟ ⎜⎪⎪ ╱
⎜⎪⎪ ╱ ────────────── otherwise ⎟ ⎜⎪⎪ ╱
⎜⎪⎪ ╱ x⋅(2⋅n + 1) ⎟ ⎜⎪⎪ ╱
⎜⎪⎪ ╱ ⎟ ⎜⎪⎪ ‾‾‾‾
⎜⎪⎪ ‾‾‾‾ ⎟ ⎜⎪⎪n = 0
⎜⎪⎩n = 0 ⎟ ⎝⎩⎩
⎝⎩ ⎠
atan(x) ⎞
─────── for x ≥ -1 ∧ x ≤ 1⎟
x ⎟
⎟
an(x) ⎟
───── for x ≥ -1 ∧ x ≤ 1 ⎟
x ⎟
⎟
⎟
⎟
⎟
n 2⋅n otherwise ⎟
(-1) ⋅x ⎟
────────── otherwise ⎟
2⋅n + 1 ⎟
⎟
⎟
⎟
⎠
⎛ 1 ⎞
⎜──────, red⎟
⎜ 2 ⎟
⎝x + 1 ⎠
(x, green)
⎛ 3 ⎞
⎜ x ⎟
⎜- ── + x, blue⎟
⎝ 3 ⎠
⎛ 5 3 ⎞
⎜x x ⎟
⎜── - ── + x, brown⎟
⎝5 3 ⎠
⎛ 7 5 3 ⎞
⎜ x x x ⎟
⎜- ── + ── - ── + x, orange⎟
⎝ 7 5 3 ⎠
⎛ 9 7 5 3 ⎞
⎜x x x x ⎟
⎜── - ── + ── - ── + x, purple⎟
⎝9 7 5 3 ⎠
⎛ 11 9 7 5 3 ⎞
⎜ x x x x x ⎟
⎜- ─── + ── - ── + ── - ── + x, pink⎟
⎝ 11 9 7 5 3 ⎠
⎛ 13 11 9 7 5 3 ⎞
⎜x x x x x x ⎟
⎜─── - ─── + ── - ── + ── - ── + x, gray⎟
⎝ 13 11 9 7 5 3 ⎠
⎛ 15 13 11 9 7 5 3 ⎞
⎜ x x x x x x x ⎟
⎜- ─── + ─── - ─── + ── - ── + ── - ── + x, skyblue⎟
⎝ 15 13 11 9 7 5 3 ⎠
⎛ 17 15 13 11 9 7 5 3 ⎞
⎜x x x x x x x x ⎟
⎜─── - ─── + ─── - ─── + ── - ── + ── - ── + x, yellow⎟
⎝ 17 15 13 11 9 7 5 3 ⎠
$
0 コメント:
コメントを投稿