## 2019年9月8日日曜日

### 数学 - Python - 急速・緩慢に変化する関係 - 指数関数・対数関数 - 指数関数と対数関数 - 対数 - 値を求める

1. $\begin{array}{l}{4}^{x}=8\\ {2}^{2x}={2}^{3}\\ 2x=3\\ x=\frac{3}{2}\end{array}$

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

3. $\begin{array}{l}1{0}^{x}=0.001\\ 1{0}^{x}=1{0}^{-3}\\ x=-3\end{array}$

4. $x=0$

5. $x=1$

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

7. $\begin{array}{l}{\sqrt{3}}^{x}={3}^{3}\\ {3}^{\frac{x}{2}}={3}^{3}\\ \frac{x}{2}=3\\ x=6\end{array}$

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

9. $\begin{array}{l}{5}^{-3x}={5}^{2}\\ -3x=2\\ y=-\frac{2}{3}\end{array}$

コード

Python 3

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

print('13.')

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

def tearDown(self):
pass

def test(self):
spam = [log(8, 4),
log(sqrt(2), 2),
log(Rational(1, 1000), 10),
log(1, 5),
log(5, 5),
log(1 / sqrt(1000), 10),
log(27, sqrt(3)),
log(100, Rational(1, 10)),
log(25, Rational(1, 125))]
egg = [Rational(3, 2),
Rational(1, 2),
-3,
0,
1,
-Rational(3, 2),
6,
-2,
-Rational(2, 3)]
for s, t in zip(spam, egg):
self.assertEqual(s.factor(), t)

if __name__ == '__main__':
main()

C:\Users\...>py sample13.py
13.
.
----------------------------------------------------------------------
Ran 1 test in 0.041s

OK

C:\Users\...>