adnus 0.1.3__py3-none-any.whl → 0.1.5__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.
Potentially problematic release.
This version of adnus might be problematic. Click here for more details.
- {adnus-0.1.3.dist-info → adnus-0.1.5.dist-info}/METADATA +22 -13
- adnus-0.1.5.dist-info/RECORD +5 -0
- {adnus-0.1.3.dist-info → adnus-0.1.5.dist-info}/WHEEL +2 -1
- adnus-0.1.5.dist-info/top_level.txt +1 -0
- adnus/__init__.py +0 -59
- adnus/_version.py +0 -9
- adnus/main.py +0 -516
- adnus-0.1.3.dist-info/RECORD +0 -7
- {adnus-0.1.3.dist-info → adnus-0.1.5.dist-info/licenses}/LICENSE +0 -0
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: adnus
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: A Python library for Advanced Number Systems (AdNuS), including Bicomplex, Neutrosophic, Hyperreal numbers, reals, Complex, Quaternion, Octonion, Sedenion, Pathion, Chingon, Routon, Voudon.
|
|
5
|
-
|
|
5
|
+
Home-page: https://github.com/WhiteSymmetry/adnus
|
|
6
6
|
Author: Mehmet Keçeci
|
|
7
|
-
Author-email: mkececi@yaani.com
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
-
Requires-Dist: hypercomplex (==0.3.4)
|
|
15
|
-
Requires-Dist: numpy (>=2.3,<3.0)
|
|
7
|
+
Author-email: Mehmet Keçeci <mkececi@yaani.com>
|
|
8
|
+
Maintainer: Mehmet Keçeci
|
|
9
|
+
Maintainer-email: mkececi@yaani.com
|
|
10
|
+
License: MIT
|
|
11
|
+
Requires-Python: >=3.10
|
|
16
12
|
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: numpy<3.0.0,>=2.3.3
|
|
15
|
+
Requires-Dist: hypercomplex==0.3.4
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: pytest<9.0.0,>=8.4.2; extra == "dev"
|
|
18
|
+
Provides-Extra: build
|
|
19
|
+
Requires-Dist: setuptools<81.0.0,>=80.9.0; extra == "build"
|
|
20
|
+
Requires-Dist: cython<4.0.0,>=3.1.3; extra == "build"
|
|
21
|
+
Dynamic: author
|
|
22
|
+
Dynamic: home-page
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
Dynamic: maintainer
|
|
25
|
+
Dynamic: maintainer-email
|
|
26
|
+
Dynamic: requires-python
|
|
17
27
|
|
|
18
28
|
# adnus (AdNuS): Advanced Number Systems.
|
|
19
29
|
|
|
@@ -287,4 +297,3 @@ This project is licensed under the MIT License.
|
|
|
287
297
|
|
|
288
298
|
Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.
|
|
289
299
|
|
|
290
|
-
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
adnus-0.1.5.dist-info/licenses/LICENSE,sha256=NJZsJEbQuKzxn1mWPWCbRx8jRUqGS22thl8wwuRQJ9c,1071
|
|
2
|
+
adnus-0.1.5.dist-info/METADATA,sha256=dnbu1yY7Vsb9XCuyRui_kWXWrv3lGghJCtUPg379U50,9828
|
|
3
|
+
adnus-0.1.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
4
|
+
adnus-0.1.5.dist-info/top_level.txt,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
5
|
+
adnus-0.1.5.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
adnus/__init__.py
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# src/adnus/__init__.py
|
|
2
|
-
"""
|
|
3
|
-
adnus (AdNuS): Advanced Number Systems.
|
|
4
|
-
|
|
5
|
-
A Python library for exploring number systems beyond the standard real and complex numbers.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
# main.py dosyasındaki ana sınıfları ve fonksiyonları buraya import et
|
|
9
|
-
from .main import (
|
|
10
|
-
AdvancedNumber,
|
|
11
|
-
BicomplexNumber,
|
|
12
|
-
NeutrosophicNumber,
|
|
13
|
-
NeutrosophicComplexNumber,
|
|
14
|
-
NeutrosophicBicomplexNumber,
|
|
15
|
-
HyperrealNumber,
|
|
16
|
-
oresme_sequence,
|
|
17
|
-
harmonic_numbers,
|
|
18
|
-
binet_formula,
|
|
19
|
-
generate_cayley_dickson_number,
|
|
20
|
-
generate_cd_chain,
|
|
21
|
-
reals,
|
|
22
|
-
Complex,
|
|
23
|
-
Quaternion,
|
|
24
|
-
Octonion,
|
|
25
|
-
Sedenion,
|
|
26
|
-
Pathion,
|
|
27
|
-
Chingon,
|
|
28
|
-
Routon,
|
|
29
|
-
Voudon,
|
|
30
|
-
cayley_dickson_construction,
|
|
31
|
-
cayley_dickson_algebra
|
|
32
|
-
)
|
|
33
|
-
|
|
34
|
-
# __all__ listesi, "from adnus import *" komutu kullanıldığında nelerin import edileceğini tanımlar.
|
|
35
|
-
# Bu, kütüphanenizin genel arayüzünü (public API) belirlemek için iyi bir pratiktir.
|
|
36
|
-
__all__ = [
|
|
37
|
-
"AdvancedNumber",
|
|
38
|
-
"BicomplexNumber",
|
|
39
|
-
"NeutrosophicNumber",
|
|
40
|
-
"NeutrosophicComplexNumber",
|
|
41
|
-
"NeutrosophicBicomplexNumber",
|
|
42
|
-
"HyperrealNumber",
|
|
43
|
-
"oresme_sequence",
|
|
44
|
-
"harmonic_numbers",
|
|
45
|
-
"binet_formula",
|
|
46
|
-
"generate_cayley_dickson_number",
|
|
47
|
-
"generate_cd_chain",
|
|
48
|
-
"reals",
|
|
49
|
-
"Complex",
|
|
50
|
-
"Quaternion",
|
|
51
|
-
"Octonion",
|
|
52
|
-
"Sedenion",
|
|
53
|
-
"Pathion",
|
|
54
|
-
"Chingon",
|
|
55
|
-
"Routon",
|
|
56
|
-
"Voudon",
|
|
57
|
-
"cayley_dickson_construction",
|
|
58
|
-
"cayley_dickson_algebra"
|
|
59
|
-
]
|
adnus/_version.py
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
# _version.py
|
|
2
|
-
|
|
3
|
-
__version__ = "0.1.3"
|
|
4
|
-
__license__ = "MIT"
|
|
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.9"] # Diğer bağımlılıkları da ekleyebilirsiniz
|
adnus/main.py
DELETED
|
@@ -1,516 +0,0 @@
|
|
|
1
|
-
# src/adnus/main.py
|
|
2
|
-
"""
|
|
3
|
-
adnus (AdNuS): A Python library for Advanced Number Systems.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from __future__ import annotations
|
|
7
|
-
from abc import ABC, abstractmethod
|
|
8
|
-
from dataclasses import dataclass
|
|
9
|
-
from fractions import Fraction
|
|
10
|
-
import math
|
|
11
|
-
from typing import List, Union, Generator, Tuple, Any
|
|
12
|
-
from hypercomplex import reals, Complex, Quaternion, Octonion, Sedenion, Pathion, Chingon, Routon, Voudon, cayley_dickson_construction, cayley_dickson_algebra
|
|
13
|
-
|
|
14
|
-
class AdvancedNumber(ABC):
|
|
15
|
-
"""Abstract Base Class for advanced number systems."""
|
|
16
|
-
|
|
17
|
-
@abstractmethod
|
|
18
|
-
def __add__(self, other):
|
|
19
|
-
pass
|
|
20
|
-
|
|
21
|
-
@abstractmethod
|
|
22
|
-
def __sub__(self, other):
|
|
23
|
-
pass
|
|
24
|
-
|
|
25
|
-
@abstractmethod
|
|
26
|
-
def __mul__(self, other):
|
|
27
|
-
pass
|
|
28
|
-
|
|
29
|
-
@abstractmethod
|
|
30
|
-
def __truediv__(self, other):
|
|
31
|
-
pass
|
|
32
|
-
|
|
33
|
-
@abstractmethod
|
|
34
|
-
def __eq__(self, other) -> bool:
|
|
35
|
-
pass
|
|
36
|
-
|
|
37
|
-
@abstractmethod
|
|
38
|
-
def __repr__(self) -> str:
|
|
39
|
-
pass
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
@dataclass(frozen=True)
|
|
43
|
-
class BicomplexNumber(AdvancedNumber):
|
|
44
|
-
"""
|
|
45
|
-
Represents a bicomplex number z = z1 + z2j, where z1 and z2 are complex
|
|
46
|
-
numbers and j^2 = -1, but j is an independent imaginary unit from i.
|
|
47
|
-
"""
|
|
48
|
-
z1: Complex
|
|
49
|
-
z2: Complex
|
|
50
|
-
|
|
51
|
-
def __init__(self, z1: Union[Complex, complex, float, int],
|
|
52
|
-
z2: Union[Complex, complex, float, int]):
|
|
53
|
-
# Convert inputs to Complex type if needed
|
|
54
|
-
if not isinstance(z1, Complex):
|
|
55
|
-
z1 = Complex(z1)
|
|
56
|
-
if not isinstance(z2, Complex):
|
|
57
|
-
z2 = Complex(z2)
|
|
58
|
-
object.__setattr__(self, 'z1', z1)
|
|
59
|
-
object.__setattr__(self, 'z2', z2)
|
|
60
|
-
|
|
61
|
-
def __add__(self, other: BicomplexNumber) -> BicomplexNumber:
|
|
62
|
-
if not isinstance(other, BicomplexNumber):
|
|
63
|
-
return NotImplemented
|
|
64
|
-
return BicomplexNumber(self.z1 + other.z1, self.z2 + other.z2)
|
|
65
|
-
|
|
66
|
-
def __sub__(self, other: BicomplexNumber) -> BicomplexNumber:
|
|
67
|
-
if not isinstance(other, BicomplexNumber):
|
|
68
|
-
return NotImplemented
|
|
69
|
-
return BicomplexNumber(self.z1 - other.z1, self.z2 - other.z2)
|
|
70
|
-
|
|
71
|
-
def __mul__(self, other: Union[BicomplexNumber, float, int, complex, Complex]) -> BicomplexNumber:
|
|
72
|
-
if isinstance(other, (float, int, complex, Complex)):
|
|
73
|
-
return BicomplexNumber(self.z1 * other, self.z2 * other)
|
|
74
|
-
if not isinstance(other, BicomplexNumber):
|
|
75
|
-
return NotImplemented
|
|
76
|
-
# (z1 + z2j)(w1 + w2j) = (z1w1 - z2w2) + (z1w2 + z2w1)j
|
|
77
|
-
return BicomplexNumber(
|
|
78
|
-
self.z1 * other.z1 - self.z2 * other.z2,
|
|
79
|
-
self.z1 * other.z2 + self.z2 * other.z1
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
def __truediv__(self, other: BicomplexNumber) -> BicomplexNumber:
|
|
83
|
-
# Division using the conjugate approach
|
|
84
|
-
if isinstance(other, (float, int, complex, Complex)):
|
|
85
|
-
return BicomplexNumber(self.z1 / other, self.z2 / other)
|
|
86
|
-
|
|
87
|
-
if not isinstance(other, BicomplexNumber):
|
|
88
|
-
return NotImplemented
|
|
89
|
-
|
|
90
|
-
# Compute the conjugate of the denominator
|
|
91
|
-
conjugate = BicomplexNumber(other.z1, -other.z2)
|
|
92
|
-
|
|
93
|
-
# Multiply numerator and denominator by conjugate
|
|
94
|
-
numerator = self * conjugate
|
|
95
|
-
denominator = other * conjugate
|
|
96
|
-
|
|
97
|
-
# Denominator should be a real number (only z1 component)
|
|
98
|
-
if abs(denominator.z2.real) > 1e-10 or abs(denominator.z2.imag) > 1e-10:
|
|
99
|
-
raise ValueError("Division resulted in non-real denominator")
|
|
100
|
-
|
|
101
|
-
return BicomplexNumber(numerator.z1 / denominator.z1.real,
|
|
102
|
-
numerator.z2 / denominator.z1.real)
|
|
103
|
-
|
|
104
|
-
def __eq__(self, other) -> bool:
|
|
105
|
-
if not isinstance(other, BicomplexNumber):
|
|
106
|
-
return NotImplemented
|
|
107
|
-
return self.z1 == other.z1 and self.z2 == other.z2
|
|
108
|
-
|
|
109
|
-
def __repr__(self) -> str:
|
|
110
|
-
return f"({self.z1}) + ({self.z2})j"
|
|
111
|
-
|
|
112
|
-
def norm(self) -> float:
|
|
113
|
-
"""Returns the Euclidean norm of the bicomplex number."""
|
|
114
|
-
return math.sqrt(abs(self.z1)**2 + abs(self.z2)**2)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
@dataclass(frozen=True)
|
|
118
|
-
class NeutrosophicNumber(AdvancedNumber):
|
|
119
|
-
"""
|
|
120
|
-
Represents a neutrosophic number z = a + bI, where 'a' is the determinate part,
|
|
121
|
-
'b' is the indeterminate part, and I is the indeterminacy, satisfying I^2 = I.
|
|
122
|
-
"""
|
|
123
|
-
a: Union[float, int, Fraction]
|
|
124
|
-
b: Union[float, int, Fraction]
|
|
125
|
-
|
|
126
|
-
def __add__(self, other: NeutrosophicNumber) -> NeutrosophicNumber:
|
|
127
|
-
if not isinstance(other, NeutrosophicNumber):
|
|
128
|
-
return NotImplemented
|
|
129
|
-
return NeutrosophicNumber(self.a + other.a, self.b + other.b)
|
|
130
|
-
|
|
131
|
-
def __sub__(self, other: NeutrosophicNumber) -> NeutrosophicNumber:
|
|
132
|
-
if not isinstance(other, NeutrosophicNumber):
|
|
133
|
-
return NotImplemented
|
|
134
|
-
return NeutrosophicNumber(self.a - other.a, self.b - other.b)
|
|
135
|
-
|
|
136
|
-
def __mul__(self, other: NeutrosophicNumber) -> NeutrosophicNumber:
|
|
137
|
-
if not isinstance(other, NeutrosophicNumber):
|
|
138
|
-
return NotImplemented
|
|
139
|
-
# (a + bI)(c + dI) = ac + (ad + bc + bd)I
|
|
140
|
-
return NeutrosophicNumber(
|
|
141
|
-
self.a * other.a,
|
|
142
|
-
self.a * other.b + self.b * other.a + self.b * other.b
|
|
143
|
-
)
|
|
144
|
-
|
|
145
|
-
def __truediv__(self, other: NeutrosophicNumber) -> NeutrosophicNumber:
|
|
146
|
-
# Division using the conjugate approach
|
|
147
|
-
if not isinstance(other, NeutrosophicNumber):
|
|
148
|
-
return NotImplemented
|
|
149
|
-
|
|
150
|
-
# Compute conjugate (a - bI)
|
|
151
|
-
conjugate = NeutrosophicNumber(other.a, -other.b)
|
|
152
|
-
|
|
153
|
-
# Multiply numerator and denominator by conjugate
|
|
154
|
-
numerator = self * conjugate
|
|
155
|
-
denominator = other * conjugate
|
|
156
|
-
|
|
157
|
-
# Denominator should be a real number (only a component)
|
|
158
|
-
if abs(denominator.b) > 1e-10:
|
|
159
|
-
raise ValueError("Division resulted in non-real denominator")
|
|
160
|
-
|
|
161
|
-
return NeutrosophicNumber(numerator.a / denominator.a,
|
|
162
|
-
numerator.b / denominator.a)
|
|
163
|
-
|
|
164
|
-
def __eq__(self, other) -> bool:
|
|
165
|
-
if not isinstance(other, NeutrosophicNumber):
|
|
166
|
-
return NotImplemented
|
|
167
|
-
return self.a == other.a and self.b == other.b
|
|
168
|
-
|
|
169
|
-
def __repr__(self) -> str:
|
|
170
|
-
return f"{self.a} + {self.b}I"
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
@dataclass(frozen=True)
|
|
174
|
-
class NeutrosophicComplexNumber(AdvancedNumber):
|
|
175
|
-
"""
|
|
176
|
-
Represents a neutrosophic complex number z = (a + bi) + (c + di)I.
|
|
177
|
-
This can be seen as a neutrosophic number whose determinate and indeterminate
|
|
178
|
-
parts are complex numbers.
|
|
179
|
-
"""
|
|
180
|
-
determinate: Complex
|
|
181
|
-
indeterminate: Complex
|
|
182
|
-
|
|
183
|
-
def __init__(self, determinate: Union[Complex, complex, float, int],
|
|
184
|
-
indeterminate: Union[Complex, complex, float, int]):
|
|
185
|
-
# Convert inputs to Complex type if needed
|
|
186
|
-
if not isinstance(determinate, Complex):
|
|
187
|
-
determinate = Complex(determinate)
|
|
188
|
-
if not isinstance(indeterminate, Complex):
|
|
189
|
-
indeterminate = Complex(indeterminate)
|
|
190
|
-
object.__setattr__(self, 'determinate', determinate)
|
|
191
|
-
object.__setattr__(self, 'indeterminate', indeterminate)
|
|
192
|
-
|
|
193
|
-
def __add__(self, other: NeutrosophicComplexNumber) -> NeutrosophicComplexNumber:
|
|
194
|
-
if not isinstance(other, NeutrosophicComplexNumber):
|
|
195
|
-
return NotImplemented
|
|
196
|
-
return NeutrosophicComplexNumber(
|
|
197
|
-
self.determinate + other.determinate,
|
|
198
|
-
self.indeterminate + other.indeterminate
|
|
199
|
-
)
|
|
200
|
-
|
|
201
|
-
def __sub__(self, other: NeutrosophicComplexNumber) -> NeutrosophicComplexNumber:
|
|
202
|
-
if not isinstance(other, NeutrosophicComplexNumber):
|
|
203
|
-
return NotImplemented
|
|
204
|
-
return NeutrosophicComplexNumber(
|
|
205
|
-
self.determinate - other.determinate,
|
|
206
|
-
self.indeterminate - other.indeterminate
|
|
207
|
-
)
|
|
208
|
-
|
|
209
|
-
def __mul__(self, other: NeutrosophicComplexNumber) -> NeutrosophicComplexNumber:
|
|
210
|
-
if not isinstance(other, NeutrosophicComplexNumber):
|
|
211
|
-
return NotImplemented
|
|
212
|
-
# (A + BI)(C + DI) = AC + (AD + BC + BD)I, where A, B, C, D are complex.
|
|
213
|
-
determinate_part = self.determinate * other.determinate
|
|
214
|
-
indeterminate_part = (self.determinate * other.indeterminate +
|
|
215
|
-
self.indeterminate * other.determinate +
|
|
216
|
-
self.indeterminate * other.indeterminate)
|
|
217
|
-
return NeutrosophicComplexNumber(determinate_part, indeterminate_part)
|
|
218
|
-
|
|
219
|
-
def __truediv__(self, other: NeutrosophicComplexNumber) -> NeutrosophicComplexNumber:
|
|
220
|
-
# Division using the conjugate approach
|
|
221
|
-
if not isinstance(other, NeutrosophicComplexNumber):
|
|
222
|
-
return NotImplemented
|
|
223
|
-
|
|
224
|
-
# Compute conjugate (C - DI)
|
|
225
|
-
conjugate = NeutrosophicComplexNumber(other.determinate, -other.indeterminate)
|
|
226
|
-
|
|
227
|
-
# Multiply numerator and denominator by conjugate
|
|
228
|
-
numerator = self * conjugate
|
|
229
|
-
denominator = other * conjugate
|
|
230
|
-
|
|
231
|
-
# Denominator should be a complex number (only determinate part)
|
|
232
|
-
if abs(denominator.indeterminate.real) > 1e-10 or abs(denominator.indeterminate.imag) > 1e-10:
|
|
233
|
-
raise ValueError("Division resulted in non-complex denominator")
|
|
234
|
-
|
|
235
|
-
return NeutrosophicComplexNumber(numerator.determinate / denominator.determinate,
|
|
236
|
-
numerator.indeterminate / denominator.determinate)
|
|
237
|
-
|
|
238
|
-
def __eq__(self, other) -> bool:
|
|
239
|
-
if not isinstance(other, NeutrosophicComplexNumber):
|
|
240
|
-
return NotImplemented
|
|
241
|
-
return self.determinate == other.determinate and self.indeterminate == other.indeterminate
|
|
242
|
-
|
|
243
|
-
def __repr__(self) -> str:
|
|
244
|
-
return f"({self.determinate}) + ({self.indeterminate})I"
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
@dataclass(frozen=True)
|
|
248
|
-
class NeutrosophicBicomplexNumber(AdvancedNumber):
|
|
249
|
-
"""
|
|
250
|
-
Represents a neutrosophic bicomplex number z = (z1 + z2j) + (w1 + w2j)I.
|
|
251
|
-
This can be seen as a neutrosophic number whose determinate and indeterminate
|
|
252
|
-
parts are bicomplex numbers.
|
|
253
|
-
"""
|
|
254
|
-
determinate: BicomplexNumber
|
|
255
|
-
indeterminate: BicomplexNumber
|
|
256
|
-
|
|
257
|
-
def __add__(self, other: NeutrosophicBicomplexNumber) -> NeutrosophicBicomplexNumber:
|
|
258
|
-
if not isinstance(other, NeutrosophicBicomplexNumber):
|
|
259
|
-
return NotImplemented
|
|
260
|
-
return NeutrosophicBicomplexNumber(
|
|
261
|
-
self.determinate + other.determinate,
|
|
262
|
-
self.indeterminate + other.indeterminate
|
|
263
|
-
)
|
|
264
|
-
|
|
265
|
-
def __sub__(self, other: NeutrosophicBicomplexNumber) -> NeutrosophicBicomplexNumber:
|
|
266
|
-
if not isinstance(other, NeutrosophicBicomplexNumber):
|
|
267
|
-
return NotImplemented
|
|
268
|
-
return NeutrosophicBicomplexNumber(
|
|
269
|
-
self.determinate - other.determinate,
|
|
270
|
-
self.indeterminate - other.indeterminate
|
|
271
|
-
)
|
|
272
|
-
|
|
273
|
-
def __mul__(self, other: NeutrosophicBicomplexNumber) -> NeutrosophicBicomplexNumber:
|
|
274
|
-
if not isinstance(other, NeutrosophicBicomplexNumber):
|
|
275
|
-
return NotImplemented
|
|
276
|
-
# (A + BI)(C + DI) = AC + (AD + BC + BD)I, where A, B, C, D are bicomplex.
|
|
277
|
-
determinate_part = self.determinate * other.determinate
|
|
278
|
-
indeterminate_part = (self.determinate * other.indeterminate +
|
|
279
|
-
self.indeterminate * other.determinate +
|
|
280
|
-
self.indeterminate * other.indeterminate)
|
|
281
|
-
return NeutrosophicBicomplexNumber(determinate_part, indeterminate_part)
|
|
282
|
-
|
|
283
|
-
def __truediv__(self, other: NeutrosophicBicomplexNumber) -> NeutrosophicBicomplexNumber:
|
|
284
|
-
# Division using the conjugate approach
|
|
285
|
-
if not isinstance(other, NeutrosophicBicomplexNumber):
|
|
286
|
-
return NotImplemented
|
|
287
|
-
|
|
288
|
-
# Compute conjugate (C - DI)
|
|
289
|
-
conjugate = NeutrosophicBicomplexNumber(other.determinate, -other.indeterminate)
|
|
290
|
-
|
|
291
|
-
# Multiply numerator and denominator by conjugate
|
|
292
|
-
numerator = self * conjugate
|
|
293
|
-
denominator = other * conjugate
|
|
294
|
-
|
|
295
|
-
# Denominator should be a bicomplex number (only determinate part)
|
|
296
|
-
if abs(denominator.indeterminate.z1.real) > 1e-10 or abs(denominator.indeterminate.z1.imag) > 1e-10 or \
|
|
297
|
-
abs(denominator.indeterminate.z2.real) > 1e-10 or abs(denominator.indeterminate.z2.imag) > 1e-10:
|
|
298
|
-
raise ValueError("Division resulted in non-bicomplex denominator")
|
|
299
|
-
|
|
300
|
-
return NeutrosophicBicomplexNumber(numerator.determinate / denominator.determinate,
|
|
301
|
-
numerator.indeterminate / denominator.determinate)
|
|
302
|
-
|
|
303
|
-
def __eq__(self, other) -> bool:
|
|
304
|
-
if not isinstance(other, NeutrosophicBicomplexNumber):
|
|
305
|
-
return NotImplemented
|
|
306
|
-
return self.determinate == other.determinate and self.indeterminate == other.indeterminate
|
|
307
|
-
|
|
308
|
-
def __repr__(self) -> str:
|
|
309
|
-
return f"({self.determinate}) + ({self.indeterminate})I"
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
@dataclass(frozen=True)
|
|
313
|
-
class HyperrealNumber(AdvancedNumber):
|
|
314
|
-
"""
|
|
315
|
-
Represents a hyperreal number as a sequence of real numbers.
|
|
316
|
-
Note: This is a conceptual implementation. A full implementation requires
|
|
317
|
-
a non-principal ultrafilter, which is non-constructive.
|
|
318
|
-
"""
|
|
319
|
-
sequence_func: callable
|
|
320
|
-
|
|
321
|
-
def __post_init__(self):
|
|
322
|
-
if not callable(self.sequence_func):
|
|
323
|
-
raise TypeError("sequence_func must be a callable function.")
|
|
324
|
-
|
|
325
|
-
def __add__(self, other: HyperrealNumber) -> HyperrealNumber:
|
|
326
|
-
if not isinstance(other, HyperrealNumber):
|
|
327
|
-
return NotImplemented
|
|
328
|
-
return HyperrealNumber(lambda n: self.sequence_func(n) + other.sequence_func(n))
|
|
329
|
-
|
|
330
|
-
def __sub__(self, other: HyperrealNumber) -> HyperrealNumber:
|
|
331
|
-
if not isinstance(other, HyperrealNumber):
|
|
332
|
-
return NotImplemented
|
|
333
|
-
return HyperrealNumber(lambda n: self.sequence_func(n) - other.sequence_func(n))
|
|
334
|
-
|
|
335
|
-
def __mul__(self, other: HyperrealNumber) -> HyperrealNumber:
|
|
336
|
-
if not isinstance(other, HyperrealNumber):
|
|
337
|
-
return NotImplemented
|
|
338
|
-
return HyperrealNumber(lambda n: self.sequence_func(n) * other.sequence_func(n))
|
|
339
|
-
|
|
340
|
-
def __truediv__(self, other: HyperrealNumber) -> HyperrealNumber:
|
|
341
|
-
# Avoid division by zero in the sequence
|
|
342
|
-
def div_func(n):
|
|
343
|
-
denominator = other.sequence_func(n)
|
|
344
|
-
if abs(denominator) < 1e-10:
|
|
345
|
-
# This case needs a more rigorous definition based on the ultrafilter.
|
|
346
|
-
# For simplicity, we return 0, but this is not generally correct.
|
|
347
|
-
return 0
|
|
348
|
-
return self.sequence_func(n) / denominator
|
|
349
|
-
return HyperrealNumber(div_func)
|
|
350
|
-
|
|
351
|
-
def __eq__(self, other) -> bool:
|
|
352
|
-
# Equality for hyperreals means the set of indices where sequences are equal
|
|
353
|
-
# belongs to the ultrafilter. This cannot be implemented directly.
|
|
354
|
-
raise NotImplementedError("Equality for hyperreal numbers cannot be determined constructively.")
|
|
355
|
-
|
|
356
|
-
def __repr__(self) -> str:
|
|
357
|
-
return f"Hyperreal(sequence: {self.sequence_func(1)}, {self.sequence_func(2)}, ...)"
|
|
358
|
-
|
|
359
|
-
# =============================================
|
|
360
|
-
# Cayley-Dickson Construction Wrapper
|
|
361
|
-
# =============================================
|
|
362
|
-
|
|
363
|
-
def generate_cayley_dickson_number(dimension: int, *components: float) -> Any:
|
|
364
|
-
"""
|
|
365
|
-
Generates a hypercomplex number using the Cayley-Dickson construction.
|
|
366
|
-
Args:
|
|
367
|
-
dimension: The dimension of the hypercomplex number (2^n)
|
|
368
|
-
*components: The components of the number
|
|
369
|
-
Returns:
|
|
370
|
-
A hypercomplex number of the specified dimension
|
|
371
|
-
"""
|
|
372
|
-
if dimension not in [1, 2, 4, 8, 16, 32, 64, 128, 256]:
|
|
373
|
-
raise ValueError("Dimension must be a power of 2 up to 256")
|
|
374
|
-
|
|
375
|
-
if len(components) != dimension:
|
|
376
|
-
raise ValueError(f"Expected {dimension} components, got {len(components)}")
|
|
377
|
-
|
|
378
|
-
# Map dimension to the appropriate hypercomplex class
|
|
379
|
-
dimension_map = {
|
|
380
|
-
1: reals,
|
|
381
|
-
2: Complex,
|
|
382
|
-
4: Quaternion,
|
|
383
|
-
8: Octonion,
|
|
384
|
-
16: Sedenion,
|
|
385
|
-
32: Pathion,
|
|
386
|
-
64: Chingon,
|
|
387
|
-
128: Routon,
|
|
388
|
-
256: Voudon
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
return dimension_map[dimension](*components)
|
|
392
|
-
|
|
393
|
-
# =============================================
|
|
394
|
-
# Cayley-Dickson Construction Helper
|
|
395
|
-
# =============================================
|
|
396
|
-
|
|
397
|
-
def generate_cd_chain(max_level: int = 8) -> List:
|
|
398
|
-
"""
|
|
399
|
-
Generates a chain of Cayley-Dickson algebras up to the specified level.
|
|
400
|
-
Args:
|
|
401
|
-
max_level: Maximum level of the Cayley-Dickson construction
|
|
402
|
-
Returns:
|
|
403
|
-
List of hypercomplex number types [CD0, CD1, CD2, ..., CD_max_level]
|
|
404
|
-
"""
|
|
405
|
-
CD = [reals()] # CD0 = Real numbers
|
|
406
|
-
|
|
407
|
-
for i in range(max_level):
|
|
408
|
-
CD.append(cayley_dickson_construction(CD[-1]))
|
|
409
|
-
|
|
410
|
-
return CD
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
# =============================================
|
|
414
|
-
# Helper Functions
|
|
415
|
-
# =============================================
|
|
416
|
-
|
|
417
|
-
def oresme_sequence(n_terms: int) -> List[float]:
|
|
418
|
-
"""Generates the first n terms of the Oresme sequence (n / 2^n)."""
|
|
419
|
-
if n_terms <= 0:
|
|
420
|
-
return []
|
|
421
|
-
return [n / (2 ** n) for n in range(1, n_terms + 1)]
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
def harmonic_numbers(n_terms: int) -> Generator[Fraction, None, None]:
|
|
425
|
-
"""
|
|
426
|
-
Generates the first n harmonic numbers (H_n = 1 + 1/2 + ... + 1/n)
|
|
427
|
-
as exact fractions.
|
|
428
|
-
"""
|
|
429
|
-
if n_terms <= 0:
|
|
430
|
-
return
|
|
431
|
-
current_sum = Fraction(0)
|
|
432
|
-
for i in range(1, n_terms + 1):
|
|
433
|
-
current_sum += Fraction(1, i)
|
|
434
|
-
yield current_sum
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
def binet_formula(n: int) -> float:
|
|
438
|
-
"""Calculates the nth Fibonacci number using Binet's formula."""
|
|
439
|
-
if n < 0:
|
|
440
|
-
raise ValueError("The Fibonacci sequence is not defined for negative integers.")
|
|
441
|
-
sqrt5 = math.sqrt(5)
|
|
442
|
-
phi = (1 + sqrt5) / 2
|
|
443
|
-
return (phi**n - (1 - phi)**n) / sqrt5
|
|
444
|
-
|
|
445
|
-
# =============================================
|
|
446
|
-
# Example Usage
|
|
447
|
-
# =============================================
|
|
448
|
-
|
|
449
|
-
if __name__ == "__main__":
|
|
450
|
-
# Generate Cayley-Dickson chain
|
|
451
|
-
CD = generate_cd_chain(8) # Up to 256 dimensions (CD0 to CD8)
|
|
452
|
-
|
|
453
|
-
# CD chain mapping:
|
|
454
|
-
# CD[0] = Real numbers (1 dimension)
|
|
455
|
-
# CD[1] = Complex numbers (2 dimensions)
|
|
456
|
-
# CD[2] = Quaternions (4 dimensions)
|
|
457
|
-
# CD[3] = Octonions (8 dimensions)
|
|
458
|
-
# CD[4] = Sedenions (16 dimensions)
|
|
459
|
-
# CD[5] = Pathions (32 dimensions)
|
|
460
|
-
# CD[6] = Chingons (64 dimensions)
|
|
461
|
-
# CD[7] = Routons (128 dimensions)
|
|
462
|
-
# CD[8] = Voudons (256 dimensions)
|
|
463
|
-
|
|
464
|
-
# Generate an octonion (8 dimensions)
|
|
465
|
-
octonion = CD[3](1, 0, 2, 0, 3) # Missing components auto-filled with zeros
|
|
466
|
-
print(f"Octonion: {octonion}") # -> (1 0 2 0 3 0 0 0)
|
|
467
|
-
|
|
468
|
-
# Generate other types
|
|
469
|
-
complex_num = CD[1](1, 2) # Complex number
|
|
470
|
-
quaternion = CD[2](1, 2, 3, 4) # Quaternion
|
|
471
|
-
sedenion = CD[4](*range(1, 17)) # Sedenion with values 1-16
|
|
472
|
-
|
|
473
|
-
print(f"Complex: {complex_num}")
|
|
474
|
-
print(f"Quaternion: {quaternion}")
|
|
475
|
-
print(f"Sedenion: {sedenion}")
|
|
476
|
-
|
|
477
|
-
# Or use the predefined types directly
|
|
478
|
-
octonion2 = Octonion(1, 0, 2, 0, 3)
|
|
479
|
-
print(f"Octonion (predefined): {octonion2}")
|
|
480
|
-
|
|
481
|
-
# Bicomplex number example
|
|
482
|
-
bc1 = BicomplexNumber(Complex(1, 2), Complex(3, 4))
|
|
483
|
-
bc2 = BicomplexNumber(Complex(5, 6), Complex(7, 8))
|
|
484
|
-
print(f"Bicomplex multiplication: {bc1} * {bc2} = {bc1 * bc2}")
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
# Example usage of hypercomplex numbers
|
|
488
|
-
c1 = Complex(1, 2)
|
|
489
|
-
c2 = Complex(3, 4)
|
|
490
|
-
print(f"Complex numbers: {c1} + {c2} = {c1 + c2}")
|
|
491
|
-
|
|
492
|
-
q1 = Quaternion(1, 2, 3, 4)
|
|
493
|
-
q2 = Quaternion(5, 6, 7, 8)
|
|
494
|
-
print(f"Quaternions: {q1} * {q2} = {q1 * q2}")
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
# Generate higher dimension numbers using cayley_dickson_algebra
|
|
498
|
-
octonion_type = cayley_dickson_algebra(3) # 2^3 = 8 dimensions
|
|
499
|
-
octonion = octonion_type(1, 2, 3, 4, 5, 6, 7, 8)
|
|
500
|
-
print(f"Octonion: {octonion}")
|
|
501
|
-
|
|
502
|
-
# Or use the predefined types
|
|
503
|
-
sedenion = Sedenion(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
|
|
504
|
-
print(f"Sedenion: {sedenion}") # 2^4 = 16 dimensions
|
|
505
|
-
|
|
506
|
-
pathion = Pathion(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32)
|
|
507
|
-
print(f"Pathion: {pathion}") # 2^5 = 32 dimensions
|
|
508
|
-
|
|
509
|
-
Real=reals()
|
|
510
|
-
print(Real(4)) # -> (4)
|
|
511
|
-
C = cayley_dickson_construction(Complex)
|
|
512
|
-
print(C(3-7j)) # -> (3 -7)
|
|
513
|
-
CD4 = cayley_dickson_construction(CD[1])
|
|
514
|
-
print(CD4(.1, -2.2, 3.3e3)) # -> (0.1 -2.2 3300 0)
|
|
515
|
-
CD[3] = cayley_dickson_construction(CD[2])
|
|
516
|
-
print(CD[3](1, 0, 2, 0, 3)) # -> (1 0 2 0 3 0 0 0)
|
adnus-0.1.3.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
adnus/__init__.py,sha256=kTimUAw-wKQMWgyjXx5u7aA6uQ6itzSO_0UfjKY6Yoc,1439
|
|
2
|
-
adnus/_version.py,sha256=X3DZeZaHtpiam_wYTSQOnpnGhX_2TGiwKHUXSraS7Ts,370
|
|
3
|
-
adnus/main.py,sha256=ZsVlykej3JoQyd4rcRwNcNIu6HPCplaN-0Fur2ZjtNk,20204
|
|
4
|
-
adnus-0.1.3.dist-info/LICENSE,sha256=NJZsJEbQuKzxn1mWPWCbRx8jRUqGS22thl8wwuRQJ9c,1071
|
|
5
|
-
adnus-0.1.3.dist-info/METADATA,sha256=ASHoF9XBjaTOMMiTEMKXPsHdyxaq09KvPTu6rxxeD9w,9600
|
|
6
|
-
adnus-0.1.3.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
7
|
-
adnus-0.1.3.dist-info/RECORD,,
|
|
File without changes
|