## 2019年6月17日月曜日

### 数学 - Python - 解析学 - 級数 - テイラーの公式 - 三角関数(正弦)、指数関数、差、極限、テイラーの公式、剰余項の評価

1. $\begin{array}{l}\mathrm{sin}x=x-\frac{1}{3!}{x}^{3}+{R}_{5}\left(x\right)\\ \frac{\mathrm{sin}x}{x}=1-\frac{1}{3!}{x}^{2}+\frac{{R}_{5}\left(x\right)}{x}\\ \left|\frac{{R}_{5}\left(x\right)}{x}\right|\le \frac{{\left|x\right|}^{4}}{5!}\\ {e}^{x}=1+x+\frac{1}{2!}{x}^{2}+\frac{1}{3!}{x}^{3}+\dots \\ {e}^{-x}=1-x+\frac{1}{2!}{x}^{2}-\frac{1}{3!}{x}^{3}+\dots \\ {e}^{x}-{e}^{-x}=2x+\frac{2}{3!}{x}^{3}+\dots \\ \frac{{e}^{x}-{e}^{-x}}{x}=2+\frac{2}{3!}{x}^{2}+\dots \\ \underset{x\to 0}{\mathrm{lim}}\frac{\mathrm{sin}x}{{e}^{x}-{e}^{-x}}=\frac{1}{2}\end{array}$

コード

Python 3

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

print('20.')

x = symbols('x', real=True)
f = sin(x) / (exp(x) - exp(-x))

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

p = plot(sin(x), exp(x) - exp(-x), 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('sample20.png')


C:\Users\...>py sample20.py
20.
⎛ sin(x) ⎞
lim ⎜────────⎟
x─→0⁺⎜ x    -x⎟
⎝ℯ  - ℯ  ⎠

1/2

⎛ sin(x) ⎞
lim ⎜────────⎟
x─→0⁻⎜ x    -x⎟
⎝ℯ  - ℯ  ⎠

1/2

C:\Users\...>