adnus 0.1.9__py3-none-any.whl

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.
adnus/__init__.py ADDED
@@ -0,0 +1,317 @@
1
+ """
2
+ adnus (AdNuS): Advanced Number Systems
3
+ ======================================
4
+
5
+ A comprehensive Python library for advanced number systems including:
6
+ - Hypercomplex numbers (via Cayley-Dickson construction)
7
+ - Bicomplex numbers
8
+ - Neutrosophic numbers
9
+ - And other advanced algebraic structures
10
+
11
+ Key Features:
12
+ -------------
13
+ 1. Unified interface for all number systems
14
+ 2. Complete Cayley-Dickson construction implementation
15
+ 3. Mathematical operations with proper algebraic properties
16
+ 4. Parsing utilities for various input formats
17
+ 5. Mathematical sequences and functions
18
+ 6. Compatibility with kececinumbers (if available)
19
+
20
+ Example Usage:
21
+ --------------
22
+ >>> from adnus import Complex, Quaternion, Octonion
23
+ >>> c = Complex(3, 4)
24
+ >>> q = Quaternion(1, 2, 3, 4)
25
+ >>> o = Octonion(1, 2, 3, 4, 5, 6, 7, 8)
26
+ >>> print(c.norm()) # 5.0
27
+ >>> print(q * q) # Quaternion multiplication
28
+
29
+ Version: 0.1.9
30
+ Author: Mehmet Keçeci
31
+ License: AGPL-3.0-or-later
32
+ """
33
+
34
+ # Core version information
35
+ __version__ = "0.1.9"
36
+ __author__ = "Mehmet Keçeci"
37
+ __license__ = "AGPL-3.0-or-later"
38
+ __copyright__ = "Copyright (C) 2025-2026 Mehmet Keçeci"
39
+
40
+ # Export control
41
+ __all__ = [
42
+ # Core classes and functions
43
+ 'AdvancedNumber',
44
+ 'ComplexNumber',
45
+ 'BicomplexNumber',
46
+ 'NeutrosophicNumber',
47
+ 'HypercomplexNumber',
48
+
49
+ # Cayley-Dickson construction
50
+ 'cayley_dickson_process',
51
+ 'cayley_dickson_cebr',
52
+
53
+ # Predefined algebras
54
+ 'Real',
55
+ 'Complex',
56
+ 'Quaternion',
57
+ 'Octonion',
58
+ 'Sedenion',
59
+ 'Pathion',
60
+ 'Chingon',
61
+ 'Routon',
62
+ 'Voudon',
63
+
64
+ # Factory functions
65
+ 'Real',
66
+ 'Complex',
67
+ 'Quaternion',
68
+ 'Octonion',
69
+ 'Sedenion',
70
+ 'Pathion',
71
+ 'Chingon',
72
+ 'Routon',
73
+ 'Voudon',
74
+
75
+ # Parsing functions
76
+ '_parse_complex',
77
+ '_parse_universal',
78
+
79
+ # Mathematical sequences and utilities
80
+ 'oresme_sequence',
81
+ 'harmonic_numbers',
82
+ 'binet_formula',
83
+ 'generate_cd_chain',
84
+
85
+ # Utility functions
86
+ 'cd_number_from_components',
87
+
88
+ # Constants and flags
89
+ 'HAS_KECECI',
90
+ ]
91
+
92
+ # Import core modules
93
+ from .main import (
94
+ AdvancedNumber,
95
+ ComplexNumber,
96
+ BicomplexNumber,
97
+ NeutrosophicNumber,
98
+ HypercomplexNumber,
99
+
100
+ # Import Cayley-Dickson implementation
101
+ cayley_dickson_process,
102
+ cayley_dickson_cebr,
103
+ Real,
104
+ Complex,
105
+ Quaternion,
106
+ Octonion,
107
+ Sedenion,
108
+ Pathion,
109
+ Chingon,
110
+ Routon,
111
+ Voudon,
112
+ generate_cd_chain,
113
+ cd_number_from_components,
114
+
115
+ # Import parsing utilities
116
+ _parse_complex,
117
+ _parse_universal,
118
+
119
+ # Import mathematical utilities
120
+ oresme_sequence,
121
+ harmonic_numbers,
122
+ binet_formula,
123
+
124
+ # Import compatibility information
125
+ HAS_KECECI
126
+ )
127
+ # =============================================
128
+ # Convenience re-exports (for backward compatibility)
129
+ # =============================================
130
+
131
+ # These provide the same interface as factory functions
132
+ Real = Real
133
+ Complex = Complex
134
+ Quaternion = Quaternion
135
+ Octonion = Octonion
136
+ Sedenion = Sedenion
137
+ Pathion = Pathion
138
+ Chingon = Chingon
139
+ Routon = Routon
140
+ Voudon = Voudon
141
+
142
+ # =============================================
143
+ # Package initialization
144
+ # =============================================
145
+
146
+ def __getattr__(name):
147
+ """Lazy loading for optional components."""
148
+ if name == 'HAS_KECECI':
149
+ from .compat import HAS_KECECI
150
+ return HAS_KECECI
151
+ raise AttributeError(f"module 'adnus' has no attribute '{name}'")
152
+
153
+
154
+ def setup_package():
155
+ """Optional setup function for package configuration."""
156
+ import warnings
157
+
158
+ # Set numpy print options if available
159
+ try:
160
+ import numpy as np
161
+ np.set_printoptions(precision=4, suppress=True)
162
+ except ImportError:
163
+ pass
164
+
165
+ # Configure warnings
166
+ warnings.filterwarnings('ignore', category=RuntimeWarning, module='adnus')
167
+
168
+ print(f"adnus v{__version__} - Advanced Number Systems initialized")
169
+ print(f"kececinumbers available: {HAS_KECECI}")
170
+
171
+
172
+ # Optional: auto-setup on import
173
+ _AUTO_SETUP = False # Set to True for automatic setup
174
+
175
+ if _AUTO_SETUP:
176
+ setup_package()
177
+
178
+
179
+ # =============================================
180
+ # Documentation helpers
181
+ # =============================================
182
+
183
+ def show_available_types():
184
+ """Display all available number types in the package."""
185
+ types_info = {
186
+ "ComplexNumber": "Standard complex numbers (fallback implementation)",
187
+ "BicomplexNumber": "Bicomplex numbers z = z1 + z2·j",
188
+ "NeutrosophicNumber": "Neutrosophic numbers a + bI (I² = I)",
189
+ "HypercomplexNumber": "Unified wrapper for all hypercomplex numbers",
190
+ "Real": "Real numbers (1D, via Cayley-Dickson level 0)",
191
+ "Complex": "Complex numbers (2D, via Cayley-Dickson level 1)",
192
+ "Quaternion": "Quaternions (4D, via Cayley-Dickson level 2)",
193
+ "Octonion": "Octonions (8D, via Cayley-Dickson level 3)",
194
+ "Sedenion": "Sedenions (16D, via Cayley-Dickson level 4)",
195
+ "Pathion": "Pathions (32D, via Cayley-Dickson level 5)",
196
+ "Chingon": "Chingons (64D, via Cayley-Dickson level 6)",
197
+ "Routon": "Routons (128D, via Cayley-Dickson level 7)",
198
+ "Voudon": "Voudons (256D, via Cayley-Dickson level 8)",
199
+ }
200
+
201
+ print("Available Number Types in adnus:")
202
+ print("=" * 70)
203
+ for name, desc in types_info.items():
204
+ print(f"{name:20} : {desc}")
205
+ print()
206
+
207
+
208
+ def get_version_info():
209
+ """Get detailed version information."""
210
+ import sys
211
+ import platform
212
+
213
+ info = {
214
+ "adnus_version": __version__,
215
+ "python_version": sys.version,
216
+ "platform": platform.platform(),
217
+ "kececinumbers_available": HAS_KECECI,
218
+ }
219
+
220
+ return info
221
+
222
+
223
+ # =============================================
224
+ # Quick test/example function
225
+ # =============================================
226
+
227
+ def quick_test():
228
+ """Run a quick test to verify package functionality."""
229
+ print("Running adnus quick test...")
230
+ print("-" * 40)
231
+
232
+ try:
233
+ # Test ComplexNumber
234
+ c1 = ComplexNumber(3, 4)
235
+ c2 = ComplexNumber(1, 2)
236
+ print(f"✓ ComplexNumber: {c1} + {c2} = {c1 + c2}")
237
+ print(f" Norm({c1}) = {c1.norm():.2f}")
238
+
239
+ # Test BicomplexNumber
240
+ bc = BicomplexNumber(ComplexNumber(1, 2), ComplexNumber(3, 4))
241
+ print(f"✓ BicomplexNumber: {bc}")
242
+ print(f" Norm = {bc.norm():.2f}")
243
+
244
+ # Test NeutrosophicNumber
245
+ nn = NeutrosophicNumber(2, 3)
246
+ print(f"✓ NeutrosophicNumber: {nn}")
247
+ print(f" Conjugate = {nn.conjugate()}")
248
+
249
+ # Test Hypercomplex
250
+ q = Quaternion(1, 2, 3, 4)
251
+ print(f"✓ Quaternion: {q}")
252
+ print(f" Norm = {q.norm():.2f}")
253
+
254
+ # Test parsing
255
+ parsed = _parse_universal("1,2,3,4", "quaternion")
256
+ print(f"✓ Parsing: '1,2,3,4' -> {parsed}")
257
+
258
+ print("\n✅ All tests passed!")
259
+ return True
260
+
261
+ except Exception as e:
262
+ print(f"\n❌ Test failed: {e}")
263
+ return False
264
+
265
+
266
+ # =============================================
267
+ # Module documentation
268
+ # =============================================
269
+
270
+ __doc__ = """
271
+ adnus (Advanced Number Systems)
272
+ ===============================
273
+
274
+ A comprehensive library for working with advanced number systems.
275
+
276
+ Modules:
277
+ --------
278
+ 1. core - Core number classes (ComplexNumber, BicomplexNumber, etc.)
279
+ 2. cayley_dickson - Cayley-Dickson construction implementation
280
+ 3. parsing - Parsing utilities for various number formats
281
+ 4. math_utils - Mathematical sequences and functions
282
+ 5. compat - Compatibility layer with kececinumbers
283
+
284
+ Quick Start:
285
+ -----------
286
+ >>> import adnus
287
+ >>> from adnus import Complex, Quaternion
288
+ >>> c = Complex(3, 4)
289
+ >>> q = Quaternion(1, 2, 3, 4)
290
+ >>> print(c.norm()) # 5.0
291
+ >>> print(q * 2) # Scalar multiplication
292
+
293
+ For more examples, see the examples/ directory or run:
294
+ >>> adnus.quick_test()
295
+ """
296
+
297
+
298
+ # =============================================
299
+ # Final initialization
300
+ # =============================================
301
+
302
+ # Generate package-level logger
303
+ import logging
304
+
305
+ class NullHandler(logging.Handler):
306
+ """Null handler to avoid 'No handlers found' warnings."""
307
+ def emit(self, record):
308
+ pass
309
+
310
+ # Set up logger
311
+ logger = logging.getLogger(__name__)
312
+ logger.addHandler(NullHandler())
313
+
314
+ # Clean up namespace
315
+ del NullHandler
316
+
317
+ print(f"adnus {__version__} - Advanced Number Systems Library")
adnus/_version.py ADDED
@@ -0,0 +1,9 @@
1
+ # _version.py
2
+
3
+ __version__ = "0.1.9"
4
+ __license__ = "AGPL-3.0-or-later"
5
+ __description__ = "adnus (AdNuS): Advanced Number Systems."
6
+ __author__ = "Mehmet Keçeci"
7
+ __url__ = "https://github.com/WhiteSymmetry/adnus"
8
+ __docs__ = "https://WhiteSymmetry.github.io/adnus" # Opsiyonel: Dokümantasyon linki
9
+ __dependencies__ = ["python>=3.11"] # Diğer bağımlılıkları da ekleyebilirsiniz