2019年9月15日日曜日

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

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

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

3. $\begin{array}{l}{\mathrm{log}}_{10}0.48\\ ={\mathrm{log}}_{10}\frac{{2}^{4}·3}{1{0}^{2}}\\ =4{\mathrm{log}}_{10}2+{\mathrm{log}}_{10}3-2{\mathrm{log}}_{10}10\\ =4u+v-2\end{array}$

4. $\begin{array}{l}{\mathrm{log}}_{10}\frac{9}{\sqrt[3]{36}}\\ ={\mathrm{log}}_{10}{3}^{2}-{\mathrm{log}}_{10}{\left({2}^{2}·{3}^{2}\right)}^{\frac{1}{3}}\\ =2v-\frac{2}{3}\left({\mathrm{log}}_{10}2+{\mathrm{log}}_{10}3\right)\\ =-\frac{2}{3}u+\frac{4}{3}v\end{array}$

コード

Python 3

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

print('17.')

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

def tearDown(self):
pass

def test(self):
u = log(2, 10)
v = log(3, 10)
spam = [log(75, 10),
log(Rational(1, 81), 10),
log(Rational(48, 100), 10),
log(9 / root(36, 3), 10)]
egg = [-2 * u + v + 2,
-4 * v,
4 * u + v - 2,
-2 * u / 3 + 4 * v / 3]
for s, t in zip(spam, egg):
self.assertEqual(float(s), float(t))

if __name__ == '__main__':
main()


C:\Users\...>py sample17.py
17.
.
----------------------------------------------------------------------
Ran 1 test in 0.019s

OK

C:\Users\...>