2019年2月15日金曜日

数学 - Python - 大小関係を見る - 不等式 – 不等式の証明 – 相加平均と相乗平均(色々な不等式)

1. $\begin{array}{}\frac{a}{b}+\frac{b}{a}\\ \ge 2\sqrt{\frac{a}{b}·\frac{b}{a}}\\ =2\end{array}$

2. $\begin{array}{}\left(\frac{a}{b}+\frac{c}{d}\right)\left(\frac{b}{a}+\frac{d}{c}\right)\\ \ge 2\sqrt{1+\frac{ad}{bc}+\frac{bc}{ad}+1}\\ =2\sqrt{2+\frac{ad}{bc}+\frac{bc}{ad}}\\ \ge 2\sqrt{2+2\sqrt{\frac{adbc}{bcad}}}\\ \ge 2\sqrt{4}\\ =4\end{array}$

3. $\begin{array}{}x+y\\ \ge 2\sqrt{xy}\\ =\frac{2xy}{\sqrt{xy}}\end{array}$

よって、

$\sqrt{xy}\ge \frac{2xy}{x+y}$

4. $\begin{array}{}\left({x}^{3}+{y}^{3}\right)-\left({x}^{2}y+x{y}^{2}\right)\\ =\left(x+y\right)\left({x}^{2}-2xy+{y}^{2}\right)\\ =\left(x+y\right){\left(x-y\right)}^{2}\\ \ge 0\\ {x}^{3}+{y}^{3}\ge {x}^{2}y+x{y}^{2}\end{array}$

5. $\begin{array}{}\left(b+c\right)\left(c+a\right)\left(a+b\right)\\ \ge 2\sqrt{bc}2\sqrt{ca}2\sqrt{ab}\\ =8abc\end{array}$

コード

Python 3

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

print('18.')

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

for f in fs:
pprint(solve(f))
print()

p = plot3d(*fs, (a, 0.1, 5), (b, 0.1, 5))
p.xlabel = 'a'
p.ylabel = 'b'
p.save('sample18.png')


C:\Users\...> py -3 sample18.py
18.
[{a: b}]

[{a: b}]

[{a: b}]

C:\Users\...>