学習環境
新装版 数学読本2 (松坂 和夫(著)、岩波書店)の第7章(急速・緩慢に変化する関係 - 指数関数・対数関数)、7.2(指数関数と対数関数)、指数関数の性質の問12の解答を求めてみる。
0.2x≥1(15)x≥15-x≥50-x≥0x≤0
(13)x≤273-x≤33-x≤3x≥-3
0.125<0.5x<1(0.5)3<0.5x<0.500<x<3
コード
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 コメント:
コメントを投稿