## 2019年4月1日月曜日

### 数学 - Python - 解析学 - 数 - 複素数(絶対値の差、差の絶対値、等式の証明)

1. $\begin{array}{}\left|\left(\alpha -\beta \right)+\beta \right|\le \left|\alpha -\beta \right|+\left|\beta \right|\\ \left|\alpha \right|\le \left|\alpha -\beta \right|+\left|\beta \right|\\ \left|\alpha \right|-\left|\beta \right|\le \left|\alpha -\beta \right|\\ \left|\beta \right|-\left|\alpha \right|\le \left|\beta -\alpha \right|\\ \left|\alpha \right|-\left|\beta \right|\ge -\left|\beta -\alpha \right|\\ \left|\alpha \right|-\left|\beta \right|\ge -\left|\alpha -\beta \right|\end{array}$

よって、

$\begin{array}{}-\left|\alpha -\beta \right|\le \left|\alpha \right|-\left|\beta \right|\le \left|\alpha -\beta \right|\\ \left|\left|\alpha \right|-\left|\beta \right|\right|\le \left|\alpha -\beta \right|\end{array}$

（証明終）

コード

Python 3

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

print('5.')

# 上手くいかず
a, b = symbols('a, b', imag=True)
l = abs(abs(a) - abs(b))
r = abs(a - b)

for o in [l, r, (l - r).expand() >= 0]:
pprint(o)
print()

# 実数で構築
a, b, c, d = symbols('a, b, c, d', real=True)
alpha = a + b * I
beta = c + d * I

l = abs(abs(alpha) - abs(beta))
r = abs(alpha - beta)
for o in [l, r, (l - r) >= 0]:
pprint(o)
print()

l = sqrt(sqrt(a ** 2 + b ** 2) - sqrt(c ** 2 + d ** 2))
r = sqrt((a - c) ** 2 + (b - d) ** 2)

for o in [l, r, (l - r).expand() >= 0]:
pprint(o)
print()

C:\Users\...>py -3 sample5.py
5.
││a│ - │b││

│a - b│

-│a - b│ + ││a│ - │b││ ≥ 0

│   _________      _________│
│  ╱  2    2      ╱  2    2 │
│╲╱  a  + b   - ╲╱  c  + d  │

___________________________________
╱  2            2            2    2
╲╱  a  - 2⋅a⋅c + b  - 2⋅b⋅d + c  + d

___________________________________   │   _________      _________│
╱  2            2            2    2    │  ╱  2    2      ╱  2    2 │
- ╲╱  a  - 2⋅a⋅c + b  - 2⋅b⋅d + c  + d   + │╲╱  a  + b   - ╲╱  c  + d  │ ≥ 0

_____________________________
╱    _________      _________
╱    ╱  2    2      ╱  2    2
╲╱   ╲╱  a  + b   - ╲╱  c  + d

_____________________
╱        2          2
╲╱  (a - c)  + (b - d)

_____________________________
╱    _________      _________       ___________________________________
╱    ╱  2    2      ╱  2    2       ╱  2            2            2    2
╲╱   ╲╱  a  + b   - ╲╱  c  + d    - ╲╱  a  - 2⋅a⋅c + b  - 2⋅b⋅d + c  + d   ≥ 0

C:\Users\...>