2020年2月20日木曜日

学習環境

解析入門(上) (松坂和夫 数学入門シリーズ 4) (松坂 和夫(著)、岩波書店)の第9章(関数列と関数級数)、9.2(整級数)、問題6の解答を求めてみる。


  1. 1 1 - x α = 1 - x - α = n = 0 - α n - x n = n = 0 - α n - 1 n x n = n = 0 - α - α - 1 · · - α - n + 1 n ! - 1 n x n = n = 0 α α + 1 · · α + n - 1 n ! x n = n = 0 α + n - 1 α + n - 2 · · α n ! x n = n = 0 α + n - 1 α + n - 1 - 1 · · α + n - 1 - n + 1 n ! x n = n = 0 α + n - 1 n x n

コード

#!/usr/bin/env python3
from sympy import symbols, sqrt, plot, summation, factorial, pprint

print('6.')


def comb(a, n):
    num = 1
    for n0 in range(n):
        num *= (a - n0)
    return num / factorial(n)


x = symbols('x')
alpha = 2
f = 1 / (1 - x) ** alpha

p = plot(f,
         *[sum([comb(alpha + n - 1, n) * x ** n for n in range(m)])
           for m in range(1, 10)],
         (x, -1.5, 1.5),
         ylim=(-10, 10),
         legend=False,
         show=False)

colors = ['red', 'green', 'blue', 'brown', 'orange',
          'purple', 'pink', 'gray', 'skyblue', 'yellow']

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

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

入出力結果(Zsh、PowerShell、Terminal、Jupyter(IPython))

% ./sample6.py
6.
(cartesian line: (1 - x)**(-2) for x over (-1.5, 1.5), red)
(cartesian line: 1 for x over (-1.5, 1.5), green)
(cartesian line: 2*x + 1 for x over (-1.5, 1.5), blue)
(cartesian line: 3*x**2 + 2*x + 1 for x over (-1.5, 1.5), brown)
(cartesian line: 4*x**3 + 3*x**2 + 2*x + 1 for x over (-1.5, 1.5), orange)
(cartesian line: 5*x**4 + 4*x**3 + 3*x**2 + 2*x + 1 for x over (-1.5, 1.5), purp
le)
(cartesian line: 6*x**5 + 5*x**4 + 4*x**3 + 3*x**2 + 2*x + 1 for x over (-1.5, 1
.5), pink)
(cartesian line: 7*x**6 + 6*x**5 + 5*x**4 + 4*x**3 + 3*x**2 + 2*x + 1 for x over
 (-1.5, 1.5), gray)
(cartesian line: 8*x**7 + 7*x**6 + 6*x**5 + 5*x**4 + 4*x**3 + 3*x**2 + 2*x + 1 f
or x over (-1.5, 1.5), skyblue)
(cartesian line: 9*x**8 + 8*x**7 + 7*x**6 + 6*x**5 + 5*x**4 + 4*x**3 + 3*x**2 + 
2*x + 1 for x over (-1.5, 1.5), yellow)
%

0 コメント:

コメントを投稿