2019年8月28日水曜日

数学 - Python - 急速・緩慢に変化する関係 - 指数関数・対数関数 - 指数の拡張 - 指数の拡張(1) - 2の累乗(べき乗)、計算

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

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

3. $\begin{array}{l}{\left({2}^{6}\right)}^{\frac{7}{6}}\\ ={2}^{7}\\ =128\end{array}$

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

コード

Python 3

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

print('7.')

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

def tearDown(self):
pass

def test(self):
spam = [0.5, Rational(1, 3), Rational(7, 6), -Rational(3, 2)]
egg = [8, 4, 128, Rational(1, 512)]
for s, t in zip(spam, egg):
self.assertEqual(64 ** s, t)

if __name__ == '__main__':
main()


C:\Users\...>py sample7.py
7.
.
----------------------------------------------------------------------
Ran 1 test in 0.002s

OK

C:\Users\...>