## 2019年10月1日火曜日

### 数学 - Python - 代数学 - 実数 - 平方根を含む式の計算 - 変形、素因数分解、累乗

1. $\begin{array}{l}\sqrt{32}\\ =\sqrt{{2}^{5}}\\ =4\sqrt{2}\end{array}$

2. $\begin{array}{l}\sqrt{1.08}\\ =\sqrt{\frac{108}{100}}\\ =\frac{\sqrt{{2}^{2}·{3}^{3}}}{10}\\ =\frac{2·3\sqrt{3}}{10}\\ =\frac{3\sqrt{3}}{5}\end{array}$

3. $\begin{array}{l}\sqrt{45}\sqrt{63}\\ =\sqrt{{3}^{2}·5}\sqrt{{3}^{2}·7}\\ =9\sqrt{35}\end{array}$

4. $\begin{array}{l}\sqrt{0.25}\\ =\sqrt{\frac{25}{100}}\\ =\frac{5}{10}\\ =\frac{1}{2}\end{array}$

5. $\begin{array}{l}\frac{\sqrt{72}}{\sqrt{18}}\\ =\sqrt{\frac{72}{18}}\\ =\sqrt{4}\\ =2\end{array}$

6. $\begin{array}{l}\sqrt{\frac{75}{16}}\\ =\sqrt{\frac{3·{5}^{2}}{{2}^{4}}}\\ =\frac{5\sqrt{3}}{4}\end{array}$

コード

Python 3

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

print('14.')

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

def tearDown(self):
pass

def test(self):
spam = [sqrt(32),
sqrt(Rational(108, 100)),
sqrt(45) * sqrt(63),
sqrt(Rational(25, 100)),
sqrt(72) / sqrt(18),
sqrt(Rational(75, 16))]
egg = [4 * sqrt(2),
3 * sqrt(3) / 5,
9 * sqrt(35),
Rational(1, 2),
2,
5 * sqrt(3) / 4]
for s, t in zip(spam, egg):
self.assertEqual(s, t)

if __name__ == '__main__':
main()


$./sample14.py 14. . ---------------------------------------------------------------------- Ran 1 test in 0.011s OK$