## 2019年9月1日日曜日

### 数学 - Python - 解析学 - 級数 - 絶対収束と交代級数の収束 - 三角関数(正弦と余弦)、累乗(べき乗)

1. $\begin{array}{l}\left|\frac{\mathrm{sin}\pi n+\mathrm{cos}2\pi n}{{n}^{\frac{3}{2}}}\right|\\ =\frac{1}{{n}^{\frac{3}{2}}}\\ \frac{3}{2}>1\end{array}$

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

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, summation, oo, Integral, plot, sin, cos, pi
from sympy import Rational
import matplotlib.pyplot as plt

print('3.')

n = symbols('n')
f = abs((sin(pi * n) + cos(2 * pi * n)) / n ** Rational(3, 2))
s = summation(f, (n, 1, oo))
I = Integral(f, (n, 1, oo))

for o in [s, I  # , I.doit()
]:
pprint(o)
print()

p = plot(f, 1 / n ** Rational(3, 2),
(n, 1, 11),
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('sample3.png')

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

ms = range(1, 11)
plt.plot(ms, [g(m) for m in ms])
plt.legend(['Σ |(sin πn + cos 2πn) / n^(3/2)|',
'|(sin πn + cos 2πn) / n^(3/2)|',
'1 / n^(3/2)'])
plt.savefig('sample3.png')


C:\Users\...>py sample3.py
3.
∞
____
╲
╲   │sin(π⋅n) + cos(2⋅π⋅n)│
╲  │─────────────────────│
╱  │          3/2        │
╱   │         n           │
╱
‾‾‾‾
n = 1

∞
⌠
⎮ │sin(π⋅n) + cos(2⋅π⋅n)│
⎮ │─────────────────────│ dn
⎮ │          3/2        │
⎮ │         n           │
⌡
1

c:\Users\...>