## 2019年9月22日日曜日

### 数学 - Python - 急速・緩慢に変化する関係 - 指数関数・対数関数 - 対数関数の性質 - 底の変換公式 - 逆数

1. $\begin{array}{l}{\mathrm{log}}_{a}\frac{1}{b}\\ =-{\mathrm{log}}_{a}b\\ =-u\end{array}$

2. $\begin{array}{l}{\mathrm{log}}_{\frac{1}{a}}b\\ =\frac{{\mathrm{log}}_{a}b}{{\mathrm{log}}_{a}\frac{1}{a}}\\ =-u\end{array}$

3. $\begin{array}{l}{\mathrm{log}}_{\frac{1}{a}}\frac{1}{b}\\ =\frac{-{\mathrm{log}}_{a}b}{-1}\\ =u\end{array}$

4. $\begin{array}{l}{\mathrm{log}}_{b}\frac{1}{a}\\ =\frac{{\mathrm{log}}_{a}\frac{1}{a}}{{\mathrm{log}}_{a}b}\\ =\frac{-1}{u}\end{array}$

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, log
from unittest import TestCase, main

print('22.')

class MyTestCase(TestCase):
def setUp(self):
pass

def tearDown(self):
pass

def test(self):
a, b = symbols('a, b', positive=True)
u = log(b, a)
spam = [log(1 / b, a),
log(b, 1 / a),
log(1 / b, 1 / a),
log(1 / a, b)]
egg = [-u, -u, u, -1 / u]
for s, t in zip(spam, egg):
self.assertEqual(s.simplify(), t)

if __name__ == '__main__':
main()


$./sample22.py 22. . ---------------------------------------------------------------------- Ran 1 test in 0.250s OK$