coordinate-system 6.0.0__tar.gz → 6.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- coordinate_system-6.0.3/PKG-INFO +1001 -0
- coordinate_system-6.0.3/README.md +959 -0
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/coordinate_system/__init__.py +46 -16
- coordinate_system-6.0.3/coordinate_system/fourier_spectral.py +149 -0
- coordinate_system-6.0.3/coordinate_system/frames.py +1602 -0
- coordinate_system-6.0.3/coordinate_system/u3_frame.py +885 -0
- coordinate_system-6.0.3/coordinate_system.egg-info/PKG-INFO +1001 -0
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/coordinate_system.egg-info/SOURCES.txt +2 -1
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/setup.py +2 -2
- coordinate_system-6.0.0/PKG-INFO +0 -783
- coordinate_system-6.0.0/README.md +0 -741
- coordinate_system-6.0.0/coordinate_system/fourier_spectral.py +0 -125
- coordinate_system-6.0.0/coordinate_system/qframes.py +0 -792
- coordinate_system-6.0.0/coordinate_system.egg-info/PKG-INFO +0 -783
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/LICENSE +0 -0
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/MANIFEST.in +0 -0
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/coordinate_system/curve_interpolation.py +0 -0
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/coordinate_system/differential_geometry.py +0 -0
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/coordinate_system/visualization.py +0 -0
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/coordinate_system.egg-info/dependency_links.txt +0 -0
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/coordinate_system.egg-info/not-zip-safe +0 -0
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/coordinate_system.egg-info/requires.txt +0 -0
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/coordinate_system.egg-info/top_level.txt +0 -0
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/coordinate_system_binding.cpp +0 -0
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/pmsys_minimal.hpp +0 -0
- {coordinate_system-6.0.0 → coordinate_system-6.0.3}/setup.cfg +0 -0
|
@@ -0,0 +1,1001 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: coordinate_system
|
|
3
|
+
Version: 6.0.3
|
|
4
|
+
Summary: High-performance 3D coordinate system library with unified differential geometry, quantum frame algebra, spectral transforms, and professional curvature visualization
|
|
5
|
+
Home-page: https://github.com/panguojun/Coordinate-System
|
|
6
|
+
Author: PanGuoJun
|
|
7
|
+
Author-email: 18858146@qq.com
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Bug Reports, https://github.com/panguojun/Coordinate-System/issues
|
|
10
|
+
Project-URL: Source, https://github.com/panguojun/Coordinate-System
|
|
11
|
+
Project-URL: Documentation, https://github.com/panguojun/Coordinate-System/blob/main/README.md
|
|
12
|
+
Keywords: 3d math vector quaternion coordinate-system geometry graphics spatial-computing differential-geometry curvature curve-interpolation c2-continuity frenet-frames fourier-transform operator-overloading quantum-coordinates heisenberg-uncertainty visualization rgb-frames catmull-rom squad intrinsic-gradient spectral-analysis surface-visualization
|
|
13
|
+
Platform: Windows
|
|
14
|
+
Platform: Linux
|
|
15
|
+
Platform: macOS
|
|
16
|
+
Platform: Android
|
|
17
|
+
Platform: iOS
|
|
18
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
19
|
+
Classifier: Intended Audience :: Developers
|
|
20
|
+
Classifier: Intended Audience :: Science/Research
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
23
|
+
Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
|
|
24
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
25
|
+
Classifier: Programming Language :: Python :: 3
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.7
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
29
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
30
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
31
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
32
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
33
|
+
Classifier: Programming Language :: C++
|
|
34
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
35
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
36
|
+
Classifier: Operating System :: MacOS
|
|
37
|
+
Requires-Python: >=3.7
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
License-File: LICENSE
|
|
40
|
+
Requires-Dist: numpy>=1.19.0
|
|
41
|
+
Requires-Dist: matplotlib>=3.3.0
|
|
42
|
+
|
|
43
|
+
# Coordinate System Library
|
|
44
|
+
|
|
45
|
+
**High-performance 3D coordinate system and differential geometry library for Python**
|
|
46
|
+
|
|
47
|
+
[](https://pypi.org/project/coordinate-system/)
|
|
48
|
+
[](https://pypi.org/project/coordinate-system/)
|
|
49
|
+
[](https://pypi.org/project/coordinate-system/)
|
|
50
|
+
[](LICENSE)
|
|
51
|
+
|
|
52
|
+
**Author:** PanGuoJun
|
|
53
|
+
**Version:** 6.0.3
|
|
54
|
+
**License:** MIT
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🆕 What's New in v6.0.3 (2025-12-04)
|
|
59
|
+
|
|
60
|
+
### U(3) Gauge Theory Framework - Unified Complex Frame & Gauge Fields
|
|
61
|
+
|
|
62
|
+
**Complete implementation of gauge field theory based on U(3) unitary group** - A groundbreaking framework unifying geometry, topology, and gauge field theory through complex frames.
|
|
63
|
+
|
|
64
|
+
> **Theoretical Foundation**:
|
|
65
|
+
>
|
|
66
|
+
> Based on the paper "*Geometric-Topological Duality: Complex Frame as Unified Structure of Spacetime and Gauge Fields*", this implementation realizes:
|
|
67
|
+
> - **U(3) Complex Frame**: Full 3×3 unitary matrix representation
|
|
68
|
+
> - **Symmetry Breaking Chain**: SU(4) → SU(3) × SU(2) × U(1)
|
|
69
|
+
> - **Color-Space Duality**: RGB color phases ↔ Spatial axes
|
|
70
|
+
> - **Imaginary Time Embedding**: ℝ³ × iℝ → Internal rotation degrees of freedom
|
|
71
|
+
|
|
72
|
+
#### 🎯 **New U(3) Frame Module**
|
|
73
|
+
|
|
74
|
+
**U3Frame Class** - Complete U(3) unitary frame:
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from coordinate_system import U3Frame
|
|
78
|
+
import numpy as np
|
|
79
|
+
|
|
80
|
+
# Create U(3) frame with color phases
|
|
81
|
+
theta_R, theta_G, theta_B = 0.1, 0.3, -0.4 # RGB phases
|
|
82
|
+
e1 = np.array([np.exp(1j * theta_R), 0, 0])
|
|
83
|
+
e2 = np.array([0, np.exp(1j * theta_G), 0])
|
|
84
|
+
e3 = np.array([0, 0, np.exp(1j * theta_B)])
|
|
85
|
+
|
|
86
|
+
frame = U3Frame(e1, e2, e3)
|
|
87
|
+
|
|
88
|
+
# Symmetry decomposition
|
|
89
|
+
su3_comp, u1_phase = frame.to_su3_u1() # U(3) = SU(3) × U(1)
|
|
90
|
+
|
|
91
|
+
# Color phases (Red, Green, Blue)
|
|
92
|
+
phases = frame.color_phases() # (θ_R, θ_G, θ_B)
|
|
93
|
+
|
|
94
|
+
# Quaternion representation (SU(2) subgroup)
|
|
95
|
+
q = frame.to_quaternion_representation()
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### 🌟 **Gauge Field Theory**
|
|
99
|
+
|
|
100
|
+
**GaugeConnection Class** - Unified gauge field representation:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from coordinate_system import GaugeConnection, FieldStrength
|
|
104
|
+
|
|
105
|
+
# Create gauge connection A_μ = A^{SU(3)} + A^{SU(2)} + A^{U(1)}
|
|
106
|
+
connection = GaugeConnection(
|
|
107
|
+
su3_component=np.random.randn(8) * 0.1, # 8 gluons (QCD)
|
|
108
|
+
su2_component=np.random.randn(3) * 0.1, # 3 W/Z bosons (weak)
|
|
109
|
+
u1_component=0.05+0.02j # 1 photon (EM)
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
# Field strength tensor F_μν = [A_μ, A_ν]
|
|
113
|
+
F = connection_x.field_strength(connection_y)
|
|
114
|
+
|
|
115
|
+
# Yang-Mills action
|
|
116
|
+
S_YM = F.yang_mills_action()
|
|
117
|
+
|
|
118
|
+
# Topological charge (Instanton number)
|
|
119
|
+
Q = F.topological_charge()
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### 🔬 **Core Features**
|
|
123
|
+
|
|
124
|
+
**1. Complete U(3) Unitary Frame**
|
|
125
|
+
```python
|
|
126
|
+
U(x) = [𝐞₁, 𝐞₂, 𝐞₃] ∈ U(3)
|
|
127
|
+
Each column: 𝐞ₖ = 𝐚ₖ + i𝐛ₖ ∈ ℂ³
|
|
128
|
+
```
|
|
129
|
+
- Full 3×3 complex matrix representation
|
|
130
|
+
- Gram-Schmidt orthonormalization
|
|
131
|
+
- Unitary property: U† U = I
|
|
132
|
+
|
|
133
|
+
**2. Symmetry Decomposition**
|
|
134
|
+
```python
|
|
135
|
+
U(3) = SU(3) × U(1)
|
|
136
|
+
SU(3) ⊃ SU(2) × U(1)
|
|
137
|
+
```
|
|
138
|
+
- SU(3): 8 generators (Gell-Mann matrices)
|
|
139
|
+
- SU(2): 3 generators (Pauli matrices)
|
|
140
|
+
- U(1): Global phase
|
|
141
|
+
|
|
142
|
+
**3. Color-Space Duality**
|
|
143
|
+
```
|
|
144
|
+
Spatial Axis ↔ Color Charge
|
|
145
|
+
─────────────────────────────
|
|
146
|
+
x-axis (e₁) ↔ Red (θ₁)
|
|
147
|
+
y-axis (e₂) ↔ Green (θ₂)
|
|
148
|
+
z-axis (e₃) ↔ Blue (θ₃)
|
|
149
|
+
|
|
150
|
+
Constraint: θ₁ + θ₂ + θ₃ = φ (color singlet)
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**4. Gauge Transformations**
|
|
154
|
+
```python
|
|
155
|
+
# U(1) gauge transform
|
|
156
|
+
frame_u1 = frame.gauge_transform_u1(phi)
|
|
157
|
+
|
|
158
|
+
# SU(2) gauge transform (weak interaction)
|
|
159
|
+
frame_su2 = frame.gauge_transform_su2((θx, θy, θz))
|
|
160
|
+
|
|
161
|
+
# SU(3) gauge transform (strong interaction)
|
|
162
|
+
frame_su3 = frame.gauge_transform_su3(gell_mann_params)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**5. Imaginary Time Evolution**
|
|
166
|
+
```python
|
|
167
|
+
# Imaginary time evolution U(τ) = exp(-τĤ) U(0)
|
|
168
|
+
frame_tau = frame.imaginary_time_evolution(tau=0.5, hamiltonian=H)
|
|
169
|
+
|
|
170
|
+
# Wick rotation: t → -iτ
|
|
171
|
+
frame_wick = frame.wick_rotation(real_time=1.0)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**6. Symmetry Breaking Potential**
|
|
175
|
+
```python
|
|
176
|
+
from coordinate_system import SymmetryBreakingPotential
|
|
177
|
+
|
|
178
|
+
# Higgs-type potential
|
|
179
|
+
potential = SymmetryBreakingPotential(
|
|
180
|
+
mu_squared=-1.0, # Negative triggers breaking
|
|
181
|
+
lambda_coupling=0.5,
|
|
182
|
+
gamma_coupling=0.1
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
# Find vacuum state
|
|
186
|
+
frame_vacuum = potential.find_vacuum()
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
#### 📐 **Physical Interpretation**
|
|
190
|
+
|
|
191
|
+
**Unified Framework:**
|
|
192
|
+
```
|
|
193
|
+
U(3) Complex Frame
|
|
194
|
+
/ | \
|
|
195
|
+
/ | \
|
|
196
|
+
Geometry Gauge Field Imaginary Time
|
|
197
|
+
(Real Part) (Connection) (Imag Part)
|
|
198
|
+
| | |
|
|
199
|
+
V V V
|
|
200
|
+
Metric Interactions Evolution
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
**Standard Model Gauge Group:**
|
|
204
|
+
| Layer | Gauge Group | Physical Field | Implementation |
|
|
205
|
+
|-------|-------------|----------------|----------------|
|
|
206
|
+
| **Strong** | SU(3) | 8 Gluons | `su3_component` |
|
|
207
|
+
| **Weak** | SU(2) | W⁺, W⁻, Z⁰ | `su2_component` |
|
|
208
|
+
| **EM** | U(1) | Photon (γ) | `u1_component` |
|
|
209
|
+
| **Unified** | U(3) | **Complex Frame** | `U3Frame` |
|
|
210
|
+
|
|
211
|
+
#### 🚀 **New Classes & Functions**
|
|
212
|
+
|
|
213
|
+
```python
|
|
214
|
+
from coordinate_system import (
|
|
215
|
+
# Core U(3) classes
|
|
216
|
+
U3Frame, # Complete U(3) unitary frame
|
|
217
|
+
SU3Component, # SU(3) decomposition
|
|
218
|
+
|
|
219
|
+
# Gauge field classes
|
|
220
|
+
GaugeConnection, # Gauge potential A_μ
|
|
221
|
+
FieldStrength, # Field strength F_μν
|
|
222
|
+
|
|
223
|
+
# Symmetry breaking
|
|
224
|
+
SymmetryBreakingPotential, # Higgs-type potential
|
|
225
|
+
|
|
226
|
+
# Constants
|
|
227
|
+
C_SPEED, # Speed of light
|
|
228
|
+
)
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
#### 📚 **Documentation**
|
|
232
|
+
|
|
233
|
+
- **Theory Guide**: `.doc/U3_FRAME_THEORY.md` - Complete mathematical framework
|
|
234
|
+
- **Upgrade Summary**: `UPGRADE_SUMMARY.md` - Detailed comparison with v6.0.1
|
|
235
|
+
- **Demo Program**: `examples/u3_gauge_theory_demo.py` - 9 comprehensive demonstrations
|
|
236
|
+
- **Original Paper**: `复标架与规范场.md` - Theoretical foundation
|
|
237
|
+
|
|
238
|
+
#### 🎓 **Example: Complete Gauge Theory Workflow**
|
|
239
|
+
|
|
240
|
+
```python
|
|
241
|
+
from coordinate_system import U3Frame, GaugeConnection, SymmetryBreakingPotential
|
|
242
|
+
import numpy as np
|
|
243
|
+
|
|
244
|
+
# 1. Create U(3) frame with color phases
|
|
245
|
+
theta_R, theta_G, theta_B = 0.1, 0.2, -0.3
|
|
246
|
+
e1 = np.array([np.exp(1j * theta_R), 0, 0])
|
|
247
|
+
e2 = np.array([0, np.exp(1j * theta_G), 0])
|
|
248
|
+
e3 = np.array([0, 0, np.exp(1j * theta_B)])
|
|
249
|
+
frame = U3Frame(e1, e2, e3)
|
|
250
|
+
|
|
251
|
+
# 2. Decompose to SU(3) × U(1)
|
|
252
|
+
su3_comp, u1_phase = frame.to_su3_u1()
|
|
253
|
+
print(f"SU(3) det: {np.linalg.det(su3_comp.matrix):.6f}") # Should be 1
|
|
254
|
+
|
|
255
|
+
# 3. Create gauge connections
|
|
256
|
+
connection_x = GaugeConnection(
|
|
257
|
+
su3_component=np.random.randn(8) * 0.1, # Gluons
|
|
258
|
+
su2_component=np.random.randn(3) * 0.1, # W/Z bosons
|
|
259
|
+
u1_component=0.05+0.02j # Photon
|
|
260
|
+
)
|
|
261
|
+
connection_y = GaugeConnection(...)
|
|
262
|
+
|
|
263
|
+
# 4. Calculate field strength
|
|
264
|
+
F_xy = connection_x.field_strength(connection_y)
|
|
265
|
+
S_YM = F_xy.yang_mills_action()
|
|
266
|
+
Q = F_xy.topological_charge()
|
|
267
|
+
print(f"Yang-Mills action: {S_YM:.6f}")
|
|
268
|
+
print(f"Topological charge: {Q:.6f}")
|
|
269
|
+
|
|
270
|
+
# 5. Symmetry breaking
|
|
271
|
+
potential = SymmetryBreakingPotential(mu_squared=-1.0)
|
|
272
|
+
frame_vacuum = potential.find_vacuum()
|
|
273
|
+
V_vac = potential.potential(frame_vacuum)
|
|
274
|
+
print(f"Vacuum energy: {V_vac:.6f}")
|
|
275
|
+
|
|
276
|
+
# 6. Gauge transformations
|
|
277
|
+
frame_u1 = frame.gauge_transform_u1(np.pi/4)
|
|
278
|
+
frame_su2 = frame.gauge_transform_su2((0.1, 0.2, 0.3))
|
|
279
|
+
frame_su3 = frame.gauge_transform_su3(np.random.randn(8) * 0.1)
|
|
280
|
+
|
|
281
|
+
# 7. Imaginary time evolution
|
|
282
|
+
H = np.diag([1.0, 2.0, 3.0])
|
|
283
|
+
frame_evolved = frame.imaginary_time_evolution(tau=0.5, hamiltonian=H)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
#### 🔑 **Key Formulas Implemented**
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
U(x) = [e₁, e₂, e₃] ∈ U(3) [U(3) Frame]
|
|
290
|
+
U(3) = SU(3) × U(1) [Decomposition]
|
|
291
|
+
A_μ = A_μ^{SU(3)} + A_μ^{SU(2)} + A_μ^{U(1)} [Gauge Connection]
|
|
292
|
+
F_μν = ∂_μ A_ν - ∂_ν A_μ + [A_μ, A_ν] [Field Strength]
|
|
293
|
+
S_YM = -1/(4g²) Tr(F_μν F^μν) [Yang-Mills Action]
|
|
294
|
+
U(τ) = exp(-τĤ) U(0) [Imaginary Time]
|
|
295
|
+
V(U) = -μ² Tr(U†U) + λ[Tr(U†U)]² + ... [Symmetry Breaking]
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### New Features Summary
|
|
299
|
+
|
|
300
|
+
- ✅ **Complete U(3) unitary matrix representation**
|
|
301
|
+
- ✅ **Symmetry decomposition: U(3) → SU(3) × SU(2) × U(1)**
|
|
302
|
+
- ✅ **Color phase extraction (Red, Green, Blue)**
|
|
303
|
+
- ✅ **Quaternion ↔ SU(2) correspondence**
|
|
304
|
+
- ✅ **Three gauge transformations (U(1), SU(2), SU(3))**
|
|
305
|
+
- ✅ **Gell-Mann & Pauli matrix implementations**
|
|
306
|
+
- ✅ **Gauge connection A_μ ∈ 𝔲(3)**
|
|
307
|
+
- ✅ **Field strength tensor F_μν**
|
|
308
|
+
- ✅ **Yang-Mills action & topological charge**
|
|
309
|
+
- ✅ **Imaginary time evolution & Wick rotation**
|
|
310
|
+
- ✅ **Symmetry breaking potential & vacuum finder**
|
|
311
|
+
- ✅ **Complete documentation & demos**
|
|
312
|
+
|
|
313
|
+
### Philosophical Vision
|
|
314
|
+
|
|
315
|
+
> *"The real part describes the space we inhabit,*
|
|
316
|
+
> *The imaginary part describes the time we traverse,*
|
|
317
|
+
> *The complex frame describes the existence we are."*
|
|
318
|
+
>
|
|
319
|
+
> — From the unified gauge theory framework
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## 🆕 What's New in v6.0.1 (2025-12-04)
|
|
324
|
+
|
|
325
|
+
### Classical Spectral Geometry Implementation
|
|
326
|
+
|
|
327
|
+
**FourierFrame-Based Spectral Geometry** - Complete implementation of **classical geometric spectral analysis** using FourierFrame as the mathematical foundation
|
|
328
|
+
|
|
329
|
+
> **Important Design Philosophy**:
|
|
330
|
+
>
|
|
331
|
+
> This library follows the progression: **Coordinate System (Geometric Frame) → Curvature Computation → FourierFrame → Spectral Geometry**
|
|
332
|
+
>
|
|
333
|
+
> All implementations are **classical geometric tools** suitable for numerical computation on standard computers. While the mathematical formalism resembles quantum theory, this is purely **classical differential geometry** without quantum physical interpretation.
|
|
334
|
+
|
|
335
|
+
#### 🎯 **Core Class Renaming (Breaking Change)**
|
|
336
|
+
- **QFrame → FourierFrame**: More descriptive name avoiding confusion with generic "Frame"
|
|
337
|
+
- **QFrameSpectrum → FourierFrameSpectrum**: Consistent naming convention
|
|
338
|
+
- **Backward Compatibility**: All old names (QFrame, QFrameSpectrum) retained as aliases
|
|
339
|
+
|
|
340
|
+
#### 🌟 **FourierFrame as Mathematical Foundation**
|
|
341
|
+
|
|
342
|
+
**FourierFrame represents the mathematical language for all spectral geometry formulas:**
|
|
343
|
+
|
|
344
|
+
**1. FourierFrame Algebra (复标架代数)**
|
|
345
|
+
```python
|
|
346
|
+
# Core transformations
|
|
347
|
+
FourierFrame * e^{iθ} # Fourier transform (phase rotation)
|
|
348
|
+
FourierFrame * λ # Conformal transform (scaling)
|
|
349
|
+
e^{tΔ} FourierFrame # Diffusion evolution (heat equation solution)
|
|
350
|
+
```
|
|
351
|
+
- Complex extension of coordinate frames: FourierFrame = coord3 ⊗ ℂ
|
|
352
|
+
- Mathematical tool for spectral analysis (not quantum states)
|
|
353
|
+
- Laplacian operator: Δ log FourierFrame
|
|
354
|
+
|
|
355
|
+
**2. IntrinsicGradient (内禀梯度算子)**
|
|
356
|
+
```python
|
|
357
|
+
G_μ = d/dx^μ log FourierFrame(x)
|
|
358
|
+
```
|
|
359
|
+
- **Geometric meaning**: Local frame rotation rate (covariant derivative)
|
|
360
|
+
- Corresponds to connection 1-form in Riemannian geometry
|
|
361
|
+
- Computes curvature via Lie bracket: R_{μν} = [G_μ, G_ν]
|
|
362
|
+
- **Classical object**: No quantum interpretation needed
|
|
363
|
+
|
|
364
|
+
**3. HeatKernel (热核 - Heat Equation Solution)**
|
|
365
|
+
```python
|
|
366
|
+
∂u/∂t = Δu (Classical heat equation)
|
|
367
|
+
Tr(e^{tΔ}) ~ (4πt)^{-d/2} [a₀ + a₁t + a₂t² + ...]
|
|
368
|
+
```
|
|
369
|
+
- **FourierFrame evolution**: FourierFrame(x,t) = e^{tΔ} FourierFrame(x,0)
|
|
370
|
+
- **Classical diffusion process** (NOT quantum imaginary time)
|
|
371
|
+
- Heat kernel coefficients encode geometric invariants:
|
|
372
|
+
- a₀ = Volume of manifold
|
|
373
|
+
- a₁ ∝ ∫ Scalar curvature
|
|
374
|
+
- a₂ ∝ ∫ (R² + higher curvature terms)
|
|
375
|
+
- **Application**: ShapeDNA, spectral distances, multi-scale analysis
|
|
376
|
+
|
|
377
|
+
**4. SpectralDecomposition (谱分解)**
|
|
378
|
+
```python
|
|
379
|
+
Δφ_n = -λ_n φ_n (Laplacian eigenvalue problem)
|
|
380
|
+
FourierFrame(x) = Σ_n c_n φ_n(x) FourierFrame_n
|
|
381
|
+
```
|
|
382
|
+
- **FourierFrame as eigenstates**: Expansion in Laplacian eigenbasis
|
|
383
|
+
- **Shape DNA**: Eigenvalue spectrum {λ_n} characterizes manifold geometry
|
|
384
|
+
- Weyl asymptotic law: N(λ) ~ (1/4π) Area(M) λ (2D case)
|
|
385
|
+
- **Classical spectral theory**: "Can one hear the shape of a drum?" (Kac, 1966)
|
|
386
|
+
|
|
387
|
+
**5. BerryPhase (几何相位)**
|
|
388
|
+
```python
|
|
389
|
+
γ = ∮_C G_μ dx^μ
|
|
390
|
+
```
|
|
391
|
+
- **Classical geometric phase**: Parallel transport in frame bundle
|
|
392
|
+
- **NOT quantum Berry phase** (though mathematically analogous)
|
|
393
|
+
- Path-independent topological quantity
|
|
394
|
+
- Related to Chern number via Stokes theorem
|
|
395
|
+
|
|
396
|
+
**6. ChernNumber (陈数)**
|
|
397
|
+
```python
|
|
398
|
+
c₁ = (1/2π) ∬_M R_{μν} dS
|
|
399
|
+
```
|
|
400
|
+
- **Topological invariant** of fiber bundle
|
|
401
|
+
- Integer-valued geometric index
|
|
402
|
+
- Characterizes global geometry of FourierFrame field
|
|
403
|
+
- **Classical topology**: No quantum Hall effect interpretation here
|
|
404
|
+
|
|
405
|
+
**7. CurvatureFromFrame (曲率计算)**
|
|
406
|
+
```python
|
|
407
|
+
R_{μν} = [G_μ, G_ν]
|
|
408
|
+
K = -Im(R_{xy}) (Gaussian curvature, for complex frames)
|
|
409
|
+
```
|
|
410
|
+
- Curvature computed from FourierFrame field
|
|
411
|
+
- Intrinsic gradient formulation
|
|
412
|
+
- **Classical differential geometry**
|
|
413
|
+
|
|
414
|
+
#### 📐 **Mathematical Framework (Classical)**
|
|
415
|
+
|
|
416
|
+
**Based on:**
|
|
417
|
+
- Differential geometry (Riemannian manifolds, curvature)
|
|
418
|
+
- Spectral theory (Laplacian eigenvalue problems)
|
|
419
|
+
- Fiber bundle theory (frame bundles, connections)
|
|
420
|
+
- Lie algebra (commutators, curvature 2-forms)
|
|
421
|
+
|
|
422
|
+
**Theoretical Limitations:**
|
|
423
|
+
- ⚠️ **Classical only**: No quantum superposition, entanglement, or measurement
|
|
424
|
+
- ⚠️ **Computational**: Requires discretization (finite difference, spectral methods)
|
|
425
|
+
- ⚠️ **Not quantum computing**: All operations run on classical computers
|
|
426
|
+
- ⚠️ Forms **resemble** quantum theory but physical interpretation is purely geometric
|
|
427
|
+
|
|
428
|
+
#### 🔬 **Core Formulas Summary**
|
|
429
|
+
```
|
|
430
|
+
FourierFrame = coord3 ⊗ ℂ [Mathematical Foundation]
|
|
431
|
+
G_μ = d/dx^μ log FourierFrame(x) [Intrinsic Gradient]
|
|
432
|
+
R_{μν} = [G_μ, G_ν] [Curvature]
|
|
433
|
+
Δ log FourierFrame = ∂²/∂x² + ∂²/∂y² [Laplacian]
|
|
434
|
+
e^{tΔ} FourierFrame = Heat diffusion evolution [Heat Kernel]
|
|
435
|
+
Δφ_n = -λ_n φ_n [Spectral Decomposition]
|
|
436
|
+
FourierFrame = Σ_n c_n φ_n FourierFrame_n [Eigenbasis Expansion]
|
|
437
|
+
γ = ∮ G_μ dx^μ [Geometric Phase]
|
|
438
|
+
c₁ = (1/2π) ∬ R_{μν} dS [Chern Number]
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Breaking Changes
|
|
442
|
+
|
|
443
|
+
- `QFrame` → `FourierFrame` (old name works as alias)
|
|
444
|
+
- `QFrameSpectrum` → `FourierFrameSpectrum` (old name works as alias)
|
|
445
|
+
- `qframes.py` deleted (functionality moved to `frames.py`)
|
|
446
|
+
- Quantum-related classes removed (QuantumState, PathIntegral, Dirac notation)
|
|
447
|
+
|
|
448
|
+
### Migration Guide
|
|
449
|
+
|
|
450
|
+
```python
|
|
451
|
+
# Old code (still works with aliases):
|
|
452
|
+
from coordinate_system import QFrame, QFrameSpectrum
|
|
453
|
+
|
|
454
|
+
# New code (recommended):
|
|
455
|
+
from coordinate_system import FourierFrame, FourierFrameSpectrum
|
|
456
|
+
|
|
457
|
+
# Full classical spectral geometry toolkit:
|
|
458
|
+
from coordinate_system import (
|
|
459
|
+
FourierFrame, FourierFrameSpectrum,
|
|
460
|
+
IntrinsicGradient, CurvatureFromFrame,
|
|
461
|
+
BerryPhase, ChernNumber,
|
|
462
|
+
SpectralDecomposition, HeatKernel,
|
|
463
|
+
FrequencyProjection, FrequencyBandState,
|
|
464
|
+
)
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
**Example: Heat Kernel Diffusion**
|
|
468
|
+
```python
|
|
469
|
+
from coordinate_system import FourierFrame, HeatKernel
|
|
470
|
+
|
|
471
|
+
# Create a FourierFrame field
|
|
472
|
+
frame_field = [[FourierFrame(q_factor=1.0 + 0.1j*(i+j))
|
|
473
|
+
for j in range(10)] for i in range(10)]
|
|
474
|
+
|
|
475
|
+
# Initialize heat kernel
|
|
476
|
+
heat = HeatKernel(frame_field)
|
|
477
|
+
|
|
478
|
+
# Evolve using classical diffusion (NOT quantum evolution)
|
|
479
|
+
t = 0.1 # Diffusion time
|
|
480
|
+
evolved_field = heat.evolution_operator(t, kappa=1.0)
|
|
481
|
+
|
|
482
|
+
# Compute heat kernel trace (geometric invariant)
|
|
483
|
+
trace = heat.trace(t)
|
|
484
|
+
|
|
485
|
+
# Asymptotic expansion (extracts curvature information)
|
|
486
|
+
asymptotic = heat.asymptotic_expansion(t, order=2)
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## 🆕 What's New in v6.0.0 (2025-12-03)
|
|
492
|
+
|
|
493
|
+
### Major Architecture Refactoring
|
|
494
|
+
|
|
495
|
+
**Unified Differential Geometry Module** - Complete integration of curvature computation methods
|
|
496
|
+
|
|
497
|
+
- **Merged Module**: `differential_geometry.py` now contains both classical and intrinsic gradient methods
|
|
498
|
+
- **Dual Method Support**:
|
|
499
|
+
- Intrinsic gradient method (default): `compute_gaussian_curvature()`, `compute_mean_curvature()`
|
|
500
|
+
- Classical method: `gaussian_curvature_classical()`, `mean_curvature_classical()`
|
|
501
|
+
- **Backward Compatibility**: Old function names still work as aliases
|
|
502
|
+
- **High-Order Finite Differences**: 5-point formulas with O(h⁴) accuracy
|
|
503
|
+
- **All English Documentation**: Complete internationalization for global distribution
|
|
504
|
+
|
|
505
|
+
**Enhanced Visualization Module** - Professional surface and curvature rendering
|
|
506
|
+
|
|
507
|
+
- **New Class**: `SurfaceVisualizer` with curvature coloring support
|
|
508
|
+
- **Curvature Visualization**: Diverging colormap (blue-white-red) for Gaussian/Mean curvature
|
|
509
|
+
- **Surface Frame Fields**: RGB-coded tangent frames (red=u direction, green=v direction, blue=normal)
|
|
510
|
+
- **Enhanced Curve Rendering**: Binormal support, improved styling
|
|
511
|
+
- **Integration**: Direct support for differential_geometry surfaces
|
|
512
|
+
- **Convenience Functions**: `visualize_surface()` for quick visualization
|
|
513
|
+
|
|
514
|
+
**Runtime Handedness Switching** - Flexible coordinate system control
|
|
515
|
+
|
|
516
|
+
- **Global Control**: Switch between left-handed and right-handed systems at runtime
|
|
517
|
+
- **API Functions**: `set_handedness('left'/'right')`, `get_handedness()`, `is_left_handed()`
|
|
518
|
+
- **Automatic Adaptation**: All vector operations, quaternions, and Frenet frames adjust automatically
|
|
519
|
+
- **Cross-Platform Compatibility**: Seamlessly work with DirectX (left-handed) and OpenGL (right-handed) conventions
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
## Features
|
|
524
|
+
|
|
525
|
+
### Core Components
|
|
526
|
+
|
|
527
|
+
**C++ Performance Layer:**
|
|
528
|
+
- **vec3** - 3D vector with comprehensive operations
|
|
529
|
+
- **vec2** - 2D vector for parametric coordinates
|
|
530
|
+
- **quat** - Quaternion for 3D rotations
|
|
531
|
+
- **coord3** - Complete 3D coordinate system (position, rotation, scale)
|
|
532
|
+
|
|
533
|
+
**Advanced Mathematics Modules:**
|
|
534
|
+
- **differential_geometry** - Surface analysis with dual curvature methods
|
|
535
|
+
- **frames** - Complex frame algebra with spectral geometry
|
|
536
|
+
- **visualization** - Professional 3D rendering for geometry and curvature
|
|
537
|
+
- **curve_interpolation** - C2-continuous curve and frame interpolation
|
|
538
|
+
|
|
539
|
+
### Operations
|
|
540
|
+
|
|
541
|
+
- Vector arithmetic (+, -, *, /)
|
|
542
|
+
- Dot product, cross product (runtime switchable handedness)
|
|
543
|
+
- Vector projection, reflection
|
|
544
|
+
- Linear interpolation (lerp)
|
|
545
|
+
- Spherical linear interpolation (slerp)
|
|
546
|
+
- Coordinate system transformations
|
|
547
|
+
- Euler angle conversion
|
|
548
|
+
- Gaussian and mean curvature computation
|
|
549
|
+
- Spectral analysis and Fourier transforms
|
|
550
|
+
- **Runtime handedness control** (left/right-handed systems)
|
|
551
|
+
- **Spectral geometry analysis** (Berry phase, Chern number, heat kernel)
|
|
552
|
+
|
|
553
|
+
### Performance
|
|
554
|
+
|
|
555
|
+
- Written in optimized C++17
|
|
556
|
+
- Python bindings via pybind11
|
|
557
|
+
- Over 1,000,000 operations per second
|
|
558
|
+
- GPU acceleration for spectral transforms (optional)
|
|
559
|
+
|
|
560
|
+
### Platform Support
|
|
561
|
+
|
|
562
|
+
- ✅ Windows (7, 10, 11)
|
|
563
|
+
- ✅ Linux (Ubuntu, Debian, CentOS, etc.)
|
|
564
|
+
- ✅ macOS (10.14+)
|
|
565
|
+
|
|
566
|
+
---
|
|
567
|
+
|
|
568
|
+
## 📚 Documentation
|
|
569
|
+
|
|
570
|
+
### Mathematical Foundation
|
|
571
|
+
|
|
572
|
+
For a comprehensive understanding of the mathematical principles behind coordinate systems, vectors, quaternions, and differential geometry, see our detailed guide:
|
|
573
|
+
|
|
574
|
+
**[📖 Mathematical Foundation of Coordinate Systems](https://github.com/panguojun/Coordinate-System)**
|
|
575
|
+
|
|
576
|
+
### Module Documentation
|
|
577
|
+
|
|
578
|
+
- [Curve Interpolation Guide](CURVE_INTERPOLATION_README.md)
|
|
579
|
+
- [C2 Interpolation Guide](C2_INTERPOLATION_GUIDE.md)
|
|
580
|
+
|
|
581
|
+
---
|
|
582
|
+
|
|
583
|
+
## Installation
|
|
584
|
+
|
|
585
|
+
### From PyPI (Recommended)
|
|
586
|
+
|
|
587
|
+
```bash
|
|
588
|
+
pip install coordinate-system
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
### From Source
|
|
592
|
+
|
|
593
|
+
```bash
|
|
594
|
+
git clone https://github.com/panguojun/Coordinate-System.git
|
|
595
|
+
cd Coordinate-System
|
|
596
|
+
pip install .
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
---
|
|
600
|
+
|
|
601
|
+
## Quick Start
|
|
602
|
+
|
|
603
|
+
```python
|
|
604
|
+
from coordinate_system import vec3, quat, coord3
|
|
605
|
+
|
|
606
|
+
# Create vectors
|
|
607
|
+
v1 = vec3(1, 2, 3)
|
|
608
|
+
v2 = vec3(4, 5, 6)
|
|
609
|
+
|
|
610
|
+
# Vector operations
|
|
611
|
+
v3 = v1 + v2 # Addition: vec3(5, 7, 9)
|
|
612
|
+
dot = v1.dot(v2) # Dot product: 32.0
|
|
613
|
+
cross = v1.cross(v2) # Cross product (left-handed)
|
|
614
|
+
length = v1.length() # Length: 3.742
|
|
615
|
+
normalized = v1.normcopy() # Unit vector
|
|
616
|
+
|
|
617
|
+
# Quaternion rotation
|
|
618
|
+
axis = vec3(0, 0, 1) # Z axis
|
|
619
|
+
q = quat(1.5708, axis) # 90 degrees rotation
|
|
620
|
+
rotated = q * v1 # Rotate v1
|
|
621
|
+
|
|
622
|
+
# Coordinate systems
|
|
623
|
+
frame = coord3.from_angle(1.57, vec3(0, 0, 1)) # Frame rotated 90°
|
|
624
|
+
world_pos = v1 * frame # Transform to world space
|
|
625
|
+
local_pos = world_pos / frame # Transform back to local
|
|
626
|
+
|
|
627
|
+
# Differential geometry
|
|
628
|
+
from coordinate_system import Sphere, compute_gaussian_curvature
|
|
629
|
+
|
|
630
|
+
sphere = Sphere(radius=1.0)
|
|
631
|
+
K = compute_gaussian_curvature(sphere, u=0.5, v=0.5) # K = 1.0 for unit sphere
|
|
632
|
+
|
|
633
|
+
# Visualization
|
|
634
|
+
from coordinate_system import visualize_surface
|
|
635
|
+
|
|
636
|
+
visualize_surface(sphere, curvature_type='gaussian', show_colorbar=True)
|
|
637
|
+
|
|
638
|
+
# Spectral geometry (NEW in 6.0.1)
|
|
639
|
+
from coordinate_system import (
|
|
640
|
+
FourierFrame, IntrinsicGradient,
|
|
641
|
+
CurvatureFromFrame, BerryPhase
|
|
642
|
+
)
|
|
643
|
+
|
|
644
|
+
# Create frame field
|
|
645
|
+
frame_field = [[FourierFrame(q_factor=1.0 + 0.1j*(i+j))
|
|
646
|
+
for j in range(10)] for i in range(10)]
|
|
647
|
+
|
|
648
|
+
# Compute intrinsic gradient
|
|
649
|
+
grad_op = IntrinsicGradient(frame_field)
|
|
650
|
+
G_x = grad_op.compute_at((5, 5), 0) # ∂_x log FourierFrame
|
|
651
|
+
|
|
652
|
+
# Compute curvature
|
|
653
|
+
curv_calc = CurvatureFromFrame(frame_field)
|
|
654
|
+
K = curv_calc.gaussian_curvature(5, 5)
|
|
655
|
+
|
|
656
|
+
# Compute Berry phase
|
|
657
|
+
berry = BerryPhase(grad_op)
|
|
658
|
+
path = [(1, 1), (1, 8), (8, 8), (8, 1), (1, 1)]
|
|
659
|
+
gamma = berry.compute_along_path(path) # γ = ∮ G_μ dx^μ
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
---
|
|
663
|
+
|
|
664
|
+
## Module Guide
|
|
665
|
+
|
|
666
|
+
### Complex Frame Module (NEW in 6.0.1)
|
|
667
|
+
|
|
668
|
+
```python
|
|
669
|
+
from coordinate_system import (
|
|
670
|
+
# Core classes
|
|
671
|
+
FourierFrame, QuantumState, PathIntegral, FourierFrameSpectrum,
|
|
672
|
+
|
|
673
|
+
# Spectral geometry core
|
|
674
|
+
IntrinsicGradient, CurvatureFromFrame,
|
|
675
|
+
BerryPhase, ChernNumber,
|
|
676
|
+
SpectralDecomposition, HeatKernel,
|
|
677
|
+
FrequencyProjection, FrequencyBandState,
|
|
678
|
+
|
|
679
|
+
# Dirac notation (optional export)
|
|
680
|
+
DiracBra, DiracKet, bra, ket,
|
|
681
|
+
|
|
682
|
+
# Spectral transforms
|
|
683
|
+
spectral_transform, inverse_spectral_transform,
|
|
684
|
+
|
|
685
|
+
# Constants
|
|
686
|
+
HBAR, GPU_AVAILABLE,
|
|
687
|
+
)
|
|
688
|
+
|
|
689
|
+
# Create complex frame
|
|
690
|
+
cf = FourierFrame(base_coord=coord3(), q_factor=1.0+0.5j)
|
|
691
|
+
|
|
692
|
+
# Fourier transform (phase rotation)
|
|
693
|
+
cf_ft = cf.fourier_transform(theta=np.pi/2) # FourierFrame * e^{iθ}
|
|
694
|
+
|
|
695
|
+
# Conformal transform (scaling)
|
|
696
|
+
cf_conf = cf.conformal_transform(2.0) # FourierFrame * λ
|
|
697
|
+
|
|
698
|
+
# Intrinsic gradient operator
|
|
699
|
+
frame_field = [[FourierFrame(q_factor=1.0 + 0.1j*(i+j))
|
|
700
|
+
for j in range(16)] for i in range(16)]
|
|
701
|
+
grad_op = IntrinsicGradient(frame_field)
|
|
702
|
+
G_x = grad_op.compute_at((8, 8), 0) # G_x = ∂_x log FourierFrame
|
|
703
|
+
G_y = grad_op.compute_at((8, 8), 1) # G_y = ∂_y log FourierFrame
|
|
704
|
+
|
|
705
|
+
# Curvature from frame field
|
|
706
|
+
curv_calc = CurvatureFromFrame(frame_field)
|
|
707
|
+
K = curv_calc.gaussian_curvature(8, 8) # Gaussian curvature
|
|
708
|
+
H = curv_calc.mean_curvature(8, 8) # Mean curvature
|
|
709
|
+
|
|
710
|
+
# Berry phase
|
|
711
|
+
berry = BerryPhase(grad_op)
|
|
712
|
+
path = [(4, 4), (4, 12), (12, 12), (12, 4), (4, 4)]
|
|
713
|
+
gamma = berry.compute_along_path(path, closed=True) # γ = ∮ G_μ dx^μ
|
|
714
|
+
|
|
715
|
+
# Chern number (topological invariant)
|
|
716
|
+
chern = ChernNumber(curv_calc)
|
|
717
|
+
c1 = chern.compute() # c₁ = (1/2π) ∬ R_{μν} dS
|
|
718
|
+
|
|
719
|
+
# Spectral decomposition
|
|
720
|
+
# First create a FourierFrameSpectrum from coordinate field
|
|
721
|
+
import numpy as np
|
|
722
|
+
coord_field = [[coord3(vec3(i, j, 0)) for j in range(16)] for i in range(16)]
|
|
723
|
+
spectrum = spectral_transform(coord_field)
|
|
724
|
+
|
|
725
|
+
decomp = SpectralDecomposition(spectrum)
|
|
726
|
+
eigenvalues, _ = decomp.compute_eigenspectrum()
|
|
727
|
+
shape_dna = decomp.shape_dna(n_modes=50) # First 50 eigenvalues
|
|
728
|
+
|
|
729
|
+
# Heat kernel
|
|
730
|
+
heat = HeatKernel(decomp)
|
|
731
|
+
trace_t = heat.trace(t=0.1) # Tr(e^{-tK̂})
|
|
732
|
+
asymp = heat.asymptotic_expansion(t=0.1, order=3)
|
|
733
|
+
|
|
734
|
+
# Frequency projection
|
|
735
|
+
freq_proj = FrequencyProjection(decomp)
|
|
736
|
+
frequencies = freq_proj.compute_frequencies() # ω_n = √|κ_n| · sign(κ_n)
|
|
737
|
+
band_state = freq_proj.project_to_band(omega_min=0.5, omega_max=2.0)
|
|
738
|
+
```
|
|
739
|
+
|
|
740
|
+
### Differential Geometry Module
|
|
741
|
+
|
|
742
|
+
```python
|
|
743
|
+
from coordinate_system import (
|
|
744
|
+
# Surface classes
|
|
745
|
+
Surface, Sphere, Torus,
|
|
746
|
+
|
|
747
|
+
# Intrinsic gradient method (default, more accurate)
|
|
748
|
+
compute_gaussian_curvature,
|
|
749
|
+
compute_mean_curvature,
|
|
750
|
+
compute_riemann_curvature,
|
|
751
|
+
compute_all_curvatures,
|
|
752
|
+
|
|
753
|
+
# Classical method (high-order finite differences)
|
|
754
|
+
gaussian_curvature_classical,
|
|
755
|
+
mean_curvature_classical,
|
|
756
|
+
principal_curvatures_classical,
|
|
757
|
+
|
|
758
|
+
# Method comparison
|
|
759
|
+
compare_methods,
|
|
760
|
+
)
|
|
761
|
+
|
|
762
|
+
# Create a surface
|
|
763
|
+
sphere = Sphere(radius=2.0)
|
|
764
|
+
torus = Torus(major_radius=3.0, minor_radius=1.0)
|
|
765
|
+
|
|
766
|
+
# Compute curvature (intrinsic gradient method)
|
|
767
|
+
K = compute_gaussian_curvature(sphere, u=0.5, v=0.5)
|
|
768
|
+
H = compute_mean_curvature(sphere, u=0.5, v=0.5)
|
|
769
|
+
|
|
770
|
+
# Use classical method
|
|
771
|
+
K_classical = gaussian_curvature_classical(sphere, u=0.5, v=0.5)
|
|
772
|
+
|
|
773
|
+
# Compare methods
|
|
774
|
+
results = compare_methods(sphere, u=0.5, v=0.5)
|
|
775
|
+
print(f"Intrinsic: K={results['intrinsic']['K']:.6f}")
|
|
776
|
+
print(f"Classical: K={results['classical']['K']:.6f}")
|
|
777
|
+
```
|
|
778
|
+
|
|
779
|
+
### Visualization Module
|
|
780
|
+
|
|
781
|
+
```python
|
|
782
|
+
from coordinate_system import (
|
|
783
|
+
CoordinateSystemVisualizer,
|
|
784
|
+
CurveVisualizer,
|
|
785
|
+
SurfaceVisualizer,
|
|
786
|
+
visualize_coord_system,
|
|
787
|
+
visualize_curve,
|
|
788
|
+
visualize_surface,
|
|
789
|
+
)
|
|
790
|
+
|
|
791
|
+
# Quick surface visualization with curvature
|
|
792
|
+
from coordinate_system import Sphere
|
|
793
|
+
|
|
794
|
+
sphere = Sphere(radius=1.0)
|
|
795
|
+
visualize_surface(
|
|
796
|
+
sphere,
|
|
797
|
+
curvature_type='gaussian', # or 'mean'
|
|
798
|
+
show_colorbar=True,
|
|
799
|
+
show_normals=False,
|
|
800
|
+
show_frames=True,
|
|
801
|
+
title='Sphere with Gaussian Curvature'
|
|
802
|
+
)
|
|
803
|
+
```
|
|
804
|
+
|
|
805
|
+
---
|
|
806
|
+
|
|
807
|
+
## Advanced Examples
|
|
808
|
+
|
|
809
|
+
### Spectral Geometry Analysis (NEW)
|
|
810
|
+
|
|
811
|
+
```python
|
|
812
|
+
from coordinate_system import (
|
|
813
|
+
FourierFrame, IntrinsicGradient,
|
|
814
|
+
CurvatureFromFrame, BerryPhase, ChernNumber,
|
|
815
|
+
SpectralDecomposition, spectral_transform
|
|
816
|
+
)
|
|
817
|
+
import numpy as np
|
|
818
|
+
|
|
819
|
+
# Create a complex frame field (wave-like pattern)
|
|
820
|
+
nx, ny = 32, 32
|
|
821
|
+
frame_field = []
|
|
822
|
+
for i in range(ny):
|
|
823
|
+
row = []
|
|
824
|
+
for j in range(nx):
|
|
825
|
+
phase = 2*np.pi*(i/ny + j/nx)
|
|
826
|
+
amplitude = 1.0 + 0.3*np.sin(2*np.pi*i/ny)*np.cos(2*np.pi*j/nx)
|
|
827
|
+
q = amplitude * np.exp(1j * phase)
|
|
828
|
+
row.append(FourierFrame(q_factor=q))
|
|
829
|
+
frame_field.append(row)
|
|
830
|
+
|
|
831
|
+
# 1. Intrinsic gradient
|
|
832
|
+
grad_op = IntrinsicGradient(frame_field)
|
|
833
|
+
print("=== Intrinsic Gradient ===")
|
|
834
|
+
for i in range(5, 28, 8):
|
|
835
|
+
for j in range(5, 28, 8):
|
|
836
|
+
G_x = grad_op.compute_at((i, j), 0)
|
|
837
|
+
G_y = grad_op.compute_at((i, j), 1)
|
|
838
|
+
print(f" ({i},{j}): G_x={G_x:.4f}, G_y={G_y:.4f}")
|
|
839
|
+
|
|
840
|
+
# 2. Curvature
|
|
841
|
+
curv_calc = CurvatureFromFrame(frame_field)
|
|
842
|
+
print("\n=== Curvature ===")
|
|
843
|
+
K_values = []
|
|
844
|
+
for i in range(5, 28, 4):
|
|
845
|
+
for j in range(5, 28, 4):
|
|
846
|
+
K = curv_calc.gaussian_curvature(i, j)
|
|
847
|
+
K_values.append(K)
|
|
848
|
+
if abs(K) > 0.01:
|
|
849
|
+
print(f" ({i},{j}): K={K:.6f}")
|
|
850
|
+
print(f" Average |K|: {np.mean(np.abs(K_values)):.6f}")
|
|
851
|
+
|
|
852
|
+
# 3. Berry phase
|
|
853
|
+
berry = BerryPhase(grad_op)
|
|
854
|
+
print("\n=== Berry Phase ===")
|
|
855
|
+
# Square path
|
|
856
|
+
path_square = [(8, 8), (8, 24), (24, 24), (24, 8), (8, 8)]
|
|
857
|
+
gamma_square = berry.compute_along_path(path_square, closed=True)
|
|
858
|
+
print(f" Square path: γ = {gamma_square:.6f}")
|
|
859
|
+
|
|
860
|
+
# Circular path
|
|
861
|
+
path_circle = []
|
|
862
|
+
for theta in np.linspace(0, 2*np.pi, 32):
|
|
863
|
+
i = int(16 + 8*np.cos(theta))
|
|
864
|
+
j = int(16 + 8*np.sin(theta))
|
|
865
|
+
path_circle.append((i, j))
|
|
866
|
+
gamma_circle = berry.compute_along_path(path_circle, closed=True)
|
|
867
|
+
print(f" Circular path: γ = {gamma_circle:.6f}")
|
|
868
|
+
|
|
869
|
+
# 4. Chern number
|
|
870
|
+
chern = ChernNumber(curv_calc)
|
|
871
|
+
c1 = chern.compute()
|
|
872
|
+
print(f"\n=== Topological Invariant ===")
|
|
873
|
+
print(f" First Chern number: c₁ = {c1}")
|
|
874
|
+
|
|
875
|
+
# 5. Spectral decomposition
|
|
876
|
+
coord_field = [[coord3(vec3(j, i, np.sin(2*np.pi*j/nx)*np.cos(2*np.pi*i/ny)))
|
|
877
|
+
for j in range(nx)] for i in range(ny)]
|
|
878
|
+
spectrum = spectral_transform(coord_field)
|
|
879
|
+
decomp = SpectralDecomposition(spectrum)
|
|
880
|
+
eigenvalues, _ = decomp.compute_eigenspectrum()
|
|
881
|
+
|
|
882
|
+
print(f"\n=== Spectral Decomposition ===")
|
|
883
|
+
print(f" Total modes: {len(eigenvalues)}")
|
|
884
|
+
print(f" Top 10 eigenvalues:")
|
|
885
|
+
for i, ev in enumerate(eigenvalues[:10]):
|
|
886
|
+
print(f" λ_{i} = {ev:.6f}")
|
|
887
|
+
|
|
888
|
+
# Shape DNA
|
|
889
|
+
shape_dna = decomp.shape_dna(n_modes=50)
|
|
890
|
+
print(f" Shape DNA (first 5): {shape_dna[:5]}")
|
|
891
|
+
|
|
892
|
+
# Weyl counting
|
|
893
|
+
n_below_1 = decomp.weyl_counting(kappa=1.0)
|
|
894
|
+
print(f" Eigenvalues < 1.0: {n_below_1}")
|
|
895
|
+
|
|
896
|
+
print("\n" + "="*60)
|
|
897
|
+
print("Spectral Geometry Analysis Complete!")
|
|
898
|
+
print("="*60)
|
|
899
|
+
```
|
|
900
|
+
|
|
901
|
+
---
|
|
902
|
+
|
|
903
|
+
## Performance
|
|
904
|
+
|
|
905
|
+
Benchmark on Intel i7-10700K @ 3.8GHz:
|
|
906
|
+
|
|
907
|
+
| Operation | Ops/second | Notes |
|
|
908
|
+
|-----------|-----------|-------|
|
|
909
|
+
| Vector addition | 5,200,000 | C++ optimized |
|
|
910
|
+
| Dot product | 4,800,000 | C++ optimized |
|
|
911
|
+
| Cross product | 3,500,000 | C++ optimized |
|
|
912
|
+
| Normalize | 2,100,000 | C++ optimized |
|
|
913
|
+
| Quaternion rotation | 1,800,000 | C++ optimized |
|
|
914
|
+
| Gaussian curvature | 85,000 | Python + NumPy |
|
|
915
|
+
| Spectral transform (CPU) | 1,200/sec | 64×64 field |
|
|
916
|
+
| Spectral transform (GPU) | 12,000/sec | 64×64 field, CuPy |
|
|
917
|
+
| Intrinsic gradient | 180,000 | Python + NumPy |
|
|
918
|
+
| Berry phase (path) | 25,000 | Python |
|
|
919
|
+
|
|
920
|
+
---
|
|
921
|
+
|
|
922
|
+
## Changelog
|
|
923
|
+
|
|
924
|
+
### Version 6.0.3 (2025-12-04)
|
|
925
|
+
- 🚀 **U(3) GAUGE THEORY FRAMEWORK**: Complete implementation of unified gauge field theory
|
|
926
|
+
- ✨ **U3Frame Class**: Full 3×3 unitary matrix representation (U(3) group)
|
|
927
|
+
- ✨ **Symmetry Decomposition**: U(3) → SU(3) × SU(2) × U(1) breaking chain
|
|
928
|
+
- 🎨 **Color-Space Duality**: RGB color phases ↔ Spatial axes correspondence
|
|
929
|
+
- 🌟 **GaugeConnection**: Unified gauge potential A_μ = A^{SU(3)} + A^{SU(2)} + A^{U(1)}
|
|
930
|
+
- 🌟 **FieldStrength**: Yang-Mills field tensor F_μν with action & topological charge
|
|
931
|
+
- 🔬 **Gell-Mann Matrices**: Complete SU(3) generators (8 matrices)
|
|
932
|
+
- 🔬 **Pauli Matrices**: SU(2) generators (3 matrices)
|
|
933
|
+
- 🎯 **Quaternion ↔ SU(2)**: Direct correspondence interface
|
|
934
|
+
- ⚛️ **Imaginary Time Evolution**: U(τ) = exp(-τĤ) U(0) with Wick rotation
|
|
935
|
+
- 🔮 **Symmetry Breaking**: Higgs-type potential with vacuum state finder
|
|
936
|
+
- 📚 **Complete Documentation**: Theory guide, upgrade summary, demo programs
|
|
937
|
+
- 🗑️ **Cleanup**: Removed obsolete build files and created .gitignore
|
|
938
|
+
|
|
939
|
+
### Version 6.0.1 (2025-12-04)
|
|
940
|
+
- 🎯 **COMPLETE SPECTRAL GEOMETRY**: Full implementation of quantum spectral geometry framework
|
|
941
|
+
- ✨ **FourierFrame Renaming**: QFrame → FourierFrame (clearer naming)
|
|
942
|
+
- 🌟 **IntrinsicGradient**: G_μ = d/dx^μ log FourierFrame(x)
|
|
943
|
+
- 🌟 **CurvatureFromFrame**: R_{μν} = [G_μ, G_ν]
|
|
944
|
+
- 🌟 **BerryPhase**: γ = ∮ G_μ dx^μ (geometric phase)
|
|
945
|
+
- 🌟 **ChernNumber**: c₁ = (1/2π) ∬ R_{μν} dS (topological invariant)
|
|
946
|
+
- 🌟 **SpectralDecomposition**: Eigenvalue decomposition, Shape DNA
|
|
947
|
+
- 🌟 **HeatKernel**: Tr(e^{-tK̂}) with asymptotic expansion
|
|
948
|
+
- 🌟 **FrequencyProjection**: Geometric frequency space and band projection
|
|
949
|
+
- 📐 **Mathematical Rigor**: Fiber bundle, Lie algebra, spectral geometry
|
|
950
|
+
- 🔬 **Complete Theory**: Based on unified quantum spectral geometry document
|
|
951
|
+
- 🗑️ **Cleanup**: Removed obsolete qframes.py file
|
|
952
|
+
|
|
953
|
+
### Version 6.0.0 (2025-12-03)
|
|
954
|
+
- 🔄 **MAJOR REFACTORING**: Unified module architecture
|
|
955
|
+
- ✨ **Merged differential_geometry**: Combined curvature.py functionality with dual-method support
|
|
956
|
+
- ✨ **Merged frames**: Integrated quantum frame modules into unified framework
|
|
957
|
+
- ✨ **Enhanced visualization**: Added SurfaceVisualizer with curvature coloring
|
|
958
|
+
- 🔀 **Runtime handedness control**: Switch between left/right-handed systems on the fly
|
|
959
|
+
- 📚 **Full English documentation**: Complete internationalization
|
|
960
|
+
- ⚡ **Improved API**: Cleaner imports and more intuitive method names
|
|
961
|
+
|
|
962
|
+
---
|
|
963
|
+
|
|
964
|
+
## License
|
|
965
|
+
|
|
966
|
+
MIT License - see [LICENSE](LICENSE) file for details
|
|
967
|
+
|
|
968
|
+
Copyright (c) 2024-2025 PanGuoJun
|
|
969
|
+
|
|
970
|
+
---
|
|
971
|
+
|
|
972
|
+
## Author
|
|
973
|
+
|
|
974
|
+
**PanGuoJun** (romeosoft)
|
|
975
|
+
|
|
976
|
+
- Email: 18858146@qq.com
|
|
977
|
+
- GitHub: [panguojun/Coordinate-System](https://github.com/panguojun/Coordinate-System)
|
|
978
|
+
|
|
979
|
+
---
|
|
980
|
+
|
|
981
|
+
## Links
|
|
982
|
+
|
|
983
|
+
- **PyPI**: https://pypi.org/project/coordinate-system/
|
|
984
|
+
- **GitHub**: https://github.com/panguojun/Coordinate-System
|
|
985
|
+
- **Mathematical Foundation**: [MATHEMATICAL_FOUNDATION.md](https://github.com/panguojun/Coordinate-System/blob/main/MATHEMATICAL_FOUNDATION.md)
|
|
986
|
+
- **Issues**: https://github.com/panguojun/Coordinate-System/issues
|
|
987
|
+
|
|
988
|
+
---
|
|
989
|
+
|
|
990
|
+
## Acknowledgments
|
|
991
|
+
|
|
992
|
+
Built with ❤️ using:
|
|
993
|
+
- **C++17** - High-performance core
|
|
994
|
+
- **pybind11** - Python-C++ bindings
|
|
995
|
+
- **NumPy** - Numerical computations
|
|
996
|
+
- **Matplotlib** - Visualization
|
|
997
|
+
- **CuPy** - Optional GPU acceleration
|
|
998
|
+
|
|
999
|
+
---
|
|
1000
|
+
|
|
1001
|
+
**Note**: For the latest updates and documentation, visit the [GitHub repository](https://github.com/panguojun/Coordinate-System).
|