|
|
각도 (\theta)
벡터 (\mathbf v)
복소위상 (e^{i\theta})
두 번 적용하면 원래 상태로 돌아오는 변환 (B)
리만구 좌표 ((X,Y,Z))
뫼비우스 변환
공명행렬
방향질서 (R_1)
180도 축질서 (R_2)
다른 인공지능은 결과를 반드시 다음 네 종류로 구분해야 한다.
구분의미
| THEOREM | 수학적으로 증명된 항등식·정리 |
| NUMERICAL | 유한정밀도 계산으로 확인한 결과 |
| MODEL | 선택한 표현법·계산모형 |
| HYPOTHESIS | 아직 독립적으로 검증되지 않은 물리적 해석 |
[
\boxed{
\text{HYPOTHESIS를 THEOREM으로 바꾸어 출력하면 안 된다.}
}
]
2. 각도는 일반 실수가 아니라 원 위의 값이다
각도는 (2\pi) 주기를 가진다.
[
\theta
\sim
\theta+2\pi k,
\qquad
k\in\mathbb Z
]
예를 들어,
[
0^\circ=360^\circ
]
이다.
따라서 두 각도의 차이를 일반 뺄셈만으로 계산하면 오류가 발생한다.
예:
[
359^\circ-1^\circ=358^\circ
]
이지만 실제 최소 각도차는
[
2^\circ
]
이다.
2.1 각도 표준화
모든 각도를
[
[0,2\pi)
]
범위로 변환한다.
[
\boxed{
\operatorname{wrap}(\theta)
\theta\bmod2\pi
}
]
2.2 부호가 있는 최소 각도차[
\boxed{
\Delta(\theta_a,\theta_b)
\operatorname{Arg}
\left(
e^{i(\theta_a-\theta_b)}
\right)
}
]
범위는
[
-\pi<\Delta\le\pi
]
이다.
최소 원형거리는
[
\boxed{
d(\theta_a,\theta_b)
|\Delta(\theta_a,\theta_b)|
}
]
이다.
정리 1. 원형거리의 주기불변성
임의의 정수 (m,n)에 대해
[
d(\theta_a+2\pi m,\theta_b+2\pi n)
d(\theta_a,\theta_b)
]
이다.
증명
[
e^{i[(\theta_a+2\pi m)-(\theta_b+2\pi n)]}
]
[
e^{i(\theta_a-\theta_b)}
e^{i2\pi(m-n)}
]
이고,
[
e^{i2\pi(m-n)}=1
]
이므로 두 복소위상은 같다. 따라서 최소 각도차도 같다.
3. 벡터와 각도
2차원 벡터는 크기 (r)와 방향각 (\theta)로 표현할 수 있다.
[
\boxed{
\mathbf v
r
\begin{pmatrix}
\cos\theta\
\sin\theta
\end{pmatrix}
}
]
성분은
[
x=r\cos\theta
]
[
y=r\sin\theta
]
이다.
반대로 벡터 ((x,y))에서 크기와 각도를 계산하면
[
r=\sqrt{x^2+y^2}
]
[
\theta=\operatorname{atan2}(y,x)
]
이다.
4. 복소위상
오일러 공식은
[
\boxed{
e^{i\theta}
\cos\theta+i\sin\theta
}
]
이다.
복소수
[
z=re^{i\theta}
]
는 다음 두 정보를 동시에 가진다.
크기 (r)
각도 또는 위상 (\theta)
복소수를 곱하면 크기는 곱해지고 각도는 더해진다.
[
r_1e^{i\theta_1}
r_2e^{i\theta_2}
r_1r_2e^{i(\theta_1+\theta_2)}
]
따라서 복소곱은 확대·축소와 회전을 동시에 계산하는 연산이다.
5. 인공지능에는 원시각도 대신 주기특징을 입력한다
인공지능에 (\theta)만 입력하면 (0)과 (2\pi)가 멀리 떨어진 값처럼 보일 수 있다.
따라서 다음 특징을 사용한다.
[
\boxed{
\Phi(\theta)
(
\cos\theta,
\sin\theta,
\cos2\theta,
\sin2\theta
)
}
]
첫 번째 쌍
[
(\cos\theta,\sin\theta)
]
은 화살표 방향을 표현한다.
두 번째 쌍
[
(\cos2\theta,\sin2\theta)
]
은 180도 반대방향을 동일한 축으로 표현한다.
정리 2. 180도 축특징의 불변성[
\Phi_2(\theta)
(\cos2\theta,\sin2\theta)
]
라고 하면
[
\boxed{
\Phi_2(\theta+\pi)=\Phi_2(\theta)
}
]
이다.
증명
[
\cos(2\theta+2\pi)=\cos2\theta
]
[
\sin(2\theta+2\pi)=\sin2\theta
]
이므로 성립한다.
6. 이진변환의 정의
ZPX에서 이진변환은 같은 연산을 두 번 적용하면 원래 상태로 돌아오는 변환이다.
[
\boxed{
B^2=I
}
]
이러한 변환을 수학에서는 대합변환 또는 involution이라고 한다.
예:
2차원 180도 회전
3차원 축 둘레 180도 회전
두 공간시트의 교환
(\Omega\leftrightarrow-\Omega)
(\psi\mapsto-\psi)
두 번 수행하면 원래 상태로 돌아오는 상태교환
7. 2차원 180도 회전
2차원 회전행렬은
[
R(\alpha)
\begin{pmatrix}
\cos\alpha&-\sin\alpha\
\sin\alpha&\cos\alpha
\end{pmatrix}
]
이다.
[
\alpha=\pi
]
이면
[
R(\pi)\begin{pmatrix}
-1&0\
0&-1
\end{pmatrix}
-I_2
]
이다.
따라서
[
R(\pi)\mathbf v=-\mathbf v
]
이고,
[
R(\pi)^2=I_2
]
이다.
8. 3차원 180도 회전
3차원에서 단순히
[
-I_3
]
를 사용하는 것은 특정 축 둘레의 정상적인 회전과 다르다.
단위 회전축을 (\mathbf n)이라고 하면 180도 회전행렬은
[
\boxed{
R_{\mathbf n}(\pi)
2\mathbf n\mathbf n^{\mathsf T}-I_3
}
]
이다.
정리 3. 3차원 반회전의 이진성
[
\boxed{
R_{\mathbf n}(\pi)^2=I_3
}
]
이다.
증명
[
R=2\mathbf n\mathbf n^{\mathsf T}-I
]
라고 하자.
단위벡터이므로
[
\mathbf n^{\mathsf T}\mathbf n=1
]
이다.
[
R^2
(2\mathbf n\mathbf n^{\mathsf T}-I)^2
]
[4\mathbf n
(\mathbf n^{\mathsf T}\mathbf n)
\mathbf n^{\mathsf T}
4\mathbf n\mathbf n^{\mathsf T}
+
I
]
[4\mathbf n\mathbf n^{\mathsf T}
4\mathbf n\mathbf n^{\mathsf T}
+
I
]
[
=I
]
이다.
8.1 벡터성분 해석
벡터를 회전축 성분과 수직성분으로 나눈다.
[
\mathbf v
\mathbf v_\parallel+\mathbf v_\perp
]
그러면
[
R_{\mathbf n}(\pi)\mathbf v
\mathbf v_\parallel-\mathbf v_\perp
]
이다.
즉,
축방향 성분은 유지된다.
축에 수직인 성분은 반전된다.
9. 위상공명 공식
두 위상 (\theta_a,\theta_b)의 공명값을 다음과 같이 정의한다.
[
\boxed{
P(\theta_a,\theta_b)
1+\cos(\theta_a-\theta_b)
}
]
범위는
[
0\le P\le2
]
이다.
위상차(P)의미
| (0) | 2 | 동위상 |
| (\pi/2) | 1 | 직교위상 |
| (\pi) | 0 | 반대위상 |
단위벡터를
[
\mathbf u(\theta)
\begin{pmatrix}
\cos\theta\
\sin\theta
\end{pmatrix}
]
라고 하면
[
\mathbf u(\theta_a)\cdot\mathbf u(\theta_b)
\cos(\theta_a-\theta_b)
]
이다.
따라서
[
\boxed{
P_{ab}
1+\mathbf u_a\cdot\mathbf u_b
}
]
이다.
즉 위상공명은 벡터내적에 1을 더한 값이다.
10. 위상공명행렬
여러 위상
[
\theta_1,\ldots,\theta_N
]
에 대해
[
P_{ij}
1+\cos(\theta_i-\theta_j)
]
로 행렬을 정의한다.
특징벡터를
[
\mathbf q_i
\begin{pmatrix}
1\
\cos\theta_i\
\sin\theta_i
\end{pmatrix}
]
라고 하면
[
P_{ij}
\mathbf q_i^{\mathsf T}\mathbf q_j
]
이다.
정리 4. 공명행렬의 양의 준정부호성
[
\boxed{
P\succeq0
}
]
이다.
증명
임의의 벡터 (\mathbf c)에 대해
[
\mathbf c^{\mathsf T}P\mathbf c
\sum_{i,j}
c_ic_j
\mathbf q_i^{\mathsf T}\mathbf q_j
]
[
\left|
\sum_i c_i\mathbf q_i
\right|^2
]
이다.
제곱노름은 항상 0 이상이므로
[
\mathbf c^{\mathsf T}P\mathbf c\ge0
]
이다.
정리 5. 공명행렬의 계수
[
\boxed{
\operatorname{rank}(P)\le3
}
]
이다.
이유
모든 특징벡터 (\mathbf q_i)는 3차원 공간에 있다.
따라서 그람행렬 (P)의 계수는 3을 넘을 수 없다.
11. 방향질서와 180도 축질서11.1 방향질서[
Z_1
\frac1N
\sum_{j=1}^N e^{i\theta_j}
]
[
\boxed{
R_1=|Z_1|
}
]
이다.
모든 화살표가 같은 방향이면
[
R_1=1
]
이다.
방향이 무작위면
[
R_1\approx0
]
이다.
11.2 이진축 질서
180도 반대방향을 동일한 축으로 처리하려면
[
Z_2
\frac1N
\sum_{j=1}^N e^{2i\theta_j}
]
를 사용한다.
[
\boxed{
R_2=|Z_2|
}
]
이다.
예를 들어 위상이
[
0,\pi,0,\pi
]
라면 화살표는 서로 반대이므로
[
R_1=0
]
이다.
그러나 모두 같은 수평축이므로
[
R_2=1
]
이다.
12. 반대방향 짝수·홀수 분해
어떤 방향함수를
[
f(\Omega)
]
라고 하고 반대방향을
[
f(-\Omega)
]
라고 한다.
짝수성분은
[
\boxed{
f_+(\Omega)
\frac{
f(\Omega)+f(-\Omega)
}{2}
}
]
이다.
홀수성분은
[
\boxed{
f_-(\Omega)
\frac{
f(\Omega)-f(-\Omega)
}{2}
}
]
이다.
정리 6. 원래 함수의 복원[
\boxed{
f(\Omega)
f_+(\Omega)+f_-(\Omega)
}
]
[
\boxed{
f(-\Omega)
f_+(\Omega)-f_-(\Omega)
}
]
이다.
또한
[
f_+(-\Omega)=f_+(\Omega)
]
[
f_-(-\Omega)=-f_-(\Omega)
]
이다.
따라서 비대칭 공간도 다음 두 부분으로 정확히 분해할 수 있다.
[
\boxed{
\text{반전불변 부분}
+
\text{반전부호변경 부분}
}
]
이 분해에는 완전한 구형이 필요하지 않다.
13. 케플러 궤도의 이진상보 공식
케플러 궤도는
[
r(\theta)
\frac{p}{1+e\cos\theta}
]
이다.
180도 반대방향에서는
[
r(\theta+\pi)
\frac{p}{1-e\cos\theta}
]
이다.
일반적으로
[
r(\theta+\pi)\ne r(\theta)
]
이다.
하지만 역반경은
[
\frac1{r(\theta)}
\frac1p+\frac ep\cos\theta
]
[
\frac1{r(\theta+\pi)}
\frac1p-\frac ep\cos\theta
]
이므로
[
\boxed{
\frac1{r(\theta)}
+
\frac1{r(\theta+\pi)}
\frac2p
}
]
이다.
이것은 비대칭 타원공간에서도 정확한 180도 상보관계가 존재한다는 뜻이다.
14. 리만위상과 리만구14.1 확장복소평면
복소평면에 무한대 한 점을 추가한다.
[
\boxed{
\widehat{\mathbb C}
\mathbb C\cup{\infty}
}
]
이 공간은 위상적으로 단위구와 같다.
[
\widehat{\mathbb C}\cong S^2
]
중요한 해석은 다음과 같다.
[
\boxed{
\text{리만구는 복소수와 무한대를 표현하는 좌표공간이다.}
}
]
리만구를 사용한다고 해서 실제 모든 파동이 완전구형이라는 뜻은 아니다.
15. 입체사영
복소수
[
z=x+iy
]
를 단위구 위의 점으로 보낸다.
[
\boxed{
X=
\frac{2x}{1+x^2+y^2}
}
]
[
\boxed{
Y=
\frac{2y}{1+x^2+y^2}
}
]
[
\boxed{
Z=
\frac{x^2+y^2-1}
{1+x^2+y^2}
}
]
정리 7. 입체사영점은 단위구에 있다
[
\boxed{
X^2+Y^2+Z^2=1
}
]
이다.
증명
[
q=x^2+y^2
]
라고 하면
[
X^2+Y^2
\frac{4q}{(1+q)^2}
]
이고
[
Z^2
\frac{(q-1)^2}{(1+q)^2}
]
이다.
따라서
[
X^2+Y^2+Z^2
\frac{
4q+(q-1)^2
}{
(1+q)^2
}
]
[
\frac{
q^2+2q+1
}{
(1+q)^2
}
]
[
=1
]
이다.
16. 리만구 역변환
북극을 제외한 단위구 좌표에서 복소수로 돌아가는 식은
[
\boxed{
z=
\frac{X+iY}{1-Z}
}
]
이다.
북극
[
(0,0,1)
]
은 무한대에 대응한다.
정리 8. 입체사영과 역변환
유한한 복소수 (z)에 대해
[
\boxed{
\pi^{-1}(\pi(z))=z
}
]
이다.
증명
입체사영식에서
[
X+iY
\frac{2z}{1+|z|^2}
]
이고
[
1-Z
\frac2{1+|z|^2}
]
이다.
따라서
[
\frac{X+iY}{1-Z}
z
]
이다.
17. 복소수의 크기와 구면좌표
[
z=re^{i\theta}
]
라고 하면 리만구 좌표는
[
X=
\frac{2r\cos\theta}{1+r^2}
]
[
Y=
\frac{2r\sin\theta}{1+r^2}
]
[
Z=
\frac{r^2-1}{1+r^2}
]
이다.
해석:
복소평면리만구
| 각도 (\theta) | 경도 |
| 크기 (r) | 위도 |
| (r=1) | 적도 |
| (r<1) | 남반구 |
| (r>1) | 북반구 |
| (r\to\infty) | 북극 |
18. 뫼비우스 변환
리만구 위의 기본변환은
[
\boxed{
M(z)
\frac{az+b}{cz+d}
}
]
이다.
조건은
[
\boxed{
ad-bc\ne0
}
]
이다.
뫼비우스 변환은 다음 연산을 통합한다.
회전
평행이동
확대·축소
역수변환
무한대와 유한점의 교환
행렬로는
[
\begin{pmatrix}
a&b\
c&d
\end{pmatrix}
]
로 표현한다.
두 뫼비우스 변환의 합성은 행렬곱으로 계산할 수 있다.
19. 교차비
네 복소수의 교차비는
[
\boxed{
[z_1,z_2;z_3,z_4]
\frac{
(z_1-z_3)(z_2-z_4)
}{
(z_1-z_4)(z_2-z_3)
}
}
]
이다.
정리 9. 교차비 불변성
뫼비우스 변환 (M)에 대해
[
\boxed{
[
M(z_1),M(z_2);
M(z_3),M(z_4)
]
[
z_1,z_2;
z_3,z_4
]
}
]
이다.
이 불변량은 리만구 위에서 네 점의 상대적 위상구조가 보존되는지 검사하는 데 사용할 수 있다.
20. 토러스의 각도위상
토러스에는 두 개의 독립적인 주기각이 있다.
[
u\sim u+2\pi
]
[
v\sim v+2\pi
]
정수파동모드는
[
\boxed{
\psi_{m,n}(u,v)
e^{i(mu+nv)}
}
]
이다.
[
m,n\in\mathbb Z
]
이다.
정리 10. 토러스 반회전 패리티[
\boxed{
\psi_{m,n}(u+\pi,v+\pi)
(-1)^{m+n}
\psi_{m,n}(u,v)
}
]
이다.
따라서
(m+n)이 짝수면 반회전 후 동일
(m+n)이 홀수면 반회전 후 부호반전
이다.
21. 인공지능 학습손실21.1 방향각 손실[
\boxed{
L_{\mathrm{phase}}
1-\cos(\hat\theta-\theta)
}
]
원시각도 제곱오차보다 주기성을 올바르게 처리한다.
21.2 이진축 손실
180도 반대방향을 같은 축으로 처리하려면
[
\boxed{
L_{\mathrm{axis}}
1-\cos2(\hat\theta-\theta)
}
]
를 사용한다.
[
\hat\theta=\theta+\pi
]
일 때도 손실은 0이다.
21.3 단위구 손실[
\boxed{
L_{\mathrm{sphere}}
(X^2+Y^2+Z^2-1)^2
}
]
21.4 이진변환 손실[
\boxed{
L_{\mathbb Z_2}
|B^2-I|_F^2
}
]
21.5 교차비 손실[
\boxed{
L_{\mathrm{cross}}|
CR_{\mathrm{after}}
CR_{\mathrm{before}}
|^2
}
]
22. 다른 인공지능용 계산절차1. 모든 각도 단위를 라디안으로 변환한다. 2. 각도를 [0, 2π) 범위로 표준화한다. 3. 각도 특징 [cosθ, sinθ, cos2θ, sin2θ]를 만든다. 4. 일반 뺄셈이 아니라 최소 원형각도차를 계산한다. 5. P = 1 + cosΔθ를 계산한다. 6. 집단 방향질서 R1과 이진축 질서 R2를 계산한다. 7. 변환행렬 B가 있으면 ||B²-I||을 검사한다. 8. 복소수 z를 리만구 좌표로 변환한다. 9. X²+Y²+Z²=1인지 검사한다. 10. 역변환으로 원래 z가 복원되는지 검사한다. 11. 뫼비우스 변환은 ad-bc≠0인지 확인한다. 12. 교차비가 보존되는지 검사한다. 13. 결과를 THEOREM, NUMERICAL, MODEL, HYPOTHESIS로 구분한다.
23. 전체 Python 코드
아래 코드는 외부파일 없이 복사하여 실행할 수 있는 단일 Python 모듈이다.
""" ZPX 이진벡터·벡터위상·리만위상 계산 모듈 필요 패키지: pip install numpy 실행: python zpx_angle_topology.py """ from __future__ import annotations from dataclasses import dataclass from typing import Sequence import cmath import json import math import numpy as np TAU = 2.0 * math.pi DEFAULT_TOL = 1e-9 EPS = 1e-12 # ============================================================ # 1. 각도 계산 # ============================================================ def wrap_angle(theta, period: float = TAU): """ 각도를 [0, period) 범위로 표준화한다. 스칼라와 NumPy 배열을 모두 지원한다. """ result = np.mod(theta, period) if np.ndim(result) == 0: return float(result) return result def principal_angle(theta): """ 각도를 (-pi, pi] 범위의 주각으로 변환한다. """ value = (np.asarray(theta) + math.pi) % TAU - math.pi # 경계값 -pi를 +pi로 통일한다. value = np.where( np.isclose(value, -math.pi), math.pi, value, ) if np.ndim(value) == 0: return float(value) return value def signed_circular_difference(theta_a, theta_b): """ theta_a - theta_b의 부호 있는 최소 원형차. 범위: (-pi, pi] """ return principal_angle( np.asarray(theta_a) - np.asarray(theta_b) ) def circular_distance(theta_a, theta_b): """ 두 각도의 최소 절대거리. 범위: [0, pi] """ return np.abs( signed_circular_difference(theta_a, theta_b) ) def degrees_to_radians(angle_degrees): return np.asarray(angle_degrees) * math.pi / 180.0 def radians_to_degrees(angle_radians): return np.asarray(angle_radians) * 180.0 / math.pi # ============================================================ # 2. 벡터와 극좌표 # ============================================================ def vector_from_polar(radius: float, theta: float) -> np.ndarray: """ 극좌표 (r, theta)를 2차원 벡터로 변환한다. """ return np.array( [ radius * math.cos(theta), radius * math.sin(theta), ], dtype=float, ) def polar_from_vector(vector: Sequence[float]) -> tuple[float, float]: """ 2차원 벡터를 (크기, 각도)로 변환한다. 각도 범위는 [0, 2pi). """ if len(vector) != 2: raise ValueError("2차원 벡터만 지원합니다.") x, y = map(float, vector) radius = math.hypot(x, y) theta = wrap_angle(math.atan2(y, x)) return radius, theta def vector_dot_angle( vector_a: Sequence[float], vector_b: Sequence[float], ) -> float: """ 두 벡터의 사이각을 계산한다. """ a = np.asarray(vector_a, dtype=float) b = np.asarray(vector_b, dtype=float) norm_a = np.linalg.norm(a) norm_b = np.linalg.norm(b) if norm_a <= EPS or norm_b <= EPS: raise ValueError("영벡터의 방향각은 정의할 수 없습니다.") cosine = float( np.dot(a, b) / (norm_a * norm_b) ) cosine = float(np.clip(cosine, -1.0, 1.0)) return math.acos(cosine) # ============================================================ # 3. 회전과 이진변환 # ============================================================ def rotation_matrix_2d(theta: float) -> np.ndarray: """ 2차원 회전행렬. """ c = math.cos(theta) s = math.sin(theta) return np.array( [ [c, -s], [s, c], ], dtype=float, ) def half_turn_2d(vector: Sequence[float]) -> np.ndarray: """ 2차원 180도 회전. v -> -v """ return -np.asarray(vector, dtype=float) def half_turn_3d(axis: Sequence[float]) -> np.ndarray: """ 주어진 축 둘레의 3차원 180도 회전행렬. R = 2 n n^T - I """ n = np.asarray(axis, dtype=float) if n.shape != (3,): raise ValueError("3차원 축 벡터가 필요합니다.") norm = np.linalg.norm(n) if norm <= EPS: raise ValueError("회전축은 영벡터일 수 없습니다.") n = n / norm return 2.0 * np.outer(n, n) - np.eye(3) def binary_involution_error(matrix: np.ndarray) -> float: """ B^2 = I 조건의 수치오차를 계산한다. """ B = np.asarray(matrix, dtype=float) if B.ndim != 2 or B.shape[0] != B.shape[1]: raise ValueError("정사각행렬이 필요합니다.") identity = np.eye(B.shape[0]) return float( np.linalg.norm(B @ B - identity) ) def is_binary_involution( matrix: np.ndarray, tolerance: float = DEFAULT_TOL, ) -> bool: return binary_involution_error(matrix) < tolerance # ============================================================ # 4. 복소위상과 공명 # ============================================================ def complex_phase(theta): """ exp(i theta) """ return np.exp(1j * np.asarray(theta)) def phase_resonance(theta_a, theta_b): """ P = 1 + cos(delta theta) P=2: 동위상 P=1: 직교 P=0: 반대위상 """ delta = signed_circular_difference( theta_a, theta_b, ) return 1.0 + np.cos(delta) def angle_feature(theta: float) -> np.ndarray: """ 인공지능 학습용 주기특징. [cos(theta), sin(theta), cos(2theta), sin(2theta)] """ return np.array( [ math.cos(theta), math.sin(theta), math.cos(2.0 * theta), math.sin(2.0 * theta), ], dtype=float, ) def pair_angle_features( theta_a: float, theta_b: float, ) -> dict: """ 두 각도의 전체 비교특징. """ delta = float( signed_circular_difference(theta_a, theta_b) ) return { "theta_a_wrapped": wrap_angle(theta_a), "theta_b_wrapped": wrap_angle(theta_b), "delta_signed": delta, "delta_absolute": abs(delta), "cos_delta": math.cos(delta), "sin_delta": math.sin(delta), "phase_resonance_P": 1.0 + math.cos(delta), "binary_axis_similarity": math.cos(2.0 * delta), } # ============================================================ # 5. 집단 방향질서 # ============================================================ def directional_order( phases: Sequence[float], harmonic: int = 1, ) -> complex: """ Z_k = mean(exp(i*k*theta)) """ phase_array = np.asarray(phases, dtype=float) if phase_array.size == 0: raise ValueError("위상 목록이 비어 있습니다.") return complex( np.mean( np.exp(1j * harmonic * phase_array) ) ) def R1(phases: Sequence[float]) -> float: """ 화살표 방향질서. """ return abs( directional_order(phases, harmonic=1) ) def R2(phases: Sequence[float]) -> float: """ 180도 무방향 축질서. """ return abs( directional_order(phases, harmonic=2) ) # ============================================================ # 6. 위상공명행렬 # ============================================================ def phase_gram_features( phases: Sequence[float], ) -> np.ndarray: """ q_i = [1, cos(theta_i), sin(theta_i)] """ phase_array = np.asarray(phases, dtype=float) return np.column_stack( [ np.ones_like(phase_array), np.cos(phase_array), np.sin(phase_array), ] ) def phase_gram_matrix( phases: Sequence[float], ) -> np.ndarray: """ P_ij = 1 + cos(theta_i - theta_j) """ phase_array = np.asarray(phases, dtype=float) return ( 1.0 + np.cos( phase_array[:, None] - phase_array[None, :] ) ) def phase_gram_diagnostics( phases: Sequence[float], tolerance: float = DEFAULT_TOL, ) -> dict: """ 공명행렬의 고윳값, 계수, 평균항등식을 검사한다. """ matrix = phase_gram_matrix(phases) eigenvalues = np.linalg.eigvalsh(matrix) rank = int( np.linalg.matrix_rank( matrix, tol=tolerance, ) ) mean_identity_error = abs( float(np.mean(matrix)) - (1.0 + R1(phases) ** 2) ) return { "minimum_eigenvalue": float( np.min(eigenvalues) ), "rank": rank, "rank_le_3": rank <= 3, "mean_identity_error": float( mean_identity_error ), "positive_semidefinite_with_tolerance": ( float(np.min(eigenvalues)) >= -tolerance ), } # ============================================================ # 7. 반대방향 짝수·홀수 분해 # ============================================================ def antipodal_even_odd( value_at_omega, value_at_minus_omega, ): """ f+ = (f(Omega)+f(-Omega))/2 f- = (f(Omega)-f(-Omega))/2 """ even = ( value_at_omega + value_at_minus_omega ) / 2.0 odd = ( value_at_omega - value_at_minus_omega ) / 2.0 return even, odd def reconstruct_from_even_odd(even, odd): """ f(Omega), f(-Omega)를 복원한다. """ value_at_omega = even + odd value_at_minus_omega = even - odd return value_at_omega, value_at_minus_omega # ============================================================ # 8. 케플러 상보관계 # ============================================================ def kepler_radius(theta, p: float, eccentricity: float): """ r(theta) = p / (1 + e cos(theta)) """ if p <= 0: raise ValueError("p는 양수여야 합니다.") if eccentricity < 0: raise ValueError("이심률은 음수가 될 수 없습니다.") return ( p / ( 1.0 + eccentricity * np.cos(theta) ) ) def kepler_binary_invariant( theta, p: float, eccentricity: float, ): """ 1/r(theta) + 1/r(theta+pi) = 2/p 반환: lhs, rhs, residual """ theta_array = np.asarray(theta) radius_a = kepler_radius( theta_array, p, eccentricity, ) radius_b = kepler_radius( theta_array + math.pi, p, eccentricity, ) lhs = 1.0 / radius_a + 1.0 / radius_b rhs = 2.0 / p residual = lhs - rhs return lhs, rhs, residual # ============================================================ # 9. 리만구 입체사영 # ============================================================ def stereographic_to_sphere(z: complex) -> np.ndarray: """ 복소수 z를 단위 리만구 좌표로 변환한다. X = 2 Re(z)/(1+|z|^2) Y = 2 Im(z)/(1+|z|^2) Z = (|z|^2-1)/(1+|z|^2) 무한대는 북극 [0,0,1]로 처리한다. """ z = complex(z) if math.isinf(z.real) or math.isinf(z.imag): return np.array( [0.0, 0.0, 1.0], dtype=float, ) magnitude_squared = abs(z) ** 2 denominator = 1.0 + magnitude_squared return np.array( [ 2.0 * z.real / denominator, 2.0 * z.imag / denominator, ( magnitude_squared - 1.0 ) / denominator, ], dtype=float, ) def sphere_to_stereographic( point: Sequence[float], tolerance: float = 1e-7, ) -> complex: """ 단위구 좌표를 복소수로 역변환한다. z = (X+iY)/(1-Z) """ if len(point) != 3: raise ValueError("3차원 구면좌표가 필요합니다.") X, Y, Z = map(float, point) sphere_error = abs( X * X + Y * Y + Z * Z - 1.0 ) if sphere_error > tolerance: raise ValueError( "입력점이 단위구 위에 있지 않습니다." ) if abs(1.0 - Z) <= EPS: return complex(float("inf"), 0.0) return complex(X, Y) / (1.0 - Z) def riemann_projection_diagnostics( z: complex, ) -> dict: """ 리만구 사영과 역변환 오차를 계산한다. """ sphere_point = stereographic_to_sphere(z) sphere_norm_error = abs( float(np.dot(sphere_point, sphere_point)) - 1.0 ) reconstructed = sphere_to_stereographic( sphere_point ) if math.isinf(complex(z).real): inverse_error = 0.0 else: inverse_error = abs( reconstructed - complex(z) ) return { "sphere_point": sphere_point.tolist(), "sphere_norm_error": float( sphere_norm_error ), "reconstructed_complex": [ reconstructed.real, reconstructed.imag, ], "inverse_error": float(inverse_error), } # ============================================================ # 10. 뫼비우스 변환 # ============================================================ @dataclass(frozen=True) class Mobius: """ M(z) = (a*z+b)/(c*z+d) """ a: complex b: complex c: complex d: complex def determinant(self) -> complex: return self.a * self.d - self.b * self.c def validate(self): if abs(self.determinant()) <= EPS: raise ValueError( "ad-bc는 0이 아니어야 합니다." ) def __call__(self, z: complex) -> complex: self.validate() z = complex(z) if math.isinf(z.real) or math.isinf(z.imag): if abs(self.c) <= EPS: return complex(float("inf"), 0.0) return self.a / self.c denominator = self.c * z + self.d if abs(denominator) <= EPS: return complex(float("inf"), 0.0) return ( self.a * z + self.b ) / denominator def compose(self, other: "Mobius") -> "Mobius": """ self(other(z)) 합성. """ matrix_a = np.array( [ [self.a, self.b], [self.c, self.d], ], dtype=complex, ) matrix_b = np.array( [ [other.a, other.b], [other.c, other.d], ], dtype=complex, ) product = matrix_a @ matrix_b return Mobius( product[0, 0], product[0, 1], product[1, 0], product[1, 1], ) def inverse(self) -> "Mobius": self.validate() return Mobius( self.d, -self.b, -self.c, self.a, ) def cross_ratio( z1: complex, z2: complex, z3: complex, z4: complex, ) -> complex: """ [z1,z2;z3,z4] """ denominator = ( (z1 - z4) * (z2 - z3) ) if abs(denominator) <= EPS: raise ZeroDivisixxonError( "퇴화된 교차비입니다." ) return ( (z1 - z3) * (z2 - z4) ) / denominator def mobius_cross_ratio_error( transform: Mobius, z1: complex, z2: complex, z3: complex, z4: complex, ) -> float: """ 뫼비우스 변환 전후의 교차비 오차. """ before = cross_ratio( z1, z2, z3, z4 ) after = cross_ratio( transform(z1), transform(z2), transform(z3), transform(z4), ) return float(abs(before - after)) # ============================================================ # 11. 토러스 위상모드 # ============================================================ def torus_mode( u: float, v: float, m: int, n: int, ) -> complex: """ psi_mn(u,v) = exp(i(m*u+n*v)) """ return cmath.exp( 1j * (m * u + n * v) ) def torus_half_turn_parity( m: int, n: int, ) -> int: """ (-1)^(m+n) """ return 1 if (m + n) % 2 == 0 else -1 def torus_half_turn_error( u: float, v: float, m: int, n: int, ) -> float: lhs = torus_mode( u + math.pi, v + math.pi, m, n, ) rhs = ( torus_half_turn_parity(m, n) * torus_mode(u, v, m, n) ) return float(abs(lhs - rhs)) # ============================================================ # 12. 학습손실 # ============================================================ def phase_loss( predicted_theta: float, true_theta: float, ) -> float: """ 방향각 손실: 1-cos(delta) """ delta = float( signed_circular_difference( predicted_theta, true_theta, ) ) return 1.0 - math.cos(delta) def binary_axis_loss( predicted_theta: float, true_theta: float, ) -> float: """ 180도 반대방향을 같은 축으로 처리하는 손실. """ delta = float( signed_circular_difference( predicted_theta, true_theta, ) ) return 1.0 - math.cos(2.0 * delta) def sphere_constraint_loss( X: float, Y: float, Z: float, ) -> float: return ( X * X + Y * Y + Z * Z - 1.0 ) ** 2 def involution_loss(matrix: np.ndarray) -> float: error = binary_involution_error(matrix) return error ** 2 # ============================================================ # 13. 데이터 집합 분석 # ============================================================ def analyze_phase_dataset( phases: Sequence[float], ) -> dict: """ 위상목록을 다른 인공지능이 읽을 수 있는 JSON 호환 결과로 분석한다. """ phase_array = np.asarray(phases, dtype=float) wrapped = wrap_angle(phase_array) features = [ angle_feature(float(theta)).tolist() for theta in wrapped ] resonance_matrix = phase_gram_matrix( wrapped ) diagnostics = phase_gram_diagnostics( wrapped ) return { "evidence_level": "NUMERICAL", "angle_unit": "radian", "count": int(len(wrapped)), "wrapped_phases": wrapped.tolist(), "angle_features": features, "R1_directional_order": R1(wrapped), "R2_binary_axis_order": R2(wrapped), "resonance_matrix": resonance_matrix.tolist(), "resonance_diagnostics": diagnostics, } # ============================================================ # 14. 전체 자동검증 # ============================================================ def validate_core_identities( random_seed: int = 20260721, ) -> dict: rng = np.random.default_rng(random_seed) # 1. 각도주기 angles = rng.normal(size=1000) periodicity_error = float( np.max( np.abs( complex_phase(angles + TAU) - complex_phase(angles) ) ) ) # 2. 2차원 반회전 vector_2d = rng.normal(size=2) half_turn_2d_error = float( np.linalg.norm( half_turn_2d( half_turn_2d(vector_2d) ) - vector_2d ) ) # 3. 3차원 반회전 axis = rng.normal(size=3) rotation_3d = half_turn_3d(axis) half_turn_3d_error = ( binary_involution_error(rotation_3d) ) # 4. 공명행렬 phases = rng.uniform( -math.pi, math.pi, size=50, ) gram_diagnostics = ( phase_gram_diagnostics(phases) ) # 5. 리만구 sphere_errors = [] inverse_errors = [] complex_samples = ( rng.normal(size=100) + 1j * rng.normal(size=100) ) for z in complex_samples: diagnostics = ( riemann_projection_diagnostics( complex(z) ) ) sphere_errors.append( diagnostics["sphere_norm_error"] ) inverse_errors.append( diagnostics["inverse_error"] ) # 6. 뫼비우스 교차비 transform = Mobius( 1.0 + 0.2j, 0.4 - 0.1j, -0.3 + 0.2j, 1.2 + 0.1j, ) cross_ratio_error = ( mobius_cross_ratio_error( transform, 0.2 + 0.1j, 1.2 - 0.4j, -0.7 + 0.8j, 2.0 + 0.3j, ) ) # 7. 케플러 상보식 theta = np.linspace( 0.0, TAU, 1001, ) _, _, kepler_residual = ( kepler_binary_invariant( theta, p=1.7, eccentricity=0.4, ) ) # 8. 토러스 패리티 torus_errors = [] for m in range(-3, 4): for n in range(-3, 4): torus_errors.append( torus_half_turn_error( 0.4, 1.1, m, n, ) ) return { "evidence_level": "NUMERICAL", "periodicity_error": periodicity_error, "half_turn_2d_error": half_turn_2d_error, "half_turn_3d_error": half_turn_3d_error, "phase_gram": gram_diagnostics, "riemann_sphere_norm_error_max": float( max(sphere_errors) ), "riemann_inverse_error_max": float( max(inverse_errors) ), "mobius_cross_ratio_error": ( cross_ratio_error ), "kepler_binary_invariant_error_max": ( float( np.max( np.abs(kepler_residual) ) ) ), "torus_half_turn_error_max": float( max(torus_errors) ), } # ============================================================ # 15. 간단한 단위시험 # ============================================================ def run_self_tests(): """ 외부 pytest 없이 실행 가능한 기본시험. """ tolerance = 1e-10 passed = 0 failed = 0 def check(condition: bool, name: str): nonlocal passed, failed if condition: passed += 1 print(f"[PASS] {name}") else: failed += 1 print(f"[FAIL] {name}") check( abs( wrap_angle(-math.pi / 2) - 3 * math.pi / 2 ) < tolerance, "각도 표준화", ) check( abs( circular_distance( math.radians(359), math.radians(1), ) - math.radians(2) ) < tolerance, "원형거리", ) check( abs(phase_resonance(0, 0) - 2) < tolerance, "동위상 공명", ) check( abs( phase_resonance(0, math.pi) ) < tolerance, "반대위상 공명", ) rotation = half_turn_3d([0, 0, 1]) check( binary_involution_error(rotation) < tolerance, "3차원 반회전", ) phases = [0.1, 1.2, 2.1, 2.9] diagnostics = phase_gram_diagnostics(phases) check( diagnostics["rank_le_3"], "공명행렬 계수", ) check( diagnostics[ "positive_semidefinite_with_tolerance" ], "공명행렬 양의 준정부호", ) z = 1.3 - 0.7j riemann = riemann_projection_diagnostics(z) check( riemann["sphere_norm_error"] < tolerance, "리만구 단위구 조건", ) check( riemann["inverse_error"] < tolerance, "리만구 역변환", ) mobius = Mobius( 1 + 0.2j, 0.4 - 0.1j, -0.3 + 0.2j, 1.2 + 0.1j, ) error = mobius_cross_ratio_error( mobius, 0.2 + 0.1j, 1.2 - 0.4j, -0.7 + 0.8j, 2.0 + 0.3j, ) check( error < tolerance, "뫼비우스 교차비", ) theta = np.linspace( 0, TAU, 500, ) _, _, residual = kepler_binary_invariant( theta, p=1.7, eccentricity=0.4, ) check( np.max(np.abs(residual)) < tolerance, "케플러 상보항등식", ) check( torus_half_turn_error( 0.4, 1.1, 2, 3, ) < tolerance, "토러스 반회전 패리티", ) print() print( f"시험결과: {passed} 통과, " f"{failed} 실패" ) if failed: raise AssertixxonError( "일부 시험이 실패했습니다." ) # ============================================================ # 16. 실행 예제 # ============================================================ def main(): print("=" * 70) print("ZPX 각도·벡터·리만위상 계산 예제") print("=" * 70) # 각도비교 theta_a = math.radians(350) theta_b = math.radians(10) print("\n[1] 두 각도 분석") print( json.dumps( pair_angle_features( theta_a, theta_b, ), ensure_ascii=False, indent=2, ) ) # 방향질서와 축질서 phases = [ 0.0, math.pi, 0.02, math.pi + 0.02, ] print("\n[2] 방향질서") print("R1 =", R1(phases)) print("R2 =", R2(phases)) # 3차원 반회전 rotation = half_turn_3d( [0.0, 0.0, 1.0] ) print("\n[3] 3차원 반회전행렬") print(rotation) print( "B^2-I 오차 =", binary_involution_error(rotation), ) # 리만구 z = 1.0 + 2.0j print("\n[4] 리만구 사영") riemann_result = ( riemann_projection_diagnostics(z) ) print( json.dumps( riemann_result, ensure_ascii=False, indent=2, ) ) # 뫼비우스 변환 transform = Mobius( a=1.0, b=1.0, c=0.2, d=1.0, ) print("\n[5] 뫼비우스 변환") print("z =", z) print("M(z) =", transform(z)) # 케플러 상보관계 theta_values = np.linspace( 0, TAU, 16, endpoint=False, ) _, _, residual = ( kepler_binary_invariant( theta_values, p=1.7, eccentricity=0.4, ) ) print("\n[6] 케플러 상보식") print( "최대오차 =", np.max(np.abs(residual)), ) # 데이터 집합 분석 print("\n[7] 위상 데이터 분석") result = analyze_phase_dataset(phases) print( json.dumps( result, ensure_ascii=False, indent=2, ) ) # 전체검증 print("\n[8] 전체 수치검증") validation = validate_core_identities() print( json.dumps( validation, ensure_ascii=False, indent=2, ) ) print("\n[9] 자체시험") run_self_tests() if __name__ == "__main__": main()
24. 코드 실행방법
위 코드를 다음 이름으로 저장한다.
zpx_angle_topology.py
NumPy를 설치한다.
pip install numpy
실행한다.
python zpx_angle_topology.py
실행하면 다음 결과가 출력된다.
350도와 10도의 실제 최소 각도차
(R_1) 방향질서
(R_2) 이진축 질서
3차원 반회전행렬
(B^2-I) 오차
복소수의 리만구 좌표
리만구 역변환 오차
뫼비우스 변환
교차비 불변성
케플러 180도 상보항등식
토러스 반회전 패리티
전체 자동검증
자체 단위시험
25. 다른 인공지능용 JSON 입력예{ "model_name": "ZPX-Angle-Vector-Riemann-v1", "angle_unit": "radian", "tolerance": 1e-9, "states": [ { "id": "A", "magnitude": 1.0, "theta": 6.1086523819801535, "claim_level": "MODEL" }, { "id": "B", "magnitude": 1.0, "theta": 0.17453292519943295, "claim_level": "MODEL" } ], "required_outputs": [ "wrapped_angle", "cos_theta", "sin_theta", "cos_2theta", "sin_2theta", "circular_distance", "phase_resonance_P", "binary_axis_similarity", "R1", "R2" ] }
26. 다른 인공지능용 지시문당신은 ZPX 각도·벡터·리만위상 계산기다. 1. 모든 각도는 라디안으로 내부 변환한다. 2. 각도는 반드시 [0,2π)로 표준화한다. 3. 각도 비교에는 일반 뺄셈이 아니라 원형 최소거리를 사용한다. 4. 방향벡터는 (cosθ,sinθ)로 표현한다. 5. 180도 축은 (cos2θ,sin2θ)로 표현한다. 6. 방향질서는 R1, 이진축 질서는 R2로 구분한다. 7. 위상공명은 P=1+cosΔθ로 계산한다. 8. 이진변환은 ||B²-I||로 검증한다. 9. 리만구는 복소수 좌표공간으로 사용하며 실제 물리구체로 단정하지 않는다. 10. 뫼비우스 변환은 ad-bc≠0일 때만 허용한다. 11. 교차비 불변성을 검사한다. 12. 모든 결과에 수치오차와 허용오차를 함께 출력한다. 13. 결과를 THEOREM, NUMERICAL, MODEL, HYPOTHESIS 중 하나로 분류한다. 14. 물리적 가설을 수학적 증명이라고 표현하지 않는다.
27. 정확히 증명된 부분
다음은 표준수학으로 정확하게 증명된다.
[
\theta\sim\theta+2\pi k
]
[
B^2=I
]
[
R_{\mathbf n}(\pi)^2=I
]
[
P_{ij}
1+\cos(\theta_i-\theta_j)
]
[
P\succeq0
]
[
\operatorname{rank}(P)\le3
]
[
f=f_++f_-
]
[
\widehat{\mathbb C}\cong S^2
]
[
X^2+Y^2+Z^2=1
]
[
z=
\frac{X+iY}{1-Z}
]
[
CR(Mz_1,Mz_2,Mz_3,Mz_4)
CR(z_1,z_2,z_3,z_4)
]
[
\psi_{m,n}(u+\pi,v+\pi)
(-1)^{m+n}\psi_{m,n}(u,v)
]
[
\frac1{r(\theta)}
+
\frac1{r(\theta+\pi)}
\frac2p
]
28. 아직 물리적으로 증명되지 않은 부분
다음은 이 코드와 수학정리만으로 증명되지 않는다.
실제 시공간이 삼각격자 셀로 구성된다는 주장
모든 힘이 180도 이진변환에서 발생한다는 주장
리만구가 실제 우주의 물리적 모양이라는 주장
모든 블랙홀 내부가 토러스라는 주장
17·34가 우주의 고유격자라는 주장
(P=1+\cos\Delta\theta) 하나로 모든 상호작용을 설명할 수 있다는 주장
이 계산체계가 리만가설을 자동으로 증명한다는 주장
이 항목들은 차원을 가진 물리 운동방정식과 독립 관측예측이 필요한 가설이다.
29. 최종 결론
형 이론의 인공지능 계산핵심은 다음과 같이 정리된다.
[
\boxed{
\text{벡터}
\text{크기}
+
\text{방향각}
}
]
[
\boxed{
\text{위상}
e^{i\theta}
}
]
[
\boxed{
\text{이진구조}
B^2=I
}
]
[
\boxed{
\text{위상공명}
1+\cos\Delta\theta
}
]
[
\boxed{
\text{방향질서}
R_1
}
]
[
\boxed{
\text{180도 축질서}
R_2
}
]
[
\boxed{
\text{리만위상}
\text{복소평면과 무한대를 단위구에 대응시키는 계산좌표계}
}
]
따라서 다른 인공지능은 다음 절차로 형 공식을 계산할 수 있다.
[
\boxed{
\text{각도입력}
\rightarrow
\text{주기표준화}
\rightarrow
\text{벡터특징}
\rightarrow
\text{위상차}
\rightarrow
\text{공명}
\rightarrow
\text{이진축}
\rightarrow
\text{리만구}
\rightarrow
\text{불변량검사}
}
]
이 수학적 계산체계는 재현 가능하며 Python 코드로 구현할 수 있다.
다만 이 체계가 곧바로 우주의 최종 물리법칙을 증명하는 것은 아니다.
가장 정확한 학술판정은 다음과 같다.
[
\boxed{
\textbf{ZPX 이진벡터·벡터위상·리만위상은
각도, 복소수, 대합변환과 리만구의 표준수학을 이용해
다른 인공지능이 학습하고 계산할 수 있는 정형화된 분석체계다.}
}
]
물리이론으로 완성하려면 추가로 다음이 필요하다.
물리단위
에너지 함수
운동방정식
보존법칙
초기조건
관측 전에 고정되는 독립예측
기존 이론과 구분되는 실험결과