2019年9月24日火曜日

学習環境

解析入門 原書第3版 (S.ラング(著)、松坂 和夫(翻訳)、片山 孝次(翻訳)、岩波書店)の第4部(級数)、第15章(級数)、6(べき級数)の練習問題5を求めてみる。


  1. lim n log n 1 n = lim n log n 1 n = 1

    よって、収束半径は1。

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, summation, oo, Limit, plot, log

print('5.')

n, m, x = symbols('n, m, x')
an = log(n)
f = summation(an * x ** n, (n, 1, m))

s = Limit(abs(an) ** (1 / n), n, oo)

for o in [s, s.doit(), 1 / s.doit()]:
    pprint(o)
    print()

ms = range(1, 11)
fs = [f.subs({m: m0}) for m0 in ms]
p = plot(*fs,
         (x, -2, 2),
         ylim=(-2, 2),
         legend=False,
         show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
          'purple', 'pink', 'gray', 'skyblue', 'yellow']

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

for o in zip(fs, colors):
    pprint(o)
    print()

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

入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))

$ ./sample5.py
5.
    n __________
lim ╲╱ │log(n)│ 
n─→∞            

1

1

⎛  1                 ⎞
⎜ ___                ⎟
⎜ ╲                  ⎟
⎜  ╲    n            ⎟
⎜  ╱   x ⋅log(n), red⎟
⎜ ╱                  ⎟
⎜ ‾‾‾                ⎟
⎝n = 1               ⎠

⎛  2                   ⎞
⎜ ___                  ⎟
⎜ ╲                    ⎟
⎜  ╲    n              ⎟
⎜  ╱   x ⋅log(n), green⎟
⎜ ╱                    ⎟
⎜ ‾‾‾                  ⎟
⎝n = 1                 ⎠

⎛  3                  ⎞
⎜ ___                 ⎟
⎜ ╲                   ⎟
⎜  ╲    n             ⎟
⎜  ╱   x ⋅log(n), blue⎟
⎜ ╱                   ⎟
⎜ ‾‾‾                 ⎟
⎝n = 1                ⎠

⎛  4                   ⎞
⎜ ___                  ⎟
⎜ ╲                    ⎟
⎜  ╲    n              ⎟
⎜  ╱   x ⋅log(n), brown⎟
⎜ ╱                    ⎟
⎜ ‾‾‾                  ⎟
⎝n = 1                 ⎠

⎛  5                    ⎞
⎜ ___                   ⎟
⎜ ╲                     ⎟
⎜  ╲    n               ⎟
⎜  ╱   x ⋅log(n), orange⎟
⎜ ╱                     ⎟
⎜ ‾‾‾                   ⎟
⎝n = 1                  ⎠

⎛  6                    ⎞
⎜ ___                   ⎟
⎜ ╲                     ⎟
⎜  ╲    n               ⎟
⎜  ╱   x ⋅log(n), purple⎟
⎜ ╱                     ⎟
⎜ ‾‾‾                   ⎟
⎝n = 1                  ⎠

⎛  7                  ⎞
⎜ ___                 ⎟
⎜ ╲                   ⎟
⎜  ╲    n             ⎟
⎜  ╱   x ⋅log(n), pink⎟
⎜ ╱                   ⎟
⎜ ‾‾‾                 ⎟
⎝n = 1                ⎠

⎛  8                  ⎞
⎜ ___                 ⎟
⎜ ╲                   ⎟
⎜  ╲    n             ⎟
⎜  ╱   x ⋅log(n), gray⎟
⎜ ╱                   ⎟
⎜ ‾‾‾                 ⎟
⎝n = 1                ⎠

⎛  9                     ⎞
⎜ ___                    ⎟
⎜ ╲                      ⎟
⎜  ╲    n                ⎟
⎜  ╱   x ⋅log(n), skyblue⎟
⎜ ╱                      ⎟
⎜ ‾‾‾                    ⎟
⎝n = 1                   ⎠

⎛  10                   ⎞
⎜ ___                   ⎟
⎜ ╲                     ⎟
⎜  ╲    n               ⎟
⎜  ╱   x ⋅log(n), yellow⎟
⎜ ╱                     ⎟
⎜ ‾‾‾                   ⎟
⎝n = 1                  ⎠

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/sympy/plotting/experimental_lambdify.py:233: UserWarning: The evaluation of the expression is problematic. We are trying a failback method that may still work. Please report this as a bug.
  warnings.warn('The evaluation of the expression is'
$

0 コメント:

コメントを投稿