## 2019年9月18日水曜日

### 数学 - Python - 解析学 - 級数 - 絶対収束と交代級数の収束 - 対数関数、累乗根(平方根)、収束するが絶対収束しない場合

1. $\begin{array}{l}\sum \left|{\left(-1\right)}^{n}\frac{1}{\sqrt{\mathrm{log}n}}\right|\\ =\sum \frac{1}{\sqrt{\mathrm{log}n}}\\ \ge \sum \frac{1}{\sqrt{n}}\end{array}$

よって、 絶対収束しない。

交代級数で、

$\begin{array}{l}\underset{n\to \infty }{\mathrm{lim}}{\left(-1\right)}^{n}\frac{1}{\sqrt{\mathrm{log}n}}=0\\ \frac{1}{\sqrt{\mathrm{log}\left(n+1\right)}}\le \frac{1}{\sqrt{\mathrm{log}n}}\end{array}$

よって収束する。

コード

Python 3

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

print('20.')

n = symbols('n')
f = (-1) ** n / sqrt(log(n))
s1 = summation(f, (n, 2, oo))
s2 = summation(abs(f), (n, 2, oo))
for o in [s1, s2]:
pprint(o)
print()

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

def h(m):
return sum([abs(f.subs({n: n0})) for n0 in range(2, m)])

p = plot(abs(f),
(n, 2, 12),
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('sample20.png')

ms = range(2, 12)
plt.plot(ms, [g(m) for m in ms],
ms, [h(m) for m in ms],
ms, [f.subs({n: m}) for m in ms])
plt.legend(['Σ (-1)^n * 1 / √log n',
'Σ |(-1)^n * 1 / √log n|',
'(-1)^n * 1 / √log n',
'|(-1)^n * 1 / √log n|'])
plt.savefig('sample20.png')


C:\Users\...>py sample20.py
20.
∞
_____
╲
╲          n
╲     (-1)
╲  ──────────
╱    ________
╱   ╲╱ log(n)
╱
╱
‾‾‾‾‾
n = 2

∞
____
╲
╲    -π⋅im(n) │    1     │
╲  ℯ        ⋅│──────────│
╱            │  ________│
╱             │╲╱ log(n) │
╱
‾‾‾‾
n = 2

c:\Users\...>