2019年9月8日日曜日

学習環境

新装版 数学読本2 (松坂 和夫(著)、岩波書店)の第7章(急速・緩慢に変化する関係 - 指数関数・対数関数)、7.2(指数関数と対数関数)、対数の問13の解答を求めてみる。



    1. 4 x = 8 2 2 x = 2 3 2 x = 3 x = 3 2

    2. 2 x = 2 1 2 x = 1 2

    3. 1 0 x = 0.001 1 0 x = 1 0 - 3 x = - 3

    4. x = 0

    5. x = 1

    6. 1 0 x = 1 0 - 3 2 x = - 3 2

    7. 3 x = 3 3 3 x 2 = 3 3 x 2 = 3 x = 6

    8. 1 10 x = 1 0 2 1 0 - x = 1 0 2 - x = 2 x = - 2

    9. 5 - 3 x = 5 2 - 3 x = 2 y = - 2 3

コード

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()

入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))

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

OK

C:\Users\...>

0 コメント:

コメントを投稿