## 2019年10月7日月曜日

### 数学 - Python - 解析学 - 級数 - べき級数 - 三角関数(正弦)、2の累乗(べき乗)、係数、累乗根、収束半径、絶対値、極限、逆数

1. $\begin{array}{l}\underset{n\to \infty }{\mathrm{lim}}{\left|\frac{\mathrm{sin}\frac{n\pi }{2}}{{2}^{n}}\right|}^{\frac{1}{n}}\\ =\frac{1}{2}\end{array}$

よって、収束半径は2。

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, summation, oo, Limit, plot, sin, pi

print('20.')

n, m, x = symbols('n, m, x')
an = sin(n * pi / 2) / 2 ** 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)
# 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, -5, 5),
ylim=(-5, 5),
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('sample20.png')


$./sample20.py 20. ____________________ ╱ -re(n) │ ⎛π⋅n⎞│ lim n ╱ 2 ⋅│sin⎜───⎟│ n─→∞╲╱ │ ⎝ 2 ⎠│ ∞ ____ ╲ ╲ -n n ⎛π⋅n⎞ ╲ 2 ⋅x ⋅sin⎜───⎟ ╱ ⎝ 2 ⎠ ╱ ╱ ‾‾‾‾ n = 1 (0, red) ⎛x ⎞ ⎜─, green⎟ ⎝2 ⎠ ⎛x ⎞ ⎜─, blue⎟ ⎝2 ⎠ ⎛ 3 ⎞ ⎜ x x ⎟ ⎜- ── + ─, brown⎟ ⎝ 8 2 ⎠ ⎛ 3 ⎞ ⎜ x x ⎟ ⎜- ── + ─, orange⎟ ⎝ 8 2 ⎠ ⎛ 5 3 ⎞ ⎜x x x ⎟ ⎜── - ── + ─, purple⎟ ⎝32 8 2 ⎠ ⎛ 5 3 ⎞ ⎜x x x ⎟ ⎜── - ── + ─, pink⎟ ⎝32 8 2 ⎠ ⎛ 7 5 3 ⎞ ⎜ x x x x ⎟ ⎜- ─── + ── - ── + ─, gray⎟ ⎝ 128 32 8 2 ⎠ ⎛ 7 5 3 ⎞ ⎜ x x x x ⎟ ⎜- ─── + ── - ── + ─, skyblue⎟ ⎝ 128 32 8 2 ⎠ ⎛ 9 7 5 3 ⎞ ⎜ x x x x x ⎟ ⎜─── - ─── + ── - ── + ─, yellow⎟ ⎝512 128 32 8 2 ⎠$