Processing math: 100%

2019年2月2日土曜日

学習環境

数学読本〈1〉数・式の計算/方程式/不等式 (松坂 和夫(著)、岩波書店)の第4章(大小関係を見る - 不等式)、4.2(不等式の解法)、2次不等式の問9の解答を求めてみる。



    1. x<-32,2<x

    2. x<-4,52<x

    3. (x-3)(x-4)<03<x<4

    4. (x-6)(x+4)0-4x6

    5. x=2±4-2=2±2x2-2,2+2x

    6. x=-1±1+802(-2)=-1±9-4=-2,52-2<x<52

    7. (x+4)2>0-{-4}

    8. x=0

    9. D=1-4<0

    10. 4x2-6x+5<0D4=9-20<0ϕ

    11. 10x2-5x+2>0D=25-80<0

    12. x2+2x-40D4=1+4=5x=-1±5-1-5x-1+5

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, plot
from sympy.solvers.inequalities import reduce_inequalities

print('9.')

x = symbols('x')
ts = [(x - 2) * (2 * x + 3) > 0,
      (4 + x) * (5 - 2 * x) <= 0,
      x ** 2 - 7 * x + 12 < 0,
      x ** 2 - 2 * x - 24 <= 0,
      x ** 2 - 4 * x + 2 >= 0,
      10 + x - 2 * x ** 2 > 0,
      x ** 2 + 8 * x + 16 > 0,
      -2 * x ** 2 >= 0,
      x ** 2 - x + 1 > 0,
      4 * x ** 2 + 5 < 6 * x,
      5 * x - 10 * x ** 2 < 2,
      2 * x ** 2 + 3 * x - 4 <= x ** 2 + x]

for i, t in enumerate(ts, 1):
    print(f'({i})')
    pprint(reduce_inequalities(t))
    print()

p = plot(2 * x ** 2 + 3 * x - 4, x ** 2 + x, legend=True, show=False)
colors = ['red', 'green']
for i, _ in enumerate(p):
    p[i].line_color = colors[i]

p.save('sample9.png')

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

$ python3 sample9.py
9.
(1)
(-∞ < x ∧ x < -3/2) ∨ (2 < x ∧ x < ∞)

(2)
(5/2 ≤ x ∧ x < ∞) ∨ (x ≤ -4 ∧ -∞ < x)

(3)
3 < x ∧ x < 4

(4)
-4 ≤ x ∧ x ≤ 6

(5)
(x ≤ -√2 + 2 ∧ -∞ < x) ∨ (√2 + 2 ≤ x ∧ x < ∞)

(6)
-2 < x ∧ x < 5/2

(7)
x > -∞ ∧ x < ∞ ∧ x ≠ -4

(8)
x = 0

(9)
-∞ < x ∧ x < ∞

(10)
False

(11)
-∞ < x ∧ x < ∞

(12)
x ≤ -1 + √5 ∧ -√5 - 1 ≤ x

$

0 コメント:

コメントを投稿