## 2019年4月15日月曜日

### 数学 - Python - 解析学 - 級数 - テイラーの公式 - 対数関数(分解、和と積、近似)

1. $\begin{array}{l}-7\mathrm{log}\frac{9}{10}+2\mathrm{log}\frac{24}{25}+3\mathrm{log}\frac{81}{80}\\ =\mathrm{log}\left({\left(\frac{10}{9}\right)}^{7}·{\left(\frac{24}{25}\right)}^{2}·{\left(\frac{81}{80}\right)}^{3}\right)\\ =\mathrm{log}\frac{1{0}^{7}·2{4}^{2}·8{1}^{3}}{{9}^{7}·2{5}^{2}·8{0}^{3}}\\ =\mathrm{log}\frac{1{0}^{4}·2{4}^{2}}{9·2{5}^{2}·{8}^{3}}\\ =\mathrm{log}\frac{{2}^{4}·{5}^{4}·{2}^{6}·{3}^{2}}{{3}^{2}·{5}^{4}·{2}^{9}}\\ =\mathrm{log}2\\ -11\mathrm{log}\frac{9}{10}+3\mathrm{log}\frac{24}{25}+5\mathrm{log}\frac{81}{80}\\ =\mathrm{log}\frac{{2}^{11}·{5}^{11}}{{3}^{22}}·\frac{{2}^{9}·{3}^{3}}{{5}^{6}}·\frac{{3}^{20}}{{2}^{20}·{5}^{5}}\\ =\mathrm{log}3\end{array}$

2. $\begin{array}{l}\mathrm{log}\frac{9}{10}\\ =\mathrm{log}\left(1-1{0}^{-1}\right)\\ =-1{0}^{-1}-\frac{1}{2}1{0}^{-2}+\frac{1}{3}{\left(-1{0}^{-1}\right)}^{3}-\frac{1}{4}{\left(-1{0}^{-1}\right)}^{4}+{R}_{5}\\ {R}_{5}\le \frac{1{0}^{-5}}{5·0.9}<1{0}^{-5}\\ \mathrm{log}\frac{24}{25}\\ =\mathrm{log}\left(1-\frac{1}{25}\right)\\ =\mathrm{log}\left(1-4·1{0}^{-2}\right)\\ =-4·1{0}^{-2}-\frac{1}{2}{\left(-4·1{0}^{-2}\right)}^{2}+\frac{1}{3}{\left(-4·1{0}^{-2}\right)}^{3}+{R}_{4}\\ {R}_{4}\le \frac{{\left(4·1{0}^{-2}\right)}^{4}}{4·0.996}<1{0}^{-5}\\ \mathrm{log}\frac{81}{80}\\ =\mathrm{log}\left(1+\frac{1}{80}\right)\\ =\frac{1}{80}-\frac{1}{2}{\left(\frac{1}{80}\right)}^{2}+{R}_{3}\\ \left|{R}_{3}\right|\le \frac{1}{3}·{\left(\frac{1}{80}\right)}^{3}=\frac{1}{3·512000}<1{0}^{-5}\end{array}$

より、求める対数の小数第5位までの値を計算して求める。

$\begin{array}{l}\mathrm{log}2\\ \fallingdotseq -7\left(1{0}^{-1}-\frac{1}{2}·1{0}^{-2}-\frac{1}{3}·1{0}^{-3}-\frac{1}{4}1{0}^{-4}\right)\\ +2\left(-4·1{0}^{-2}-\frac{1}{2}{\left(4·1{0}^{-2}\right)}^{2}-\frac{1}{3}{\left(4·1{0}^{-2}\right)}^{3}\right)\\ +3\left(\frac{1}{80}-\frac{1}{2}{\left(\frac{1}{80}\right)}^{2}\right)\end{array}$

log 3 も同様に計算。

コード

Python 3

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

print('2.')

a = -10 ** -1 - Rational(1, 2) * 10 ** -2 + Rational(1, 3) * \
(-10 ** -1) ** 3 - Rational(1, 4) * (-10 ** -1) ** 4
b = -4 * 10 ** -2 - Rational(1, 2) * (-4 * 10 ** -2) ** 2 + \
Rational(1, 3) * (-4 * 10 ** -2) ** 3
c = Rational(1, 80) - Rational(1, 2) * Rational(1, 80) ** 2

log2 = -7 * a + 2 * b + 3 * c
log3 = -11 * a + 3 * b + 5 * c

for o in [a, b, c,
log(2), float(log(2)), log2, log(3), float(log(3)), log3]:
pprint(o)
print()


C:\Users\...>py sample2.py
2.
-0.105358333333333

-0.0408213333333333

159
─────
12800

log(2)

0.6931471805599453

0.693131291666667

log(3)

1.0986122886681098

1.09858704166667

C:\Users\...>