## 2019年9月1日日曜日

### 数学 - Python - 急速・緩慢に変化する関係 - 指数関数・対数関数 - 指数の拡張 - 指数の拡張(1) - 等式、解

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

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

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

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

5. $x={\left({2}^{5}\right)}^{\frac{2}{5}}=4$

コード

Python 3

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

print('10.')

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

def tearDown(self):
pass

def test(self):
x = symbols('x')
eqs = [4 ** x - 32,
10 ** x - 0.1,
Rational(1, 27) ** x - 81,
x ** -Rational(1, 2) - 2,
x ** Rational(5, 2) - 32]
xs = [Rational(5, 2), -1, -Rational(4, 3), Rational(1, 4), 4]
for eq, x0 in zip(eqs, xs):
self.assertEqual(solve(eq, x)[0], x0)

if __name__ == '__main__':
main()


C:\Users\...>py sample10.py
10.
.
----------------------------------------------------------------------
Ran 1 test in 1.751s

OK

C:\Users\...>