## 2019年2月19日火曜日

### 数学 - Python - 大小関係を見る - 不等式 – 不等式の証明 – 平方による比較(平方根)

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

よって、

$\begin{array}{}2\left(a+b\right)\ge {\left(\sqrt{a}+\sqrt{b}\right)}^{2}\\ \sqrt{2\left(a+b\right)}\ge \sqrt{a}+\sqrt{b}\end{array}$

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

コード

Python 3

#!/usr/bin/env python3
from sympy import pprint, symbols, sqrt, solve
from sympy.plotting import plot3d

print('21.')

a, b = symbols('a, b', positive=True)
fs = [sqrt(2 * (a + b)) - (sqrt(a) + sqrt(b)),
sqrt(3 * (a + b)) - (sqrt(2 * a) + sqrt(b))]

for i, f in enumerate(fs, 1):
print(f'({i})')
pprint(solve(f))
print()
p = plot3d(*fs, (a, 0, 10), (b, 0, 10), show=False)
p.xlabel = a
p.ylabel = b

p.show()
p.save('sample21.png')


C:\Users\...> py -3 sample19.py
21.
21.
(1)
[{a: b}]

(2)
[{a: 2⋅b}]

C:\Users\...>