## 2019年1月11日金曜日

### 数学 – Python - 数学はここから始まる - 数 – 等式の証明 – 条件つきの等式(代入、差、零)

1. $\begin{array}{}c=-\left(a+b\right)\\ {a}^{2}-bc\\ ={a}^{2}+b\left(a+b\right)\\ ={a}^{2}+{b}^{2}+ab\\ {b}^{2}-ca\\ ={b}^{2}+\left(a+b\right)a\\ ={a}^{2}+{b}^{2}+ab\\ {c}^{2}-ab\\ ={a}^{2}+{b}^{2}+2ab-ab\\ ={a}^{2}+{b}^{2}+ab\end{array}$

よって、等式

${a}^{2}-bc={b}^{2}-ca={c}^{2}-ab$

は成り立つ。

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

3. $\begin{array}{}{\left(a+b+c\right)}^{3}\\ ={a}^{3}+3{a}^{2}\left(b+c\right)+3a{\left(b+c\right)}^{2}+{\left(b+c\right)}^{3}\\ ={a}^{3}+3{a}^{2}\left(b+c\right)+3a{\left(b+c\right)}^{2}+{b}^{3}+3{b}^{2}c+3b{c}^{2}+{c}^{3}\\ =\left({a}^{3}+{b}^{3}+{c}^{3}\right)+\left(b+c\right)\left(3{a}^{2}+3a\left(b+c\right)+3bc\right)\\ =\left({a}^{3}+{b}^{3}+{c}^{3}\right)+3\left(b+c\right)\left({a}^{2}+ab+ac+bc\right)\\ =\left({a}^{3}+{b}^{3}+{c}^{3}\right)+3\left(a+b\right)\left(b+c\right)\left(c+a\right)\end{array}$

よって、

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

コード

Python 3

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

print('45.')

a, b, c = symbols('a, b, c')

ts = [[(a ** 2 - b * c) - (b ** 2 - c * a),
(b ** 2 - c * a) - (c ** 2 - a * b)],
[(b ** 2 - c ** 2) / a - (c ** 2 - a ** 2) / b,
(c ** 2 - a ** 2) / b - (a ** 2 - b ** 2) / c],
[a ** 3 + b ** 3 + c ** 3 - 3 * a * b * c]]

for i, t in enumerate(ts, 1):
print(f'({i})')
pprint(solve(*(t + [a + b + c]), a, b, c))
print()


$./sample45.py 45. (1) [{a: b}, {c: -a - b}] (2) ⎡ ⎧ _______________⎫ ⎧ _______________⎫⎤ ⎢ ⎪ ╱ 2 2 ⎪ ⎪ ╱ 2 2 ⎪⎥ ⎢ ⎨ b ╲╱ - 3⋅b + 4⋅c ⎬ ⎨ b ╲╱ - 3⋅b + 4⋅c ⎬⎥ ⎢{a: -b}, ⎪a: ─ - ──────────────────⎪, ⎪a: ─ + ──────────────────⎪⎥ ⎣ ⎩ 2 2 ⎭ ⎩ 2 2 ⎭⎦ (3) ⎡ ⎧ b √3⋅ⅈ⋅b c √3⋅ⅈ⋅c⎫ ⎧ b √3⋅ⅈ⋅b c √3⋅ⅈ⋅c⎫⎤ ⎢{a: -b - c}, ⎨a: ─ - ────── + ─ + ──────⎬, ⎨a: ─ + ────── + ─ - ──────⎬⎥ ⎣ ⎩ 2 2 2 2 ⎭ ⎩ 2 2 2 2 ⎭⎦$