## 2020年7月5日日曜日

### 数学 - Python - 代数学 - 不等式 - 2次不等式 - 2次方程式が虚数解をもつ場合、判別式、符号、負

1. $3{x}^{2}+6mx-4m-1=0$
$\frac{D}{4}<0$
$9{m}^{2}+3\left(4m+1\right)<0$
$3{m}^{2}+4m+1<0$
$\left(3m+1\right)\left(m+1\right)<0$
$-1

2. ${\left(3m+2\right)}^{2}-m\left(11m+5\right)<0$
$9{m}^{2}+12m+4-11{m}^{2}-5m<0$
$-2{m}^{2}+7m+4<0$
$2{m}^{2}-7m-4>0$
$\left(2m+1\right)\left(m-4\right)>0$
$m<-\frac{1}{2},4

コード

#!/usr/bin/env python3
from sympy import pprint, symbols, plot, sqrt, Rational
from sympy.solvers.inequalities import reduce_inequalities
from sympy.abc import m, x

print('11.')

p = plot(*[(3 * x ** 2 + 6 * m * x - 4 * m - 1).subs({m: m0})
for m0 in [-1, -Rational(2, 3), -Rational(1, 3)]],
*[(m * x ** 2 + 2 * (3 * m + 2) * x + (11 * m + 5)).subs({m: m0})
for m0 in [-Rational(1, 2), (-Rational(1, 2) + 4) / 2, 4]],
(x, -10, 10),
ylim=(-10, 10),
legend=False,
show=False)

colors = ['red', 'green', 'blue', 'brown', 'orange',
'purple', 'pink', 'gray', 'skyblue', 'yellow']

for o, color in zip(p, colors):
o.line_color = color
print(o, color)
p.show()
p.save('sample11.png')


% ./sample11.py
11.
cartesian line: 3*x**2 - 6*x + 3 for x over (-10.0, 10.0) red
cartesian line: 3*x**2 - 4*x + 5/3 for x over (-10.0, 10.0) green
cartesian line: 3*x**2 - 2*x + 1/3 for x over (-10.0, 10.0) blue
cartesian line: -x**2/2 + x - 1/2 for x over (-10.0, 10.0) brown
cartesian line: 7*x**2/4 + 29*x/2 + 97/4 for x over (-10.0, 10.0) orange
cartesian line: 4*x**2 + 28*x + 49 for x over (-10.0, 10.0) purple
%