## 2019年6月27日木曜日

### 数学 - Python - 解析学 - 級数 - テイラーの公式 - 対数関数、累乗(べき乗、平方)、商、極限

1. $\begin{array}{l}\mathrm{log}\left(1+x\right)=x-\frac{1}{2}{x}^{2}+\frac{1}{3}{x}^{3}-\dots \\ \mathrm{log}\left(1+{x}^{2}\right)={x}^{2}-\frac{1}{2}{x}^{4}+\frac{1}{3}{x}^{6}-\dots \\ \underset{x\to 0}{\mathrm{lim}}\frac{\mathrm{log}\left(1+{x}^{2}\right)}{x}=1\end{array}$

コード

Python 3

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

print('30.')

x = symbols('x')
f = log(1 + x ** 2) / x ** 2

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

p = plot(log(1 + x), log(1 + x ** 2), x ** 2, f,
(x, -5, 5),
ylim=(0, 10),
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('sample30.png')


C:\Users\...>py sample30.py
30.
⎛   ⎛ 2    ⎞⎞
⎜log⎝x  + 1⎠⎟
lim ⎜───────────⎟
x─→0⁺⎜      2    ⎟
⎝     x     ⎠

1

⎛   ⎛ 2    ⎞⎞
⎜log⎝x  + 1⎠⎟
lim ⎜───────────⎟
x─→0⁻⎜      2    ⎟
⎝     x     ⎠

1

C:\Users\...>