2019年10月13日日曜日

学習環境

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


  1. lim n cos n 2 n n 1 n = lim n 1 n = 0

    よって収束半径は、

コード

Python 3

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

print('26.')

n, m, x = symbols('n, m, x')
an = cos(n ** 2) / n ** 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(), f.subs({m: oo})]:
    pprint(o)
    print()

ms = range(2, 12)
# fs = [f.subs({m: m0}) for m0 in ms]


def g(m):
    return sum([an.subs({n: m}) * x ** m for m in range(1, m)])


fs = [g(m) for m in ms]

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

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

% ./sample26.py 
26.
       _______________
    n ╱ │ -n    ⎛ 2⎞│ 
lim ╲╱  │n  ⋅cos⎝n ⎠│ 
n─→∞                  

1

1

  ∞                 
 ___                
 ╲                  
  ╲    -n  n    ⎛ 2⎞
  ╱   n  ⋅x ⋅cos⎝n ⎠
 ╱                  
 ‾‾‾                
n = 1               

(x⋅cos(1), red)

⎛ 2                         ⎞
⎜x ⋅cos(4)                  ⎟
⎜───────── + x⋅cos(1), green⎟
⎝    4                      ⎠

⎛ 3           2                        ⎞
⎜x ⋅cos(9)   x ⋅cos(4)                 ⎟
⎜───────── + ───────── + x⋅cos(1), blue⎟
⎝    27          4                     ⎠

⎛ 4            3           2                         ⎞
⎜x ⋅cos(16)   x ⋅cos(9)   x ⋅cos(4)                  ⎟
⎜────────── + ───────── + ───────── + x⋅cos(1), brown⎟
⎝   256           27          4                      ⎠

⎛ 5            4            3           2                          ⎞
⎜x ⋅cos(25)   x ⋅cos(16)   x ⋅cos(9)   x ⋅cos(4)                   ⎟
⎜────────── + ────────── + ───────── + ───────── + x⋅cos(1), orange⎟
⎝   3125         256           27          4                       ⎠

⎛ 6            5            4            3           2                        
⎜x ⋅cos(36)   x ⋅cos(25)   x ⋅cos(16)   x ⋅cos(9)   x ⋅cos(4)                 
⎜────────── + ────────── + ────────── + ───────── + ───────── + x⋅cos(1), purp
⎝  46656         3125         256           27          4                     

  ⎞
  ⎟
le⎟
  ⎠

⎛ 7            6            5            4            3           2           
⎜x ⋅cos(49)   x ⋅cos(36)   x ⋅cos(25)   x ⋅cos(16)   x ⋅cos(9)   x ⋅cos(4)    
⎜────────── + ────────── + ────────── + ────────── + ───────── + ───────── + x
⎝  823543       46656         3125         256           27          4        

             ⎞
             ⎟
⋅cos(1), pink⎟
             ⎠

⎛ 8            7            6            5            4            3          
⎜x ⋅cos(64)   x ⋅cos(49)   x ⋅cos(36)   x ⋅cos(25)   x ⋅cos(16)   x ⋅cos(9)   
⎜────────── + ────────── + ────────── + ────────── + ────────── + ───────── + 
⎝ 16777216      823543       46656         3125         256           27      

 2                        ⎞
x ⋅cos(4)                 ⎟
───────── + x⋅cos(1), gray⎟
    4                     ⎠

⎛ 9            8            7            6            5            4          
⎜x ⋅cos(81)   x ⋅cos(64)   x ⋅cos(49)   x ⋅cos(36)   x ⋅cos(25)   x ⋅cos(16)  
⎜────────── + ────────── + ────────── + ────────── + ────────── + ────────── +
⎝387420489     16777216      823543       46656         3125         256      

  3           2                           ⎞
 x ⋅cos(9)   x ⋅cos(4)                    ⎟
 ───────── + ───────── + x⋅cos(1), skyblue⎟
     27          4                        ⎠

⎛ 10             9            8            7            6            5        
⎜x  ⋅cos(100)   x ⋅cos(81)   x ⋅cos(64)   x ⋅cos(49)   x ⋅cos(36)   x ⋅cos(25)
⎜──────────── + ────────── + ────────── + ────────── + ────────── + ──────────
⎝10000000000    387420489     16777216      823543       46656         3125   

    4            3           2                          ⎞
   x ⋅cos(16)   x ⋅cos(9)   x ⋅cos(4)                   ⎟
 + ────────── + ───────── + ───────── + x⋅cos(1), yellow⎟
      256           27          4                       ⎠

%

0 コメント:

コメントを投稿