## 2019年12月2日月曜日

### 数学 - Python - 解析学 - 積分法 - 不定積分、広義積分 - 数列、極限、無限級数

1. $\begin{array}{l}\alpha >0\\ \underset{n\to \infty }{\mathrm{lim}}\frac{1}{n}\sum _{k=1}^{n}{\left(\frac{k}{n}\right)}^{\alpha }\\ ={\int }_{0}^{1}{x}^{\alpha }\mathrm{dx}\\ ={\left[\frac{1}{\alpha +1}{x}^{\alpha +1}\right]}_{0}^{1}\\ =\frac{1}{\alpha +1}\end{array}$

2. $\begin{array}{l}\underset{n\to \infty }{\mathrm{lim}}\frac{1}{n}\sum _{k=1}^{n}\mathrm{sin}\frac{k\pi }{n}\\ ={\int }_{0}^{1}\mathrm{sin}\left(x\pi \right)\mathrm{dx}\\ ={\left[\frac{1}{\pi }\left(-\mathrm{cos}\left(x\pi \right)\right)\right]}_{0}^{1}\\ =\frac{1}{\pi }\left(1+1\right)\\ =\frac{2}{\pi }\end{array}$

3. $\begin{array}{l}\underset{n\to \infty }{\mathrm{lim}}\sum _{k=1}^{n}\frac{1}{n+k}\\ =\underset{n\to \infty }{\mathrm{lim}}\frac{1}{n}\sum _{k=1}^{n}\frac{1}{1+\frac{k}{n}}\\ ={\int }_{1}^{2}\frac{1}{x}\mathrm{dx}\\ ={\left[\mathrm{log}x\right]}_{1}^{2}\\ =\mathrm{log}2\end{array}$

4. $\begin{array}{l}\underset{n\to \infty }{\mathrm{lim}}\frac{1}{n\sqrt{n}}\sum _{k=1}^{n}\sqrt{k}\\ =\underset{n\to \infty }{\mathrm{lim}}\frac{1}{n}\sum _{k=1}^{n}\sqrt{\frac{k}{n}}\\ ={\int }_{0}^{1}\sqrt{x}\mathrm{dx}\\ ={\left[\frac{2}{3}{x}^{\frac{3}{2}}\right]}_{0}^{1}\\ =\frac{2}{3}\end{array}$

5. $\begin{array}{l}\underset{n\to \infty }{\mathrm{lim}}\sum _{k=1}^{n}\frac{1}{\sqrt{{n}^{2}+kn}}\\ =\underset{n\to \infty }{\mathrm{lim}}\frac{1}{n}\sum _{k=1}^{1}\frac{1}{\sqrt{1+\frac{k}{n}}}\\ ={\int }_{1}^{2}\frac{1}{\sqrt{x}}dx\\ ={\left[2{x}^{\frac{1}{2}}\right]}_{1}^{2}\\ =2\left(\sqrt{2}-1\right)\end{array}$

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import pprint, symbols, Integral, Derivative, pi, oo, sqrt, plot, summation, sin, Limit

print('2.')

x = symbols('x', real=True)
alpha = 2
fs = [x ** alpha,
sin(x * pi),
1 / x,
sqrt(x),
1 / sqrt(x)]
p = plot(*fs,
(x, 0.1, 5),
ylim=(-2.5, 2.5),
show=False,
legend=True)

colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']

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

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


% ./sample2.py
2.
%