## 2019年9月17日火曜日

### 数学 - Python - 急速・緩慢に変化する関係 - 指数関数・対数関数 - 対数関数の性質 - 対数に関する基本的な等式 - 対数の和と積の対数、対数の差と商の対数、累乗(べき乗)、累乗根(平方根)

1. $\begin{array}{l}{\mathrm{log}}_{6}\frac{9}{2}+{\mathrm{log}}_{6}8\\ ={\mathrm{log}}_{6}\frac{9}{2}·8\\ ={\mathrm{log}}_{6}36\\ ={\mathrm{log}}_{6}{6}^{2}\\ =2{\mathrm{log}}_{6}6\\ =2\end{array}$

2. $\begin{array}{l}{\mathrm{log}}_{6}\frac{24·3}{12}\\ =1\end{array}$

3. $\begin{array}{l}{\mathrm{log}}_{2}\frac{5}{10}\\ ={\mathrm{log}}_{2}{2}^{-1}\\ =-1\end{array}$

4. $\begin{array}{l}{\mathrm{log}}_{3}\frac{54·6}{4}\\ ={\mathrm{log}}_{3}27·3\\ ={\mathrm{log}}_{3}{3}^{4}\\ =4\end{array}$

5. $\begin{array}{l}\frac{{\mathrm{log}}_{10}{3}^{3}}{{\mathrm{log}}_{10}{3}^{4}}\\ =\frac{3}{4}\end{array}$

6. $\begin{array}{l}{\mathrm{log}}_{10}\frac{4}{3}·75\\ ={\mathrm{log}}_{10}4·25\\ =2\end{array}$

7. $\begin{array}{l}\frac{1}{2}{\mathrm{log}}_{8}\left(2+\sqrt{3}-2\sqrt{4-3}+2-\sqrt{3}\right)\\ =\frac{1}{2}{\mathrm{log}}_{8}2\\ =\frac{1}{2}·\frac{1}{3}{\mathrm{log}}_{8}{2}^{3}\\ =\frac{1}{6}\end{array}$

コード

Python 3

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

print('19.')

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

def tearDown(self):
pass

def test(self):
a = 2
L = 5
M = 6
N = 7
u = log(L, a)
v = log(M, a)
w = log(N, a)
spam = [log(Rational(9, 2), 6) + log(8, 6),
log(24, 6) + log(3, 6) - log(12, 6),
log(25, 2) / 2 - log(10, 2),
log(54, 3) + log(6, 3) - 2 * log(2, 3),
log(27, 10) / log(81, 10),
log(Rational(4, 3), 10) + 2 * log(sqrt(75), 10),
log(sqrt(2 + sqrt(3)) - sqrt(2 - sqrt(3)), 8)]
egg = [2, 1, -1, 4, Rational(3, 4), 2, Rational(1, 6)]
for i, (s, t) in enumerate(zip(spam, egg)):
self.assertEqual(float(s), float(t))

if __name__ == '__main__':
main()


C:\Users\...>py sample19.py
19.
.
----------------------------------------------------------------------
Ran 1 test in 0.048s

OK

C:\Users\...>