## 2019年5月19日日曜日

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

1. $\begin{array}{l}\mathrm{cos}x=1-\frac{1}{2!}{x}^{2}+\frac{1}{4!}{x}^{4}+O\left({x}^{6}\right)\\ {\mathrm{cos}}^{2}x\\ ={\left(1-\frac{1}{2!}{x}^{2}+\frac{1}{4!}{x}^{4}\right)}^{2}+O\left({x}^{6}\right)\\ =1-{x}^{2}+\left(2·\frac{1}{4!}+{\left(\frac{1}{2}\right)}^{2}\right){x}^{4}+O\left({x}^{6}\right)\\ =1-{x}^{2}+\left(\frac{1}{12}+\frac{1}{4}\right){x}^{4}+O\left({x}^{6}\right)\\ =1-{x}^{2}+\frac{1}{3}{x}^{4}+O\left({x}^{6}\right)\\ {\mathrm{cos}}^{3}x\\ =\left(1-{x}^{2}+\frac{1}{3}{x}^{4}\right)\left(1-\frac{1}{2!}{x}^{2}+\frac{1}{4!}{x}^{4}\right)+O\left({x}^{6}\right)\\ =1-\frac{3}{2}{x}^{2}+\left(\frac{1}{4!}+\frac{1}{2!}+\frac{1}{3}\right){x}^{4}+O\left({x}^{6}\right)\\ =1-\frac{3}{2}{x}^{2}+\frac{1+12+8}{24}{x}^{4}+O\left({x}^{6}\right)\\ =1-\frac{3}{2}{x}^{2}+\frac{7}{8}{x}^{4}+O\left({x}^{6}\right)\end{array}$

コード

Python 3

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

print('10.')

x = symbols('x')
f = sum([(-1) ** (k + 1) * 1 / factorial(2 * k) * x ** (2 * k)
for k in range(3)])
g = 1 - 3 * x ** 2 / 2 + 7 * x ** 4 / 8

for o in [f, g, (f ** 3).expand()]:
pprint(o)
print()

p = plot(cos(x), cos(x) ** 3, g,
(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('sample10.png')


C:\Users\...>py sample10.py
10.
4    2
x    x
- ── + ── - 1
24   2

4      2
7⋅x    3⋅x
──── - ──── + 1
8      2

12     10      8    6      4      2
x      x     7⋅x    x    7⋅x    3⋅x
- ───── + ─── - ──── + ── - ──── + ──── - 1
13824   384   192    4     8      2

C:\Users\...>