## 2019年4月5日金曜日

### 数学 - Python - 解析学 - 数 - 複素数(実数でない複素数、平方、等式、解)

1. $\begin{array}{}z=c+di\\ c,d\in \text{ℝ}\end{array}$

とおく。

$\begin{array}{}{z}^{2}\\ =\left({c}^{2}-{d}^{2}\right)+2cdi\\ {c}^{2}-{d}^{2}=a\\ 2cd=b\\ {c}^{4}+{d}^{4}-2{c}^{2}{d}^{2}={a}^{2}\\ 4{c}^{2}{d}^{2}={b}^{2}\\ {c}^{2}+{d}^{2}+2{c}^{2}\mathrm{dz}={a}^{2}+{b}^{2}\\ {\left({c}^{2}+{d}^{2}\right)}^{2}={a}^{2}+{b}^{2}\\ {c}^{2}+{d}^{2}=\sqrt{{a}^{2}+{b}^{2}}\\ 2{c}^{2}=a+\sqrt{{a}^{2}+{b}^{2}}\\ {c}^{2}=\frac{a+\sqrt{{a}^{2}+{b}^{2}}}{2}\\ {d}^{2}=\frac{-a+\sqrt{{a}^{2}+{b}^{2}}}{2}\end{array}$

符号について。

$\begin{array}{}b<0\\ c=±\sqrt{\frac{a+\sqrt{{a}^{2}+{b}^{2}}}{2}}\\ d=\mp \frac{\sqrt{-a+\sqrt{{a}^{2}+{b}^{2}}}}{2}\\ b>0\\ c=±\sqrt{\frac{a+\sqrt{{a}^{2}+{b}^{2}}}{2}}\right)\\ d=±\sqrt{\frac{-a+\sqrt{{a}^{2}+{b}^{2}}}{z}}\right)\end{array}$

（複号同順）
よって求める複素数は、

$\begin{array}{}b<0\\ z=±\sqrt{\frac{a+\sqrt{{a}^{2}+{b}^{2}}}{2}}\mp \sqrt{\frac{-a+\sqrt{{a}^{2}+{b}^{2}}}{2}}i\\ b>0\\ z=±\sqrt{\frac{a+\sqrt{{a}^{2}+{b}^{2}}}{z}}±\sqrt{\frac{-\alpha +\sqrt{{a}^{2}+{b}^{2}}}{2}}i\end{array}$

（複号同順）

コード

Python 3

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

print('9.')

a, c, d = symbols('a, c, d', real=True)
b = symbols('b', real=True, nonzero=True)
alpha = a + b * I
z = c + d * I
eq = z ** 2 - alpha

for o in [alpha, eq]:
pprint(o)
print()

for d in solve(eq, c, d, dict=True):
for k, v in d.items():
print(f'{k} = ')
pprint(v)
print()
print()


C:\Users\...>py sample9.py
9.
a + ⅈ⋅b

2
-a - ⅈ⋅b + (c + ⅈ⋅d)

c =
____________________
╱          _________  ⎛       _________⎞
╱          ╱  2    2   ⎜      ╱  2    2 ⎟
╱     a   ╲╱  a  + b    ⎜a   ╲╱  a  + b  ⎟
-2⋅  ╱    - ─ - ──────────── ⋅⎜─ - ────────────⎟
╲╱       2        2        ⎝2        2      ⎠
─────────────────────────────────────────────────
b

d =
____________________
╱          _________
╱          ╱  2    2
╱     a   ╲╱  a  + b
-  ╱    - ─ - ────────────
╲╱       2        2

c =
____________________
╱          _________  ⎛       _________⎞
╱          ╱  2    2   ⎜      ╱  2    2 ⎟
╱     a   ╲╱  a  + b    ⎜a   ╲╱  a  + b  ⎟
2⋅  ╱    - ─ - ──────────── ⋅⎜─ - ────────────⎟
╲╱       2        2        ⎝2        2      ⎠
───────────────────────────────────────────────
b

d =
____________________
╱          _________
╱          ╱  2    2
╱     a   ╲╱  a  + b
╱    - ─ - ────────────
╲╱       2        2

c =
____________________
╱          _________  ⎛       _________⎞
╱          ╱  2    2   ⎜      ╱  2    2 ⎟
╱     a   ╲╱  a  + b    ⎜a   ╲╱  a  + b  ⎟
-2⋅  ╱    - ─ + ──────────── ⋅⎜─ + ────────────⎟
╲╱       2        2        ⎝2        2      ⎠
─────────────────────────────────────────────────
b

d =
____________________
╱          _________
╱          ╱  2    2
╱     a   ╲╱  a  + b
-  ╱    - ─ + ────────────
╲╱       2        2

c =
____________________
╱          _________  ⎛       _________⎞
╱          ╱  2    2   ⎜      ╱  2    2 ⎟
╱     a   ╲╱  a  + b    ⎜a   ╲╱  a  + b  ⎟
2⋅  ╱    - ─ + ──────────── ⋅⎜─ + ────────────⎟
╲╱       2        2        ⎝2        2      ⎠
───────────────────────────────────────────────
b

d =
____________________
╱          _________
╱          ╱  2    2
╱     a   ╲╱  a  + b
╱    - ─ + ────────────
╲╱       2        2

C:\Users\...>