学習環境
- Surface、Surface ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro 10.5 + Apple Pencil
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
解析入門 原書第3版 (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第4部(級数)、第15章(級数)、6(べき級数)の練習問題14を求めてみる。
よって、収束半径は1。
コード
Python 3
#!/usr/bin/env python3
from sympy import pprint, symbols, summation, oo, Limit, plot, sqrt
print('14.')
n, m, x = symbols('n, m, x')
an = 1 + (-1) ** n
f = summation(an * x ** n, (n, 1, m))
s = Limit(abs(an) ** (1 / n), n, oo)
for o in [s, # s.doit(), 1 / s.doit(),
f.subs({m: oo})]:
pprint(o)
print()
# ms = range(1, 11)
ms = range(1, 21, 2)
# fs = [f.subs({m: m0}) for m0 in ms]
def g(m):
return sum([an.subs({n: m}) * x ** m for m in range(1, m)])
fs = [g(m) for m in ms]
p = plot(*fs,
(x, -2, 2),
ylim=(0, 4),
legend=False,
show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']
for s, color in zip(p, colors):
s.line_color = color
for o in zip(fs, colors):
pprint(o)
print()
p.show()
p.save('sample14.png')
入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))
$ ./sample14.py
14.
_____________
n ╱ │ n │
lim ╲╱ │(-1) + 1│
n─→∞
⎛⎧ ∞ for x = -1⎞ ⎛⎧ ∞ for x = 1⎞
⎜⎪ ⎟ ⎜⎪ ⎟
⎜⎪ ∞ ⎟ ⎜⎪ ∞ ⎟
⎜⎨-x - (-x) ⎟ + ⎜⎨x - x ⎟
⎜⎪────────── otherwise ⎟ ⎜⎪────── otherwise⎟
⎜⎪ x + 1 ⎟ ⎜⎪1 - x ⎟
⎝⎩ ⎠ ⎝⎩ ⎠
(0, red)
⎛ 2 ⎞
⎝2⋅x , green⎠
⎛ 4 2 ⎞
⎝2⋅x + 2⋅x , blue⎠
⎛ 6 4 2 ⎞
⎝2⋅x + 2⋅x + 2⋅x , brown⎠
⎛ 8 6 4 2 ⎞
⎝2⋅x + 2⋅x + 2⋅x + 2⋅x , orange⎠
⎛ 10 8 6 4 2 ⎞
⎝2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x , purple⎠
⎛ 12 10 8 6 4 2 ⎞
⎝2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x , pink⎠
⎛ 14 12 10 8 6 4 2 ⎞
⎝2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x , gray⎠
⎛ 16 14 12 10 8 6 4 2 ⎞
⎝2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x , skyblue⎠
⎛ 18 16 14 12 10 8 6 4 2 ⎞
⎝2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x + 2⋅x , yellow⎠
$
SymPyと結果が違うから、計算間違ってるかも。
0 コメント:
コメントを投稿