学習環境
- Surface
- Windows 10 Pro (OS)
- Nebo(Windows アプリ)
- iPad
- MyScript Nebo - MyScript(iPad アプリ(iOS))
- 参考書籍
代数への出発 (新装版 数学入門シリーズ) (松坂 和夫(著)、岩波書店)の第7章(不等式)、1(1次不等式)の問3の解答を求めてみる。
よって、求める x の範囲は
コード
#!/usr/bin/env python3
from sympy import pprint, plot
from sympy.abc import x
from sympy.solvers.inequalities import reduce_inequalities
print('3.')
f = -2 * x + 4
g = 3 * x - 5
h = x + 7
pprint(reduce_inequalities([f <= g, g < h], x))
p = plot(f, g, h,
(x, -10, 10),
ylim=(-5, 15),
legend=True,
show=False)
colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']
for o, color in zip(p, colors):
o.line_color = color
p.show()
p.save('sample3.png')
入出力結果(Zsh、PowerShell、Terminal、Jupyter(IPython))
% ./sample3.py
3.
9/5 ≤ x ∧ x < 6
%
0 コメント:
コメントを投稿