## 2019年12月1日日曜日

### 数学 - Python - 解析学 - “ε-δ”その他 - εとδ - 極限 - 平方根、差、分子の有理化

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

2. $\begin{array}{l}\underset{n\to \infty }{\mathrm{lim}}\left(\sqrt{n+2}-\sqrt{n}\right)\\ =\underset{n\to \infty }{\mathrm{lim}}\frac{2}{\sqrt{a+2}+\sqrt{a}}\\ =0\end{array}$

3. $\begin{array}{l}\underset{n\to \infty }{\mathrm{lim}}\left(\sqrt{n-5}-\sqrt{n}\right)\\ =\underset{n\to 0}{\mathrm{lim}}\frac{-5}{\sqrt{n-5}+\sqrt{n}}\\ =0\end{array}$

コード

#!/usr/bin/env python3
from unittest import TestCase, main
from sympy import pprint, symbols, plot, Limit, oo, Limit, sqrt, Rational

print('8.')

n = symbols('n')
fs = [sqrt(n + 1) - sqrt(n),
sqrt(n + 2) - sqrt(n),
sqrt(n - 5) - sqrt(n)]

class MyTestCase(TestCase):
def test(self):
for f in fs:
self.assertEqual(Limit(f, n, oo).doit(), 0)

p = plot(*fs,
(n, 5, 11),
ylim=(-5, 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('sample8.png')

if __name__ == '__main__':
main()


% ./sample8.py -v
8.
test (__main__.MyTestCase) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.726s

OK
%