## 2019年5月5日日曜日

### 数学 - Python - 解析学 - 級数 - テイラーの公式 - 2項展開(累乗根(平方根)の近似)

1. $\begin{array}{l}\sqrt{97}\\ =\sqrt{1{0}^{2}-3}\\ =10\sqrt{1-\frac{3}{1{0}^{2}}}\\ \fallingdotseq 10\left(1-\frac{1}{2}·\frac{3}{1{0}^{2}}\right)\\ =10-\frac{5·3}{1{0}^{2}}\\ =10-\frac{3}{20}\\ \frac{d}{\mathrm{dx}}{\left(1+x\right)}^{s}=s{\left(1+x\right)}^{s-1}\\ \frac{{d}^{2}}{d{x}^{2}}\left(1+x\right)=s\left(s-1\right){\left(1+x\right)}^{s-2}\\ {\left(1+x\right)}^{s}=1+sx+\frac{s\left(s-1\right)}{2!}{x}^{2}+{R}_{3}\\ \sqrt{97}\\ \fallingdotseq 10\left(1-\frac{1}{2}·\frac{3}{1{0}^{2}}-\frac{1}{2}·\frac{1}{2}·\frac{1}{2!}{\left(\frac{3}{1{0}^{2}}\right)}^{2}\right)\\ =10-\frac{3}{20}-\frac{5}{2·2}·\frac{9}{1{0}^{4}}\\ =10-\frac{3}{20}-\frac{9}{8000}\end{array}$

コード

Python 3

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

print('2.')

a = 10 - Rational(3, 20) - Rational(9, 8000)

for o in [a, sqrt(97)]:
for s in [o, float(o)]:
pprint(s)
print()


C:\Users\...>py sample2.py
2.
78791
─────
8000

9.848875

√97

9.848857801796104

C:\Users\...>