学習環境
- Surface、Surface ペン(端末)
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad Pro 10.5 + Apple Pencil
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
新装版 数学読本2 (松坂 和夫(著)、岩波書店)の第7章(急速・緩慢に変化する関係 - 指数関数・対数関数)、7.2(指数関数と対数関数)、指数関数の性質の問12の解答を求めてみる。
コード
Python 3
#!/usr/bin/env python3 from sympy import pprint, symbols, sqrt, root, Rational, plot from sympy.solvers.inequalities import reduce_inequalities print('12.') x = symbols('x') inequalities = [4 ** x > 32, 0.2 ** x >= 1, Rational(1, 3) ** x <= 27, (0.125 < 0.5 ** x, 0.5 ** x < 1)] for i, inequality in enumerate(inequalities, 1): print(f'({i})') try: pprint(reduce_inequalities(inequality, x).expand()) except Exception as err: pprint(reduce_inequalities(inequality, x)) print() fss = [((4 ** x, 32), (0, 35)), ((0.2 ** x, 1), (0, 2)), ((Rational(1, 3) ** x, 27), (0, 30)), ((0.125, 0.5 ** x, 1), (0, 2))] for i, (fs, (y1, y2)) in enumerate(fss, 1): p = plot(*fs, ylim=(y1, y2), legend=True, show=False) colors = ['red', 'green', 'blue', 'brown', 'orange', 'purple', 'pink', 'gray', 'skyblue', 'yellow'] for s, color in zip(p, colors): s.line_color = color p.show() p.save(f'sample12_{i}.png')
入出力結果(Bash、cmd.exe(コマンドプロンプト)、Terminal、Jupyter(IPython))
C:\Users\...>py sample12.py 12. (1) 5/2 < x (2) x ≤ 0 (3) -3 ≤ x (4) 0 < x ∧ x < 3.0 C:\Users\...>
0 コメント:
コメントを投稿