## 2019年5月21日火曜日

### 数学 - Python - 解析学 - 級数 - テイラーの公式 - 一意性定理(三角関数(正弦)、累乗(べき乗、立方))

1. $\begin{array}{l}\mathrm{sin}x=x-\frac{1}{3!}{x}^{3}+O\left({x}^{5}\right)\\ {\mathrm{sin}}^{2}x\\ ={\left(x-\frac{1}{3!}{x}^{3}\right)}^{2}+O\left({x}^{5}\right)\\ ={x}^{2}-\frac{1}{3}{x}^{4}+O\left({x}^{5}\right)\\ {\mathrm{sin}}^{3}x\\ =\left({x}^{2}-\frac{1}{3}{x}^{4}\right)\left(x-\frac{1}{3!}{x}^{3}\right)+O\left({x}^{5}\right)\\ ={x}^{3}+O\left({x}^{5}\right)\end{array}$

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, plot, sin, factorial, Derivative

print('12.')

x = symbols('x')
f = sum([1 / factorial(n) * Derivative(sin(x) ** 3, x, n).subs({x: 0}) * x ** n
for n in range(5)])

for o in [f, f.doit()]:
pprint(o)
print()

p = plot(sin(x), sin(x) ** 3, f.doit(),
(x, -5, 5),
ylim=(-5, 5),
legend=True,
show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']

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

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


C:\Users\...>py sample12.py
12.
⎛  4         ⎞│         ⎛  3         ⎞│         ⎛  2         ⎞│
4 ⎜ d ⎛   3   ⎞⎟│       3 ⎜ d ⎛   3   ⎞⎟│       2 ⎜ d ⎛   3   ⎞⎟│
x ⋅⎜───⎝sin (x)⎠⎟│      x ⋅⎜───⎝sin (x)⎠⎟│      x ⋅⎜───⎝sin (x)⎠⎟│
⎜  4         ⎟│         ⎜  3         ⎟│         ⎜  2         ⎟│
⎝dx          ⎠│x=0      ⎝dx          ⎠│x=0      ⎝dx          ⎠│x=0     ⎛d ⎛
───────────────────── + ───────────────────── + ───────────────────── + x⋅⎜──⎝
24                      6                       2               ⎝dx

3   ⎞⎞│
sin (x)⎠⎟│
⎠│x=0

3
x

C:\Users\...>