## 2019年1月13日日曜日

### 数学 – Python - 数学はここから始まる - 数 – 等式の証明 – 比例式(定数、証明)

1. $\frac{a}{b}=\frac{c}{d}=k$

とおく。

$\begin{array}{}a=bk,c=dk\\ \frac{pa+qc}{pb+qd}\\ =\frac{pbk+qdk}{pb+qd}\\ =\frac{\left(pb+qd\right)k}{pb+qd}\\ =k\end{array}$

よって問題の比例式は成り立つ。

（証明終）

2. 左辺について。

$\begin{array}{}\frac{{\left(a+b\right)}^{2}}{ab}\\ =\frac{{\left(bk+b\right)}^{2}}{bkb}\\ =\frac{{\left(k+1\right)}^{2}}{k}\end{array}$

右辺について。

$\begin{array}{}\frac{{\left(c+d\right)}^{2}}{cd}\\ =\frac{{\left(dk+d\right)}^{2}}{dkd}\\ =\frac{{\left(k+1\right)}^{2}}{k}\end{array}$

3. $\begin{array}{}\frac{{\left(bk\right)}^{2}+{\left(dk\right)}^{2}}{bkb+dkd}\\ =k\\ \frac{bkb+dkd}{{b}^{2}+{d}^{2}}\\ =k\end{array}$

4. $\begin{array}{}\frac{{\left(bk-dk\right)}^{2}}{{\left(b-d\right)}^{2}}\\ ={k}^{2}\\ \frac{{\left(bk\right)}^{2}+{\left(dk\right)}^{2}}{{b}^{2}+{d}^{2}}\\ ={k}^{2}\end{array}$

コード

Python 3

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

print('46.')

a, b, c, d, k, p, q = symbols('a, b, c, d, k, p, q')

ts = [(k, (p * a + q * c) / (p * b + q * d)),
((a + b) ** 2 / (a * b), (c + d) ** 2 / (c * d)),
((a ** 2 + c ** 2) / (a * b + c * d),
(a * b + c * d) / (b ** 2 + d ** 2)),
((a - c) ** 2 / (b - d) ** 2, (a ** 2 + c ** 2) / (b ** 2 + d ** 2))]

for i, (l, r) in enumerate(ts, 1):
print(f'({i})')
print((l - r).subs({a: b * k, c: d * k}).simplify() == 0)
print()


$./sample46.py 46. (1) True (2) True (3) True (4) True$