## 2019年9月9日月曜日

### 数学 - Python - 急速・緩慢に変化する関係 - 指数関数・対数関数 - 指数関数と対数関数 - 対数 - 真数、底数、等式、解

1. $\begin{array}{l}{3}^{2}=x\\ x=9\end{array}$

2. $x={4}^{·1}=\frac{1}{4}$

3. $\begin{array}{l}x=8{1}^{\frac{1}{4}}\\ ={\left({3}^{4}\right)}^{\frac{1}{4}}\\ =3\end{array}$

4. $\begin{array}{l}x={\left(0.2\right)}^{-2}\\ ={\left(\frac{1}{5}\right)}^{-2}\\ =25\end{array}$

5. $\begin{array}{l}{x}^{2}=25\\ {x}^{2}={5}^{2}\\ x=5\end{array}$

6. $\begin{array}{l}{x}^{-3}=\frac{1}{1000}\\ =1{0}^{-3}\\ x=10\end{array}$

7. $\begin{array}{l}{x}^{4}={2}^{8}\\ {x}^{4}={\left({2}^{2}\right)}^{4}\\ x=4\end{array}$

8. $\begin{array}{l}{x}^{-2}=4\\ {x}^{-2}={2}^{2}\\ {x}^{-2}=\frac{1}{{2}^{-2}}\\ {x}^{-2}={\left(\frac{1}{2}\right)}^{-2}\\ x=\frac{1}{2}\end{array}$

9. $\begin{array}{l}{x}^{\frac{1}{4}}=\sqrt{3}\\ ={3}^{\frac{1}{2}}\\ ={\left({3}^{2}\right)}^{\frac{1}{4}}\\ x=9\end{array}$

コード

Python 3

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

print('14.')

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

def tearDown(self):
pass

def test(self):
x = symbols('x')
eqs = [log(x, 3) - 2,
log(x, 4) + 1,
log(x, 81) - Rational(1, 4),
log(x, Rational(1, 5)) + 2,
log(25, x) - 2,
log(Rational(1, 1000), x) + 3,
log(256, x) - 4,
log(4, x) + 2,
log(sqrt(3), x) - Rational(1, 4)]
egg = [9,
Rational(1, 4),
3,
25,
5,
10,
4,
Rational(1, 2),
9]

for s, t in zip(eqs, egg):
self.assertEqual(solve(s), [t])

if __name__ == '__main__':
main()


C:\Users\...>py sample14.py
14.
.
----------------------------------------------------------------------
Ran 1 test in 0.491s

OK

C:\Users\...>