## 2019年5月7日火曜日

### 数学 - Python - 解析学 - 級数 - テイラーの公式 - 2項展開(展開式の剰余項の評価、累乗根(平方根))

1. $\begin{array}{l}\left|{R}_{2}\right|\\ =\frac{1}{2}\left|\frac{1}{2}·\left(-\frac{1}{2}\right)\right|.{\left(1+c\right)}^{\frac{1}{2}-2}{\left|-0.2\right|}^{2}\\ \le \frac{1}{8}·{2}^{2}·1{0}^{-2}\\ =\frac{1}{2}·1{0}^{-2}\end{array}$

2. $\begin{array}{l}\left|{R}_{2}\right|\\ =\frac{1}{2}\left|\frac{1}{2}·\left(-\frac{1}{2}\right)\right|{\left(1+c\right)}^{\frac{1}{2}-2}{\left|0.1\right|}^{2}\\ \le \frac{1}{8}·1{0}^{-2}\end{array}$

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, sqrt, plot, Rational

print('4.')

x = symbols('x')
f = sqrt(1 + x)
g = 1 + x / 2

pprint(abs((f - g).subs({x: -0.2})) <=
2 ** Rational(-11, 2) * 10 ** Rational(1, 2))
pprint(abs((f - g).subs({x: 0.1})) <= Rational(1, 8) * 10 ** -2)

p = plot(f, g, (x, -0.2, 0.2),
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('sample4.png')


C:\Users\...>py sample4.py
4.
True
True

C:\Users\...>