2019年9月26日木曜日

学習環境

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


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

    よって、収を半径は1。

コード

Python 3

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

print('7.')

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

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

for o in [s, s.doit(), 1 / s.doit(), f.subs({m: oo})]:
    pprint(o)
    print()

ms = range(2, 12)
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('sample7.png')

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

$ ./sample7.py
7.
       ___________
    n ╱ │   2   │ 
lim ╲╱  │log (n)│ 
n─→∞              

1

1

  ∞             
 ___            
 ╲              
  ╲    n    2   
  ╱   x ⋅log (n)
 ╱              
 ‾‾‾            
n = 2           

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

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

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

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

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

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

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

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

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

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

/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 コメント:

コメントを投稿