adnus 0.1.0__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.

Potentially problematic release.


This version of adnus might be problematic. Click here for more details.

adnus-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Mehmet Keçeci
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
adnus-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,249 @@
1
+ Metadata-Version: 2.3
2
+ Name: adnus
3
+ Version: 0.1.0
4
+ Summary: A Python library for Advanced Number Systems (AdNuS), including Bicomplex, Neutrosophic, and Hyperreal numbers.
5
+ License: MIT
6
+ Author: Mehmet Keçeci
7
+ Author-email: mkececi@yaani.com
8
+ Requires-Python: >=3.11,<4.0
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Requires-Dist: numpy (>=2.3.1,<3.0.0)
15
+ Description-Content-Type: text/markdown
16
+
17
+ # adnus (AdNuS): Advanced Number Systems.
18
+
19
+
20
+ ---
21
+
22
+ <p align="left">
23
+ <table>
24
+ <tr>
25
+ <td style="text-align: center;">PyPI</td>
26
+ <td style="text-align: center;">
27
+ <a href="https://pypi.org/project/adnus/">
28
+ <img src="https://badge.fury.io/py/adnus.svg" alt="PyPI version" height="18"/>
29
+ </a>
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <td style="text-align: center;">Conda</td>
34
+ <td style="text-align: center;">
35
+ <a href="https://anaconda.org/bilgi/adnus">
36
+ <img src="https://anaconda.org/bilgi/adnus/badges/version.svg" alt="conda-forge version" height="18"/>
37
+ </a>
38
+ </td>
39
+ </tr>
40
+ <tr>
41
+ <td style="text-align: center;">DOI</td>
42
+ <td style="text-align: center;">
43
+ <a href="https://doi.org/10.5281/zenodo.15874178">
44
+ <img src="https://zenodo.org/badge/DOI/-.svg" alt="DOI" height="18"/>
45
+ </a>
46
+ </td>
47
+ </tr>
48
+ <tr>
49
+ <td style="text-align: center;">License: MIT</td>
50
+ <td style="text-align: center;">
51
+ <a href="https://opensource.org/licenses/MIT">
52
+ <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License" height="18"/>
53
+ </a>
54
+ </td>
55
+ </tr>
56
+ </table>
57
+ </p>
58
+
59
+ ---
60
+
61
+
62
+ adnus (AdNuS): Advanced Number Systems.
63
+
64
+ ---
65
+ # AdNuS: Advanced Number Systems
66
+
67
+ `adnus` is a Python library that provides an implementation of various advanced number systems. This library is designed for mathematicians, researchers, and developers who need to work with number systems beyond the standard real and complex numbers.
68
+
69
+ ## Features
70
+
71
+ - **Harmonic and Oresme Sequences**: Functions to generate harmonic numbers and Oresme sequences.
72
+ - **Bicomplex Numbers**: A class for bicomplex numbers with full arithmetic support.
73
+ - **Neutrosophic Numbers**: Classes for neutrosophic numbers, including their complex and bicomplex extensions.
74
+ - **Hyperreal Numbers**: A conceptual implementation of hyperreal numbers.
75
+ - **Extensible Design**: Built with an abstract base class to easily extend and add new number systems.
76
+ - **Fully Typed**: The library is fully type-hinted for better code quality and maintainability.
77
+
78
+ ## Installation
79
+
80
+ To install the library, clone the repository and use Poetry:
81
+
82
+ ```bash
83
+ git clone https://github.com/WhiteSymmetry/adnus.git
84
+ cd adnus
85
+ poetry install
86
+ ```
87
+
88
+ ## Usage
89
+
90
+ Here's a quick overview of how to use the different number systems available in `adnus`.
91
+
92
+ ### Bicomplex Numbers
93
+
94
+ ```python
95
+ from adnus.main import BicomplexNumber
96
+
97
+ z1 = BicomplexNumber(1 + 2j, 3 + 4j)
98
+ z2 = BicomplexNumber(5 + 6j, 7 + 8j)
99
+
100
+ print(f"Addition: {z1 + z2}")
101
+ print(f"Multiplication: {z1 * z2}")
102
+ ```
103
+
104
+ ### Neutrosophic Numbers
105
+
106
+ ```python
107
+ from adnus.main import NeutrosophicNumber
108
+
109
+ n1 = NeutrosophicNumber(1.5, 2.5)
110
+ n2 = NeutrosophicNumber(3.0, 4.0)
111
+
112
+ print(f"Addition: {n1 + n2}")
113
+ print(f"Multiplication: {n1 * n2}")
114
+ ```
115
+
116
+ ## Running Tests
117
+
118
+ To ensure everything is working correctly, you can run the included tests using `pytest`:
119
+
120
+ ```bash
121
+ poetry run pytest
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Kurulum (Türkçe) / Installation (English)
127
+
128
+ ### Python ile Kurulum / Install with pip, conda, mamba
129
+ ```bash
130
+ pip install adnus -U
131
+ python -m pip install -U adnus
132
+ conda install bilgi::adnus -y
133
+ mamba install bilgi::adnus -y
134
+ ```
135
+
136
+ ```diff
137
+ - pip uninstall adnus -y
138
+ + pip install -U adnus
139
+ + python -m pip install -U adnus
140
+ ```
141
+
142
+ [PyPI](https://pypi.org/project/adnus/)
143
+
144
+ ### Test Kurulumu / Test Installation
145
+
146
+ ```bash
147
+ pip install -i https://test.pypi.org/simple/ adnus -U
148
+ ```
149
+
150
+ ### Github Master Kurulumu / GitHub Master Installation
151
+
152
+ **Terminal:**
153
+
154
+ ```bash
155
+ pip install git+https://github.com/WhiteSymmetry/adnus.git
156
+ ```
157
+
158
+ **Jupyter Lab, Notebook, Visual Studio Code:**
159
+
160
+ ```python
161
+ !pip install git+https://github.com/WhiteSymmetry/adnus.git
162
+ # or
163
+ %pip install git+https://github.com/WhiteSymmetry/adnus.git
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Kullanım (Türkçe) / Usage (English)
169
+
170
+ ```python
171
+
172
+ ```
173
+
174
+ ```python
175
+ import adnus
176
+ adnus.__version__
177
+ ```
178
+
179
+ ```python
180
+
181
+ ```
182
+
183
+ ```python
184
+
185
+ ```
186
+ ---
187
+
188
+ ### Development
189
+ ```bash
190
+ # Clone the repository
191
+ git clone https://github.com/WhiteSymmetry/adnus.git
192
+ cd adnus
193
+
194
+ # Install in development mode
195
+ python -m pip install -ve . # Install package in development mode
196
+
197
+ # Run tests
198
+ pytest
199
+
200
+ Notebook, Jupyterlab, Colab, Visual Studio Code
201
+ !python -m pip install git+https://github.com/WhiteSymmetry/adnus.git
202
+ ```
203
+ ---
204
+
205
+ ## Citation
206
+
207
+ If this library was useful to you in your research, please cite us. Following the [GitHub citation standards](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files), here is the recommended citation.
208
+
209
+ ### BibTeX
210
+
211
+
212
+ ### APA
213
+
214
+ ```
215
+
216
+ Keçeci, M. (2025). adnus [Data set]. ResearchGate. https://doi.org/
217
+
218
+ Keçeci, M. (2025). adnus [Data set]. figshare. https://doi.org/
219
+
220
+ Keçeci, M. (2025). adnus [Data set]. WorkflowHub. https://doi.org/
221
+
222
+ Keçeci, M. (2025). adnus. Open Science Articles (OSAs), Zenodo. https://doi.org/
223
+
224
+ ### Chicago
225
+
226
+ ```
227
+
228
+
229
+ Keçeci, Mehmet. adnus [Data set]. ResearchGate, 2025. https://doi.org/
230
+
231
+ Keçeci, Mehmet (2025). adnus [Data set]. figshare, 2025. https://doi.org/
232
+
233
+ Keçeci, Mehmet. adnus [Data set]. WorkflowHub, 2025. https://doi.org/
234
+
235
+ Keçeci, Mehmet. adnus. Open Science Articles (OSAs), Zenodo, 2025. https://doi.org/
236
+
237
+ ```
238
+
239
+
240
+ ### Lisans (Türkçe) / License (English)
241
+
242
+ ```
243
+ This project is licensed under the MIT License.
244
+ ```
245
+
246
+ ## Contributing
247
+
248
+ Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.
249
+
adnus-0.1.0/README.md ADDED
@@ -0,0 +1,232 @@
1
+ # adnus (AdNuS): Advanced Number Systems.
2
+
3
+
4
+ ---
5
+
6
+ <p align="left">
7
+ <table>
8
+ <tr>
9
+ <td style="text-align: center;">PyPI</td>
10
+ <td style="text-align: center;">
11
+ <a href="https://pypi.org/project/adnus/">
12
+ <img src="https://badge.fury.io/py/adnus.svg" alt="PyPI version" height="18"/>
13
+ </a>
14
+ </td>
15
+ </tr>
16
+ <tr>
17
+ <td style="text-align: center;">Conda</td>
18
+ <td style="text-align: center;">
19
+ <a href="https://anaconda.org/bilgi/adnus">
20
+ <img src="https://anaconda.org/bilgi/adnus/badges/version.svg" alt="conda-forge version" height="18"/>
21
+ </a>
22
+ </td>
23
+ </tr>
24
+ <tr>
25
+ <td style="text-align: center;">DOI</td>
26
+ <td style="text-align: center;">
27
+ <a href="https://doi.org/10.5281/zenodo.15874178">
28
+ <img src="https://zenodo.org/badge/DOI/-.svg" alt="DOI" height="18"/>
29
+ </a>
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <td style="text-align: center;">License: MIT</td>
34
+ <td style="text-align: center;">
35
+ <a href="https://opensource.org/licenses/MIT">
36
+ <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License" height="18"/>
37
+ </a>
38
+ </td>
39
+ </tr>
40
+ </table>
41
+ </p>
42
+
43
+ ---
44
+
45
+
46
+ adnus (AdNuS): Advanced Number Systems.
47
+
48
+ ---
49
+ # AdNuS: Advanced Number Systems
50
+
51
+ `adnus` is a Python library that provides an implementation of various advanced number systems. This library is designed for mathematicians, researchers, and developers who need to work with number systems beyond the standard real and complex numbers.
52
+
53
+ ## Features
54
+
55
+ - **Harmonic and Oresme Sequences**: Functions to generate harmonic numbers and Oresme sequences.
56
+ - **Bicomplex Numbers**: A class for bicomplex numbers with full arithmetic support.
57
+ - **Neutrosophic Numbers**: Classes for neutrosophic numbers, including their complex and bicomplex extensions.
58
+ - **Hyperreal Numbers**: A conceptual implementation of hyperreal numbers.
59
+ - **Extensible Design**: Built with an abstract base class to easily extend and add new number systems.
60
+ - **Fully Typed**: The library is fully type-hinted for better code quality and maintainability.
61
+
62
+ ## Installation
63
+
64
+ To install the library, clone the repository and use Poetry:
65
+
66
+ ```bash
67
+ git clone https://github.com/WhiteSymmetry/adnus.git
68
+ cd adnus
69
+ poetry install
70
+ ```
71
+
72
+ ## Usage
73
+
74
+ Here's a quick overview of how to use the different number systems available in `adnus`.
75
+
76
+ ### Bicomplex Numbers
77
+
78
+ ```python
79
+ from adnus.main import BicomplexNumber
80
+
81
+ z1 = BicomplexNumber(1 + 2j, 3 + 4j)
82
+ z2 = BicomplexNumber(5 + 6j, 7 + 8j)
83
+
84
+ print(f"Addition: {z1 + z2}")
85
+ print(f"Multiplication: {z1 * z2}")
86
+ ```
87
+
88
+ ### Neutrosophic Numbers
89
+
90
+ ```python
91
+ from adnus.main import NeutrosophicNumber
92
+
93
+ n1 = NeutrosophicNumber(1.5, 2.5)
94
+ n2 = NeutrosophicNumber(3.0, 4.0)
95
+
96
+ print(f"Addition: {n1 + n2}")
97
+ print(f"Multiplication: {n1 * n2}")
98
+ ```
99
+
100
+ ## Running Tests
101
+
102
+ To ensure everything is working correctly, you can run the included tests using `pytest`:
103
+
104
+ ```bash
105
+ poetry run pytest
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Kurulum (Türkçe) / Installation (English)
111
+
112
+ ### Python ile Kurulum / Install with pip, conda, mamba
113
+ ```bash
114
+ pip install adnus -U
115
+ python -m pip install -U adnus
116
+ conda install bilgi::adnus -y
117
+ mamba install bilgi::adnus -y
118
+ ```
119
+
120
+ ```diff
121
+ - pip uninstall adnus -y
122
+ + pip install -U adnus
123
+ + python -m pip install -U adnus
124
+ ```
125
+
126
+ [PyPI](https://pypi.org/project/adnus/)
127
+
128
+ ### Test Kurulumu / Test Installation
129
+
130
+ ```bash
131
+ pip install -i https://test.pypi.org/simple/ adnus -U
132
+ ```
133
+
134
+ ### Github Master Kurulumu / GitHub Master Installation
135
+
136
+ **Terminal:**
137
+
138
+ ```bash
139
+ pip install git+https://github.com/WhiteSymmetry/adnus.git
140
+ ```
141
+
142
+ **Jupyter Lab, Notebook, Visual Studio Code:**
143
+
144
+ ```python
145
+ !pip install git+https://github.com/WhiteSymmetry/adnus.git
146
+ # or
147
+ %pip install git+https://github.com/WhiteSymmetry/adnus.git
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Kullanım (Türkçe) / Usage (English)
153
+
154
+ ```python
155
+
156
+ ```
157
+
158
+ ```python
159
+ import adnus
160
+ adnus.__version__
161
+ ```
162
+
163
+ ```python
164
+
165
+ ```
166
+
167
+ ```python
168
+
169
+ ```
170
+ ---
171
+
172
+ ### Development
173
+ ```bash
174
+ # Clone the repository
175
+ git clone https://github.com/WhiteSymmetry/adnus.git
176
+ cd adnus
177
+
178
+ # Install in development mode
179
+ python -m pip install -ve . # Install package in development mode
180
+
181
+ # Run tests
182
+ pytest
183
+
184
+ Notebook, Jupyterlab, Colab, Visual Studio Code
185
+ !python -m pip install git+https://github.com/WhiteSymmetry/adnus.git
186
+ ```
187
+ ---
188
+
189
+ ## Citation
190
+
191
+ If this library was useful to you in your research, please cite us. Following the [GitHub citation standards](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-citation-files), here is the recommended citation.
192
+
193
+ ### BibTeX
194
+
195
+
196
+ ### APA
197
+
198
+ ```
199
+
200
+ Keçeci, M. (2025). adnus [Data set]. ResearchGate. https://doi.org/
201
+
202
+ Keçeci, M. (2025). adnus [Data set]. figshare. https://doi.org/
203
+
204
+ Keçeci, M. (2025). adnus [Data set]. WorkflowHub. https://doi.org/
205
+
206
+ Keçeci, M. (2025). adnus. Open Science Articles (OSAs), Zenodo. https://doi.org/
207
+
208
+ ### Chicago
209
+
210
+ ```
211
+
212
+
213
+ Keçeci, Mehmet. adnus [Data set]. ResearchGate, 2025. https://doi.org/
214
+
215
+ Keçeci, Mehmet (2025). adnus [Data set]. figshare, 2025. https://doi.org/
216
+
217
+ Keçeci, Mehmet. adnus [Data set]. WorkflowHub, 2025. https://doi.org/
218
+
219
+ Keçeci, Mehmet. adnus. Open Science Articles (OSAs), Zenodo, 2025. https://doi.org/
220
+
221
+ ```
222
+
223
+
224
+ ### Lisans (Türkçe) / License (English)
225
+
226
+ ```
227
+ This project is licensed under the MIT License.
228
+ ```
229
+
230
+ ## Contributing
231
+
232
+ Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.
@@ -0,0 +1,18 @@
1
+ [tool.poetry]
2
+ name = "adnus"
3
+ version = "0.1.0"
4
+ description = "A Python library for Advanced Number Systems (AdNuS), including Bicomplex, Neutrosophic, and Hyperreal numbers."
5
+ authors = ["Mehmet Keçeci <mkececi@yaani.com>"]
6
+ license = "MIT"
7
+ readme = "README.md"
8
+
9
+ [tool.poetry.dependencies]
10
+ python = "^3.11"
11
+ numpy = "^2.3.1"
12
+
13
+ [tool.poetry.dev-dependencies]
14
+ pytest = "^6.2"
15
+
16
+ [build-system]
17
+ requires = ["poetry-core>=1.0.0"]
18
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,33 @@
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
+ )
20
+
21
+ # __all__ listesi, "from adnus import *" komutu kullanıldığında nelerin import edileceğini tanımlar.
22
+ # Bu, kütüphanenizin genel arayüzünü (public API) belirlemek için iyi bir pratiktir.
23
+ __all__ = [
24
+ "AdvancedNumber",
25
+ "BicomplexNumber",
26
+ "NeutrosophicNumber",
27
+ "NeutrosophicComplexNumber",
28
+ "NeutrosophicBicomplexNumber",
29
+ "HyperrealNumber",
30
+ "oresme_sequence",
31
+ "harmonic_numbers",
32
+ "binet_formula"
33
+ ]
@@ -0,0 +1,9 @@
1
+ # _version.py
2
+
3
+ __version__ = "0.1.0"
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
@@ -0,0 +1,305 @@
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
12
+
13
+ class AdvancedNumber(ABC):
14
+ """Abstract Base Class for advanced number systems."""
15
+
16
+ @abstractmethod
17
+ def __add__(self, other):
18
+ pass
19
+
20
+ @abstractmethod
21
+ def __sub__(self, other):
22
+ pass
23
+
24
+ @abstractmethod
25
+ def __mul__(self, other):
26
+ pass
27
+
28
+ @abstractmethod
29
+ def __truediv__(self, other):
30
+ pass
31
+
32
+ @abstractmethod
33
+ def __eq__(self, other) -> bool:
34
+ pass
35
+
36
+ @abstractmethod
37
+ def __repr__(self) -> str:
38
+ pass
39
+
40
+
41
+ @dataclass(frozen=True)
42
+ class BicomplexNumber(AdvancedNumber):
43
+ """
44
+ Represents a bicomplex number z = z1 + z2j, where z1 and z2 are complex
45
+ numbers and j^2 = -1, but j is an independent imaginary unit from i.
46
+ """
47
+ z1: complex
48
+ z2: complex
49
+
50
+ def __add__(self, other: BicomplexNumber) -> BicomplexNumber:
51
+ if not isinstance(other, BicomplexNumber):
52
+ return NotImplemented
53
+ return BicomplexNumber(self.z1 + other.z1, self.z2 + other.z2)
54
+
55
+ def __sub__(self, other: BicomplexNumber) -> BicomplexNumber:
56
+ if not isinstance(other, BicomplexNumber):
57
+ return NotImplemented
58
+ return BicomplexNumber(self.z1 - other.z1, self.z2 - other.z2)
59
+
60
+ def __mul__(self, other: Union[BicomplexNumber, float, int, complex]) -> BicomplexNumber:
61
+ if isinstance(other, (float, int, complex)):
62
+ return BicomplexNumber(self.z1 * other, self.z2 * other)
63
+ if not isinstance(other, BicomplexNumber):
64
+ return NotImplemented
65
+ # (z1 + z2j)(w1 + w2j) = (z1w1 - z2w2) + (z1w2 + z2w1)j
66
+ return BicomplexNumber(
67
+ self.z1 * other.z1 - self.z2 * other.z2,
68
+ self.z1 * other.z2 + self.z2 * other.z1
69
+ )
70
+
71
+ def __truediv__(self, other: BicomplexNumber) -> BicomplexNumber:
72
+ # Division is more complex and requires the inverse.
73
+ # For simplicity, this is left as an exercise. A common method involves
74
+ # multiplying by the conjugate and dividing by the squared modulus.
75
+ raise NotImplementedError("Division for bicomplex numbers is not implemented.")
76
+
77
+ def __eq__(self, other) -> bool:
78
+ if not isinstance(other, BicomplexNumber):
79
+ return NotImplemented
80
+ return self.z1 == other.z1 and self.z2 == other.z2
81
+
82
+ def __repr__(self) -> str:
83
+ return f"({self.z1}) + ({self.z2})j"
84
+
85
+ def norm(self) -> float:
86
+ """Returns the Euclidean norm of the bicomplex number."""
87
+ return math.sqrt(abs(self.z1)**2 + abs(self.z2)**2)
88
+
89
+
90
+ @dataclass(frozen=True)
91
+ class NeutrosophicNumber(AdvancedNumber):
92
+ """
93
+ Represents a neutrosophic number z = a + bI, where 'a' is the determinate part,
94
+ 'b' is the indeterminate part, and I is the indeterminacy, satisfying I^2 = I.
95
+ """
96
+ a: float
97
+ b: float
98
+
99
+ def __add__(self, other: NeutrosophicNumber) -> NeutrosophicNumber:
100
+ if not isinstance(other, NeutrosophicNumber):
101
+ return NotImplemented
102
+ return NeutrosophicNumber(self.a + other.a, self.b + other.b)
103
+
104
+ def __sub__(self, other: NeutrosophicNumber) -> NeutrosophicNumber:
105
+ if not isinstance(other, NeutrosophicNumber):
106
+ return NotImplemented
107
+ return NeutrosophicNumber(self.a - other.a, self.b - other.b)
108
+
109
+ def __mul__(self, other: NeutrosophicNumber) -> NeutrosophicNumber:
110
+ if not isinstance(other, NeutrosophicNumber):
111
+ return NotImplemented
112
+ # (a + bI)(c + dI) = ac + (ad + bc + bd)I
113
+ return NeutrosophicNumber(
114
+ self.a * other.a,
115
+ self.a * other.b + self.b * other.a + self.b * other.b
116
+ )
117
+
118
+ def __truediv__(self, other: NeutrosophicNumber) -> NeutrosophicNumber:
119
+ # Division is not uniquely defined without further constraints.
120
+ raise NotImplementedError("Division for neutrosophic numbers is not implemented.")
121
+
122
+ def __eq__(self, other) -> bool:
123
+ if not isinstance(other, NeutrosophicNumber):
124
+ return NotImplemented
125
+ return self.a == other.a and self.b == other.b
126
+
127
+ def __repr__(self) -> str:
128
+ return f"{self.a} + {self.b}I"
129
+
130
+
131
+ @dataclass(frozen=True)
132
+ class NeutrosophicComplexNumber(AdvancedNumber):
133
+ """
134
+ Represents a neutrosophic complex number z = (a + bi) + (c + di)I.
135
+ This can be seen as a neutrosophic number whose determinate and indeterminate
136
+ parts are complex numbers.
137
+ """
138
+ determinate: complex
139
+ indeterminate: complex
140
+
141
+ def __add__(self, other: NeutrosophicComplexNumber) -> NeutrosophicComplexNumber:
142
+ if not isinstance(other, NeutrosophicComplexNumber):
143
+ return NotImplemented
144
+ return NeutrosophicComplexNumber(
145
+ self.determinate + other.determinate,
146
+ self.indeterminate + other.indeterminate
147
+ )
148
+
149
+ def __sub__(self, other: NeutrosophicComplexNumber) -> NeutrosophicComplexNumber:
150
+ if not isinstance(other, NeutrosophicComplexNumber):
151
+ return NotImplemented
152
+ return NeutrosophicComplexNumber(
153
+ self.determinate - other.determinate,
154
+ self.indeterminate - other.indeterminate
155
+ )
156
+
157
+ def __mul__(self, other: NeutrosophicComplexNumber) -> NeutrosophicComplexNumber:
158
+ if not isinstance(other, NeutrosophicComplexNumber):
159
+ return NotImplemented
160
+ # (A + BI)(C + DI) = AC + (AD + BC + BD)I, where A, B, C, D are complex.
161
+ determinate_part = self.determinate * other.determinate
162
+ indeterminate_part = (self.determinate * other.indeterminate +
163
+ self.indeterminate * other.determinate +
164
+ self.indeterminate * other.indeterminate)
165
+ return NeutrosophicComplexNumber(determinate_part, indeterminate_part)
166
+
167
+ def __truediv__(self, other: NeutrosophicComplexNumber) -> NeutrosophicComplexNumber:
168
+ raise NotImplementedError("Division for neutrosophic complex numbers is not implemented.")
169
+
170
+ def __eq__(self, other) -> bool:
171
+ if not isinstance(other, NeutrosophicComplexNumber):
172
+ return NotImplemented
173
+ return self.determinate == other.determinate and self.indeterminate == other.indeterminate
174
+
175
+ def __repr__(self) -> str:
176
+ return f"({self.determinate}) + ({self.indeterminate})I"
177
+
178
+
179
+ @dataclass(frozen=True)
180
+ class NeutrosophicBicomplexNumber(AdvancedNumber):
181
+ """
182
+ Represents a neutrosophic bicomplex number z = (z1 + z2j) + (w1 + w2j)I.
183
+ This can be seen as a neutrosophic number whose determinate and indeterminate
184
+ parts are bicomplex numbers.
185
+ """
186
+ determinate: BicomplexNumber
187
+ indeterminate: BicomplexNumber
188
+
189
+ def __add__(self, other: NeutrosophicBicomplexNumber) -> NeutrosophicBicomplexNumber:
190
+ if not isinstance(other, NeutrosophicBicomplexNumber):
191
+ return NotImplemented
192
+ return NeutrosophicBicomplexNumber(
193
+ self.determinate + other.determinate,
194
+ self.indeterminate + other.indeterminate
195
+ )
196
+
197
+ def __sub__(self, other: NeutrosophicBicomplexNumber) -> NeutrosophicBicomplexNumber:
198
+ if not isinstance(other, NeutrosophicBicomplexNumber):
199
+ return NotImplemented
200
+ return NeutrosophicBicomplexNumber(
201
+ self.determinate - other.determinate,
202
+ self.indeterminate - other.indeterminate
203
+ )
204
+
205
+ def __mul__(self, other: NeutrosophicBicomplexNumber) -> NeutrosophicBicomplexNumber:
206
+ if not isinstance(other, NeutrosophicBicomplexNumber):
207
+ return NotImplemented
208
+ # (A + BI)(C + DI) = AC + (AD + BC + BD)I, where A, B, C, D are bicomplex.
209
+ determinate_part = self.determinate * other.determinate
210
+ indeterminate_part = (self.determinate * other.indeterminate +
211
+ self.indeterminate * other.determinate +
212
+ self.indeterminate * other.indeterminate)
213
+ return NeutrosophicBicomplexNumber(determinate_part, indeterminate_part)
214
+
215
+ def __truediv__(self, other: NeutrosophicBicomplexNumber) -> NeutrosophicBicomplexNumber:
216
+ raise NotImplementedError("Division for neutrosophic bicomplex numbers is not implemented.")
217
+
218
+ def __eq__(self, other) -> bool:
219
+ if not isinstance(other, NeutrosophicBicomplexNumber):
220
+ return NotImplemented
221
+ return self.determinate == other.determinate and self.indeterminate == other.indeterminate
222
+
223
+ def __repr__(self) -> str:
224
+ return f"({self.determinate}) + ({self.indeterminate})I"
225
+
226
+
227
+ @dataclass(frozen=True)
228
+ class HyperrealNumber(AdvancedNumber):
229
+ """
230
+ Represents a hyperreal number as a sequence of real numbers.
231
+ Note: This is a conceptual implementation. A full implementation requires
232
+ a non-principal ultrafilter, which is non-constructive.
233
+ """
234
+ sequence_func: callable
235
+
236
+ def __post_init__(self):
237
+ if not callable(self.sequence_func):
238
+ raise TypeError("sequence_func must be a callable function.")
239
+
240
+ def __add__(self, other: HyperrealNumber) -> HyperrealNumber:
241
+ if not isinstance(other, HyperrealNumber):
242
+ return NotImplemented
243
+ return HyperrealNumber(lambda n: self.sequence_func(n) + other.sequence_func(n))
244
+
245
+ def __sub__(self, other: HyperrealNumber) -> HyperrealNumber:
246
+ if not isinstance(other, HyperrealNumber):
247
+ return NotImplemented
248
+ return HyperrealNumber(lambda n: self.sequence_func(n) - other.sequence_func(n))
249
+
250
+ def __mul__(self, other: HyperrealNumber) -> HyperrealNumber:
251
+ if not isinstance(other, HyperrealNumber):
252
+ return NotImplemented
253
+ return HyperrealNumber(lambda n: self.sequence_func(n) * other.sequence_func(n))
254
+
255
+ def __truediv__(self, other: HyperrealNumber) -> HyperrealNumber:
256
+ # Avoid division by zero in the sequence
257
+ def div_func(n):
258
+ denominator = other.sequence_func(n)
259
+ if denominator == 0:
260
+ # This case needs a more rigorous definition based on the ultrafilter.
261
+ # For simplicity, we return 0, but this is not generally correct.
262
+ return 0
263
+ return self.sequence_func(n) / denominator
264
+ return HyperrealNumber(div_func)
265
+
266
+ def __eq__(self, other) -> bool:
267
+ # Equality for hyperreals means the set of indices where sequences are equal
268
+ # belongs to the ultrafilter. This cannot be implemented directly.
269
+ raise NotImplementedError("Equality for hyperreal numbers cannot be determined constructively.")
270
+
271
+ def __repr__(self) -> str:
272
+ return f"Hyperreal(sequence: {self.sequence_func(1)}, {self.sequence_func(2)}, ...)"
273
+
274
+
275
+ # =============================================
276
+ # Helper Functions
277
+ # =============================================
278
+
279
+ def oresme_sequence(n_terms: int) -> List[float]:
280
+ """Generates the first n terms of the Oresme sequence (n / 2^n)."""
281
+ if n_terms <= 0:
282
+ return []
283
+ return [n / (2 ** n) for n in range(1, n_terms + 1)]
284
+
285
+
286
+ def harmonic_numbers(n_terms: int) -> Generator[Fraction, None, None]:
287
+ """
288
+ Generates the first n harmonic numbers (H_n = 1 + 1/2 + ... + 1/n)
289
+ as exact fractions.
290
+ """
291
+ if n_terms <= 0:
292
+ return
293
+ current_sum = Fraction(0)
294
+ for i in range(1, n_terms + 1):
295
+ current_sum += Fraction(1, i)
296
+ yield current_sum
297
+
298
+
299
+ def binet_formula(n: int) -> float:
300
+ """Calculates the nth Fibonacci number using Binet's formula."""
301
+ if n < 0:
302
+ raise ValueError("The Fibonacci sequence is not defined for negative integers.")
303
+ sqrt5 = math.sqrt(5)
304
+ phi = (1 + sqrt5) / 2
305
+ return (phi**n - (1 - phi)**n) / sqrt5