## 2019年7月3日水曜日

### 数学 - Python - 解析学 - 級数 - テイラーの公式 - 三角関数(正弦)、直線、累乗(べき乗、立方)、和、差、商、極限

1. $\begin{array}{l}f\left(x\right)=\mathrm{sin}x-x+\frac{{x}^{3}}{3!}\\ f\text{'}\left(x\right)=\mathrm{cos}x-1+\frac{1}{2}{x}^{2}\\ {f}^{\left(2\right)}\left(x\right)=-\mathrm{sin}x+x\\ {f}^{\left(3\right)}\left(x\right)=-\mathrm{cos}x+1\\ {f}^{\left(4\right)}\left(x\right)=\mathrm{sin}x\\ {f}^{\left(5\right)}\left(x\right)=\mathrm{cos}x\\ {f}^{\left(6\right)}\left(x\right)=-\mathrm{sin}x\\ {f}^{\left(7\right)}\left(x\right)=-\mathrm{cos}x\\ {f}^{\left(8\right)}\left(x\right)=\mathrm{sin}x\\ f\left(x\right)=\frac{1}{5!}{x}^{5}-\frac{1}{7!}{x}^{7}+\dots \\ \underset{x\to 0}{\mathrm{lim}}\frac{\mathrm{sin}x-x+\frac{{x}^{3}}{3!}}{{x}^{3}}=0\end{array}$

コード

Python 3

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

print('36.')

x = symbols('x')
f = (sin(x) - x + x ** 3 / factorial(3)) / x ** 4

for d in ['+', '-']:
l = Limit(f, x, 0, dir=d)
for o in [l, l.doit()]:
pprint(o)
print()

p = plot(sin(x), -x, + x ** 3 / factorial(3),
sin(x) - x + x ** 3 / factorial(3), x ** 4, f,
(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('sample36.png')


C:\Users\...>py sample36.py
36.
⎛ 3             ⎞
⎜x              ⎟
⎜── - x + sin(x)⎟
⎜6              ⎟
lim ⎜───────────────⎟
x─→0⁺⎜        4      ⎟
⎝       x       ⎠

0

⎛ 3             ⎞
⎜x              ⎟
⎜── - x + sin(x)⎟
⎜6              ⎟
lim ⎜───────────────⎟
x─→0⁻⎜        4      ⎟
⎝       x       ⎠

0

C:\Users\...>