## 2019年9月21日土曜日

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

1. $\begin{array}{l}{\mathrm{log}}_{5}\sqrt{72}\\ =\frac{1}{2}{\mathrm{log}}_{5}{2}^{3}·{3}^{2}\\ =\frac{3}{2}{\mathrm{log}}_{5}2+{\mathrm{log}}_{5}3\\ =\frac{3}{2}u+v\end{array}$

2. $\begin{array}{l}{\mathrm{log}}_{3}\frac{1}{30}\\ =-{\mathrm{log}}_{3}30\\ =-\frac{{\mathrm{log}}_{5}30}{{\mathrm{log}}_{5}3}\\ =-\frac{{\mathrm{log}}_{5}2·3·5}{{\mathrm{log}}_{5}3}\\ =-\frac{{\mathrm{log}}_{5}2+{\mathrm{log}}_{5}3+1}{{\mathrm{log}}_{5}3}\\ =-\frac{u+v+1}{v}\end{array}$

3. $\begin{array}{l}{\mathrm{log}}_{6}10\\ =\frac{{\mathrm{log}}_{5}2·5}{{\mathrm{log}}_{5}2·3}\\ =\frac{{\mathrm{log}}_{5}2+1}{{\mathrm{log}}_{5}2+{\mathrm{log}}_{5}3}\\ =\frac{u+1}{u+v}\end{array}$

4. $\begin{array}{l}\frac{{\mathrm{log}}_{5}6}{{\mathrm{log}}_{5}\frac{1}{5}}\\ =-\left({\mathrm{log}}_{5}2·3\right)\\ =-{\mathrm{log}}_{5}2-{\mathrm{log}}_{5}3\\ =-u-v\end{array}$

コード

Python 3

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

print('21.')

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

def tearDown(self):
pass

def test(self):
u = log(2, 5)
v = log(3, 5)
spam = [log(sqrt(72), 5),
log(Rational(1, 30), 3),
log(10, 6),
log(6, Rational(1, 5))]
egg = [3 * u / 2 + v,
-(u + v + 1) / v,
(u + 1) / (u + v),
-u-v]
for s, t in zip(spam, egg):
self.assertEqual(float(s), float(t))

if __name__ == '__main__':
main()


C:\Users\...>py sample21.py
21.
.
----------------------------------------------------------------------
Ran 1 test in 0.024s

OK

C:\Users\...>