## 2019年2月12日火曜日

### 数学 - Python - 大小関係を見る - 不等式 – 不等式の証明 – 平方和の性質(因数分解、累乗(平方))

1. $\begin{array}{}\left({a}^{2}+{b}^{2}\right)\left({x}^{2}+{y}^{2}\right)-{\left(ax+by\right)}^{2}\\ ={a}^{2}{x}^{2}+{a}^{2}{y}^{2}+{b}^{2}{x}^{2}+{b}^{2}{y}^{2}-\left({a}^{2}{x}^{2}+{b}^{2}{y}^{2}+2abxy\right)\\ ={a}^{2}{y}^{2}+{b}^{2}{x}^{2}-2abxy\\ ={\left(bx-ay\right)}^{2}\\ \ge 0\end{array}$

2. $\begin{array}{}{a}^{4}+{b}^{4}-\left({a}^{3}b+a{b}^{3}\right)\\ =\left({a}^{2}-2ab+{b}^{2}\right)\left({a}^{2}+ab+{b}^{2}\right)\\ ={\left(a-b\right)}^{2}\left({a}^{2}+ab+{b}^{2}\right)\\ a-b\ge 0\\ {a}^{2}+ab+{b}^{2}\\ ={\left(a+\frac{1}{2}b\right)}^{2}+\frac{3}{4}{b}^{2}\\ \ge 0\end{array}$

よって、

${a}^{4}+{b}^{4}-\left({a}^{3}b+a{b}^{3}\right)\ge 0$

3. $\begin{array}{}{a}^{2}+{b}^{2}+{c}^{2}+3-2\left(a+b+c\right)\\ ={\left(a-1\right)}^{2}+{\left(b-1\right)}^{2}+{\left(c-1\right)}^{2}\\ \ge 0\end{array}$

（証明終）

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols

print('16.')

a, b, c, x, y = symbols('a, b, c, x, y')
fs = [(a ** 2 + b ** 2) * (x ** 2 + y ** 2) - (a * x + b * y) ** 2,
(a ** 4 + b ** 4) - (a ** 3 * b + a * b ** 3),
(a ** 2 + b ** 2 + c ** 2 + 3) - 2 * (a + b + c)]

for i, f in enumerate(fs, 1):
print(f'({i})')
pprint(f.factor())
print()


C:\Users\...> py -3 sample16.py
16.
(1)
2
(-a⋅y + b⋅x)

(2)
2 ⎛ 2          2⎞
(a - b) ⋅⎝a  + a⋅b + b ⎠

(3)
2          2          2
a  - 2⋅a + b  - 2⋅b + c  - 2⋅c + 3

C:\Users\...>