## 2019年9月7日土曜日

### 数学 - Python - 解析学 - 級数 - 絶対収束と交代級数の収束 - 対数関数、極限、収束

1. 交代級数で

$\underset{n\to n}{\mathrm{lim}}\frac{{\left(-1\right)}^{n+1}}{\mathrm{log}\left(n+2\right)}=0$

また、

$\begin{array}{l}\left|{a}_{n+1}\right|\\ =\left|\frac{{\left(-1\right)}^{n+2}}{\mathrm{log}\left(n+2\right)}\right|\\ =\frac{1}{\mathrm{log}\left(n+2\right)}\\ \left|{a}_{n}\right|\\ =\frac{1}{\mathrm{log}\left(n+1\right)}\\ \left|{a}_{n+1}\right|\le \left|{a}_{n}\right|\end{array}$

よって問題の無限級数は収束する。

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, summation, oo, plot, log
import matplotlib.pyplot as plt

print('9.')

n = symbols('n')
f = (-1) ** (n + 1) / log(n + 2)
s = summation(f, (n, 1, oo))
pprint(s)

p = plot(f,
(n, 1, 101),
legend=True,
show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']

for s, color in zip(p, colors):
s.line_color = color

p.show()
p.save('sample9.png')

def g(m):
return sum([f.subs({n: k}) for k in range(1, m)])

ms = range(1, 101)
plt.plot(ms, [g(m) for m in ms])
plt.legend(['Σ (-1)^(n + 1) / log(n + 2)',
'(-1)^(n + 1) / log(n + 2)'])
plt.savefig('sample9.png')


C:\Users\...>py sample9.py
9.
∞
____
╲
╲       n + 1
╲  (-1)
╱  ──────────
╱   log(n + 2)
╱
‾‾‾‾
n = 1

c:\Users\...>