## 2019年9月16日月曜日

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

1. $\begin{array}{l}{\mathrm{log}}_{a}L{M}^{2}\\ ={\mathrm{log}}_{a}L+2{\mathrm{log}}_{a}M\\ =u+2v\end{array}$

2. $\begin{array}{l}{\mathrm{log}}_{a}\frac{{M}^{2}}{{L}^{3}}\\ =2{\mathrm{log}}_{a}M-3{\mathrm{log}}_{a}L\\ =-3u+2v\end{array}$

3. $\begin{array}{l}{\mathrm{log}}_{a}\frac{{L}^{2}M}{{N}^{3}}\\ =2{\mathrm{log}}_{a}L+{\mathrm{log}}_{a}M-3{\mathrm{log}}_{a}N\\ =2u+v-3w\end{array}$

4. $\begin{array}{l}{\mathrm{log}}_{a}\sqrt[3]{\frac{{M}^{2}}{N}}\\ =\frac{1}{3}\left(2{\mathrm{log}}_{a}M-{\mathrm{log}}_{a}N\right)\\ =\frac{1}{3}\left(2v-w\right)\end{array}$

5. $\begin{array}{l}{\mathrm{log}}_{a}L\sqrt{MN}\\ ={\mathrm{log}}_{a}L+\frac{1}{2}\left({\mathrm{log}}_{a}M+{\mathrm{log}}_{a}N\right)\\ =u+\frac{1}{2}\left(v+w\right)\end{array}$

6. $\begin{array}{l}{\mathrm{log}}_{a}\frac{{L}^{4}}{\sqrt{M{N}^{3}}}\\ =4{\mathrm{log}}_{a}L-\frac{1}{2}\left({\mathrm{log}}_{a}M+3{\mathrm{log}}_{a}N\right)\\ =4u-\frac{1}{2}\left(v+3w\right)\end{array}$

コード

Python 3

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

print('18.')

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(L * M ** 2, a),
log(M ** 2 / L ** 3, a),
log(L ** 2 * M / N ** 3, a),
log(root(M ** 2 / N, 3), a),
log(L * sqrt(M * N), a),
log(L ** 4 / sqrt(M * N ** 3), a)]
egg = [u + 2 * v,
-3 * u + 2 * v,
2 * u + v - 3 * w,
(2 * v - w) / 3,
u + (v + w) / 2,
4 * u - (v + 3 * w) / 2]
for i, (s, t) in enumerate(zip(spam, egg)):
self.assertAlmostEqual(float(s), float(t))

if __name__ == '__main__':
main()


C:\Users\...>py sample18.py
18.
.
----------------------------------------------------------------------
Ran 1 test in 0.024s

OK

C:\Users\...>