学習環境
- Surface、Surface ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro 10.5 + Apple Pencil
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
解析入門(上) (松坂和夫 数学入門シリーズ 4) (松坂 和夫(著)、岩波書店)の第2章(数列と級数)、2.2(数列の収束条件)、問題8の解答を求めてみる。
上極限がすべて有限で等号が成り立たない例。
右辺の2つの上極限がともに有限で、左辺が負の無限大である2つの数列の例。
コード
Python 3
#!/usr/bin/env python3 import matplotlib.pyplot as plt print('8.') def a1(n): return (-1) ** n def b1(n): return (-1) ** (n + 1) def ab1(n): return a1(n) + b1(n) def a2(n): if n % 2 == 1: return (-1) ** (2 * n - 1) * (2 * n - 1) return 0 def b2(n): if n % 2 == 1: return 0 return (-1) ** (2 ** n - 1) * 2 * n def ab2(n): return a2(n) + b2(n) n = 10 for (a, b, ab) in [(a1, b1, ab1), (a2, b2, ab2)]: for n in range(1, n + 1): print(f'n = {n}, a{n} = {a(n)}, b{n} = {b(n)}, a{n} + b{n} = {ab(n)}') print() plt.plot(range(1, n + 1), [a1(i) for i in range(1, n + 1)], range(1, n + 1), [b1(i) for i in range(1, n + 1)], range(1, n + 1), [ab1(i) for i in range(1, n + 1)], range(1, n + 1), [a2(i) for i in range(1, n + 1)], range(1, n + 1), [b2(i) for i in range(1, n + 1)], range(1, n + 1), [ab2(i) for i in range(1, n + 1)], marker='o') plt.legend(['a1', 'b1', 'a1 + b1', 'a2', 'b2', 'a2 + b2']) # plt.show() plt.savefig('sample8.png')
入出力結果(cmd(コマンドプロンプト)、Terminal、Jupyter(IPython))
C:\Users\...>py sample8.py 8. n = 1, a1 = -1, b1 = 1, a1 + b1 = 0 n = 2, a2 = 1, b2 = -1, a2 + b2 = 0 n = 3, a3 = -1, b3 = 1, a3 + b3 = 0 n = 4, a4 = 1, b4 = -1, a4 + b4 = 0 n = 5, a5 = -1, b5 = 1, a5 + b5 = 0 n = 6, a6 = 1, b6 = -1, a6 + b6 = 0 n = 7, a7 = -1, b7 = 1, a7 + b7 = 0 n = 8, a8 = 1, b8 = -1, a8 + b8 = 0 n = 9, a9 = -1, b9 = 1, a9 + b9 = 0 n = 10, a10 = 1, b10 = -1, a10 + b10 = 0 n = 1, a1 = -1, b1 = 0, a1 + b1 = -1 n = 2, a2 = 0, b2 = -4, a2 + b2 = -4 n = 3, a3 = -5, b3 = 0, a3 + b3 = -5 n = 4, a4 = 0, b4 = -8, a4 + b4 = -8 n = 5, a5 = -9, b5 = 0, a5 + b5 = -9 n = 6, a6 = 0, b6 = -12, a6 + b6 = -12 n = 7, a7 = -13, b7 = 0, a7 + b7 = -13 n = 8, a8 = 0, b8 = -16, a8 + b8 = -16 n = 9, a9 = -17, b9 = 0, a9 + b9 = -17 n = 10, a10 = 0, b10 = -20, a10 + b10 = -20 C:\Users\...>
0 コメント:
コメントを投稿