adnus 0.1.3__tar.gz → 0.1.5__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.

@@ -0,0 +1,3 @@
1
+ include README.md
2
+ include LICENSE
3
+ recursive-include data *.json
@@ -1,19 +1,29 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: adnus
3
- Version: 0.1.3
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
- License: MIT
5
+ Home-page: https://github.com/WhiteSymmetry/adnus
6
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: 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,299 @@
1
+ Metadata-Version: 2.4
2
+ Name: adnus
3
+ Version: 0.1.5
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
+ Home-page: https://github.com/WhiteSymmetry/adnus
6
+ Author: Mehmet Keçeci
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
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
27
+
28
+ # adnus (AdNuS): Advanced Number Systems.
29
+
30
+ ---
31
+ [![PyPI version](https://badge.fury.io/py/adnus.svg)](https://badge.fury.io/py/adnus)
32
+
33
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
34
+
35
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.16341919.svg)](https://doi.org/10.5281/zenodo.16341919)
36
+
37
+ [![WorkflowHub DOI](https://img.shields.io/badge/DOI-10.48546/workflowhub.datafile.23.1-blue)](https://doi.org/10.48546/workflowhub.datafile.23.1)
38
+
39
+ [![figshare DOI](https://img.shields.io/badge/DOI-10.6084/m9.figshare.29621336-blue)](https://doi.org/10.6084/m9.figshare.29621336)
40
+
41
+ [![OSF DOI](https://img.shields.io/badge/DOI-10.17605/OSF.IO/9C26Y-blue)](https://doi.org/10.17605/OSF.IO/9C26Y)
42
+
43
+ [![Anaconda-Server Badge](https://anaconda.org/bilgi/adnus/badges/version.svg)](https://anaconda.org/bilgi/adnus)
44
+ [![Anaconda-Server Badge](https://anaconda.org/bilgi/adnus/badges/latest_release_date.svg)](https://anaconda.org/bilgi/adnus)
45
+ [![Anaconda-Server Badge](https://anaconda.org/bilgi/adnus/badges/platforms.svg)](https://anaconda.org/bilgi/adnus)
46
+ [![Anaconda-Server Badge](https://anaconda.org/bilgi/adnus/badges/license.svg)](https://anaconda.org/bilgi/adnus)
47
+
48
+ [![Open Source](https://img.shields.io/badge/Open%20Source-Open%20Source-brightgreen.svg)](https://opensource.org/)
49
+ [![Documentation Status](https://app.readthedocs.org/projects/adnus/badge/?0.1.0=main)](https://adnus.readthedocs.io/en/latest)
50
+
51
+ [![OpenSSF Best Practices](https://www.bestpractices.dev/projects/-/badge)](https://www.bestpractices.dev/projects/-)
52
+
53
+ [![Python CI](https://github.com/WhiteSymmetry/adnus/actions/workflows/python_ci.yml/badge.svg?branch=main)](https://github.com/WhiteSymmetry/adnus/actions/workflows/python_ci.yml)
54
+ [![codecov](https://codecov.io/gh/WhiteSymmetry/adnus/graph/badge.svg?token=ES98M5WZFI)](https://codecov.io/gh/WhiteSymmetry/adnus)
55
+ [![Documentation Status](https://readthedocs.org/projects/adnus/badge/?version=latest)](https://adnus.readthedocs.io/en/latest/)
56
+ [![Binder](https://terrarium.evidencepub.io/badge_logo.svg)](https://terrarium.evidencepub.io/v2/gh/WhiteSymmetry/adnus/HEAD)
57
+ [![PyPI version](https://badge.fury.io/py/adnus.svg)](https://badge.fury.io/py/adnus)
58
+ [![PyPI Downloads](https://static.pepy.tech/badge/adnus)](https://pepy.tech/projects/adnus)
59
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](CODE_OF_CONDUCT.md)
60
+ [![Linted with Ruff](https://img.shields.io/badge/Linted%20with-Ruff-green?logo=python&logoColor=white)](https://github.com/astral-sh/ruff)
61
+
62
+ ---
63
+
64
+ <p align="left">
65
+ <table>
66
+ <tr>
67
+ <td style="text-align: center;">PyPI</td>
68
+ <td style="text-align: center;">
69
+ <a href="https://pypi.org/project/adnus/">
70
+ <img src="https://badge.fury.io/py/adnus.svg" alt="PyPI version" height="18"/>
71
+ </a>
72
+ </td>
73
+ </tr>
74
+ <tr>
75
+ <td style="text-align: center;">Conda</td>
76
+ <td style="text-align: center;">
77
+ <a href="https://anaconda.org/bilgi/adnus">
78
+ <img src="https://anaconda.org/bilgi/adnus/badges/version.svg" alt="conda-forge version" height="18"/>
79
+ </a>
80
+ </td>
81
+ </tr>
82
+ <tr>
83
+ <td style="text-align: center;">DOI</td>
84
+ <td style="text-align: center;">
85
+ <a href="https://doi.org/10.5281/zenodo.16341919">
86
+ <img src="https://zenodo.org/badge/DOI/10.5281/zenodo.16341919.svg" alt="DOI" height="18"/>
87
+ </a>
88
+ </td>
89
+ </tr>
90
+ <tr>
91
+ <td style="text-align: center;">License: MIT</td>
92
+ <td style="text-align: center;">
93
+ <a href="https://opensource.org/licenses/MIT">
94
+ <img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License" height="18"/>
95
+ </a>
96
+ </td>
97
+ </tr>
98
+ </table>
99
+ </p>
100
+
101
+ ---
102
+ # adnus (AdNuS): Advanced Number Systems.
103
+
104
+ `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.
105
+
106
+ ## Features
107
+
108
+ - **Harmonic and Oresme Sequences**: Functions to generate harmonic numbers and Oresme sequences.
109
+ - **Bicomplex Numbers**: A class for bicomplex numbers with full arithmetic support.
110
+ - **Neutrosophic Numbers**: Classes for neutrosophic numbers, including their complex and bicomplex extensions.
111
+ - **Hyperreal Numbers**: A conceptual implementation of hyperreal numbers.
112
+ - **Extensible Design**: Built with an abstract base class to easily extend and add new number systems.
113
+ - **Fully Typed**: The library is fully type-hinted for better code quality and maintainability.
114
+ - **Real numbers**
115
+ - **Complex numbers**
116
+ - **Quaternion numbers**
117
+ - **Octonion numbers**
118
+ - **Sedenion numbers**
119
+ - **Pathion numbers**
120
+ - **Chingon numbers**
121
+ - **Routon numbers**
122
+ - **Voudon numbers**
123
+
124
+ ## Installation
125
+
126
+ To install the library, clone the repository and use Poetry:
127
+
128
+ ```bash
129
+ git clone https://github.com/WhiteSymmetry/adnus.git
130
+ cd adnus
131
+ poetry install
132
+ ```
133
+
134
+ ## Kullanım (Türkçe) / Usage (English)
135
+
136
+ ```python
137
+ import adnus
138
+ adnus.__version__
139
+ ```
140
+
141
+ Here's a quick overview of how to use the different number systems available in `adnus`.
142
+
143
+ ### Bicomplex Numbers
144
+
145
+ ```python
146
+ import adnus as ad
147
+ #from adnus import BicomplexNumber
148
+
149
+ z1 = ad.BicomplexNumber(1 + 2j, 3 + 4j)
150
+ z2 = ad.BicomplexNumber(5 + 6j, 7 + 8j)
151
+
152
+ print(f"Addition: {z1 + z2}")
153
+ print(f"Multiplication: {z1 * z2}")
154
+ ```
155
+
156
+ ### Neutrosophic Numbers
157
+
158
+ ```python
159
+ import adnus as ad
160
+ # from adnus import NeutrosophicNumber
161
+
162
+ n1 = ad.NeutrosophicNumber(1.5, 2.5)
163
+ n2 = ad. NeutrosophicNumber(3.0, 4.0)
164
+
165
+ print(f"Addition: {n1 + n2}")
166
+ print(f"Multiplication: {n1 * n2}")
167
+ ```
168
+
169
+ ```python
170
+ import adnus as ad
171
+ C = cayley_dickson_construction(ad.Complex)
172
+ print(C(3-7j))
173
+ ```
174
+
175
+ ```python
176
+ import adnus as ad
177
+ q1 = ad.Quaternion(1, 2, 3, 4)
178
+ q2 = ad.Quaternion(5, 6, 7, 8)
179
+ print(f"Quaternions: {q1} * {q2} = {q1 * q2}")
180
+ ```
181
+
182
+ ## Running Tests
183
+
184
+ To ensure everything is working correctly, you can run the included tests using `pytest`:
185
+
186
+ ```bash
187
+ poetry run pytest
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Kurulum (Türkçe) / Installation (English)
193
+
194
+ ### Python ile Kurulum / Install with pip, conda, mamba
195
+ ```bash
196
+ pip install adnus -U
197
+ python -m pip install -U adnus
198
+ conda install bilgi::adnus -y
199
+ mamba install bilgi::adnus -y
200
+ ```
201
+
202
+ ```diff
203
+ - pip uninstall adnus -y
204
+ + pip install -U adnus
205
+ + python -m pip install -U adnus
206
+ ```
207
+
208
+ [PyPI](https://pypi.org/project/adnus/)
209
+
210
+ ### Test Kurulumu / Test Installation
211
+
212
+ ```bash
213
+ pip install -i https://test.pypi.org/simple/ adnus -U
214
+ ```
215
+
216
+ ### Github Master Kurulumu / GitHub Master Installation
217
+
218
+ **Terminal:**
219
+
220
+ ```bash
221
+ pip install git+https://github.com/WhiteSymmetry/adnus.git
222
+ ```
223
+
224
+ **Jupyter Lab, Notebook, Visual Studio Code:**
225
+
226
+ ```python
227
+ !pip install git+https://github.com/WhiteSymmetry/adnus.git
228
+ # or
229
+ %pip install git+https://github.com/WhiteSymmetry/adnus.git
230
+ ```
231
+
232
+ ---
233
+
234
+ ### Development
235
+ ```bash
236
+ # Clone the repository
237
+ git clone https://github.com/WhiteSymmetry/adnus.git
238
+ cd adnus
239
+
240
+ # Install in development mode
241
+ python -m pip install -ve . # Install package in development mode
242
+
243
+ # Run tests
244
+ pytest
245
+
246
+ Notebook, Jupyterlab, Colab, Visual Studio Code
247
+ !python -m pip install git+https://github.com/WhiteSymmetry/adnus.git
248
+ ```
249
+ ---
250
+
251
+ ## Citation
252
+
253
+ 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.
254
+
255
+ ### BibTeX
256
+
257
+
258
+ ### APA
259
+
260
+ ```
261
+
262
+ Keçeci, M. (2025). adnus [Data set]. ResearchGate. https://doi.org/
263
+
264
+ Keçeci, M. (2025). adnus [Data set]. OSF. https://doi.org/10.17605/OSF.IO/9C26Y
265
+
266
+ Keçeci, M. (2025). adnus [Data set]. figshare. https://doi.org/10.6084/m9.figshare.29621336
267
+
268
+ Keçeci, M. (2025). adnus [Data set]. WorkflowHub. https://doi.org/10.48546/workflowhub.datafile.23.1
269
+
270
+ Keçeci, M. (2025). adnus. Open Science Articles (OSAs), Zenodo. https://doi.org/10.5281/zenodo.16341919
271
+
272
+ ```
273
+
274
+ ### Chicago
275
+
276
+ ```
277
+
278
+
279
+ Keçeci, Mehmet. adnus [Data set]. ResearchGate, 2025. https://doi.org/
280
+
281
+ Keçeci, M. (2025). <i>adnus</i> (Version 1). figshare. https://doi.org/10.6084/m9.figshare.29621336
282
+
283
+ Keçeci, Mehmet. adnus [Data set]. WorkflowHub, 2025. https://doi.org/10.48546/workflowhub.datafile.23.1
284
+
285
+ Keçeci, Mehmet. adnus. Open Science Articles (OSAs), Zenodo, 2025. https://doi.org/10.5281/zenodo.16341919
286
+
287
+ ```
288
+
289
+
290
+ ### Lisans (Türkçe) / License (English)
291
+
292
+ ```
293
+ This project is licensed under the MIT License.
294
+ ```
295
+
296
+ ## Contributing
297
+
298
+ Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or feature requests.
299
+
@@ -0,0 +1,12 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ setup.cfg
6
+ setup.py
7
+ adnus.egg-info/PKG-INFO
8
+ adnus.egg-info/SOURCES.txt
9
+ adnus.egg-info/dependency_links.txt
10
+ adnus.egg-info/requires.txt
11
+ adnus.egg-info/top_level.txt
12
+ tests/test_adnus.py
@@ -0,0 +1,9 @@
1
+ numpy<3.0.0,>=2.3.3
2
+ hypercomplex==0.3.4
3
+
4
+ [build]
5
+ setuptools<81.0.0,>=80.9.0
6
+ cython<4.0.0,>=3.1.3
7
+
8
+ [dev]
9
+ pytest<9.0.0,>=8.4.2
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,30 @@
1
+ [project]
2
+ name = "adnus"
3
+ version = "0.1.5"
4
+ description = "A Python library for Advanced Number Systems (AdNuS), including Bicomplex, Neutrosophic, Hyperreal numbers, reals, Complex, Quaternion, Octonion, Sedenion, Pathion, Chingon, Routon, Voudon."
5
+ authors = [
6
+ {name = "Mehmet Keçeci", email = "mkececi@yaani.com"}
7
+ ]
8
+ license = {text = "MIT"}
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ dependencies = [
12
+ "numpy>=2.3.3,<3.0.0",
13
+ "hypercomplex==0.3.4"
14
+ ]
15
+
16
+ [project.optional-dependencies]
17
+ dev = [
18
+ "pytest>=8.4.2,<9.0.0"
19
+ ]
20
+ build = [
21
+ "setuptools>=80.9.0,<81.0.0",
22
+ "cython>=3.1.3,<4.0.0"
23
+ ]
24
+
25
+ [build-system]
26
+ requires = [
27
+ "setuptools>=61.0",
28
+ "wheel"
29
+ ]
30
+ build-backend = "setuptools.build_meta"
adnus-0.1.5/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
adnus-0.1.5/setup.py ADDED
@@ -0,0 +1,40 @@
1
+ # -*- coding: utf-8 -*-
2
+ import io
3
+ import re
4
+ from setuptools import setup, find_packages
5
+ import sys
6
+
7
+
8
+ setup(
9
+ name="adnus",
10
+ version="0.1.5",
11
+ description="adnus",
12
+ long_description=open("README.md").read(),
13
+ long_description_content_type="text/markdown",
14
+ author="Mehmet Keçeci",
15
+ maintainer="Mehmet Keçeci",
16
+ author_email="mkececi@yaani.com",
17
+ maintainer_email="mkececi@yaani.com",
18
+ url="https://github.com/WhiteSymmetry/adnus",
19
+ packages=find_packages(), # 'adnus' klasörünü otomatik bulur
20
+ package_data={
21
+ "adnus": ["__init__.py", "_version.py"] # Gerekli dosyaları dahil et
22
+ },
23
+ install_requires=[
24
+ "hypercomplex",
25
+
26
+ ],
27
+ extras_require={
28
+ 'test': [
29
+ "pytest",
30
+ "pytest-cov",
31
+ ]
32
+ },
33
+ classifiers=[
34
+ "Programming Language :: Python :: 3",
35
+ "License :: OSI Approved :: MIT License",
36
+ "Operating System :: OS Independent"
37
+ ],
38
+ python_requires='>=3.10',
39
+ license="MIT",
40
+ )
@@ -0,0 +1,112 @@
1
+ # tests/test_adnus.py
2
+ import pytest
3
+ from __future__ import annotations
4
+ from abc import ABC, abstractmethod
5
+ from dataclasses import dataclass
6
+ from fractions import Fraction
7
+ import math
8
+ from typing import List, Union, Generator, Tuple, Any
9
+ from hypercomplex import reals, Complex, Quaternion, Octonion, Sedenion, Pathion, Chingon, Routon, Voudon, cayley_dickson_construction, cayley_dickson_algebra
10
+ from adnus.main import (
11
+ AdvancedNumber,
12
+ BicomplexNumber,
13
+ NeutrosophicNumber,
14
+ NeutrosophicComplexNumber,
15
+ NeutrosophicBicomplexNumber,
16
+ HyperrealNumber,
17
+ oresme_sequence,
18
+ harmonic_numbers,
19
+ binet_formula,
20
+ generate_cayley_dickson_number,
21
+ generate_cd_chain,
22
+ reals,
23
+ Complex,
24
+ Quaternion,
25
+ Octonion,
26
+ Sedenion,
27
+ Pathion,
28
+ Chingon,
29
+ Routon,
30
+ Voudon,
31
+ cayley_dickson_construction,
32
+ cayley_dickson_algebra
33
+ )
34
+
35
+ class TestBicomplexNumber:
36
+ def test_addition(self):
37
+ bc1 = BicomplexNumber(1 + 2j, 3 + 4j)
38
+ bc2 = BicomplexNumber(5 + 6j, 7 + 8j)
39
+ assert bc1 + bc2 == BicomplexNumber(6 + 8j, 10 + 12j)
40
+
41
+ def test_subtraction(self):
42
+ bc1 = BicomplexNumber(1 + 2j, 3 + 4j)
43
+ bc2 = BicomplexNumber(5 + 6j, 7 + 8j)
44
+ assert bc1 - bc2 == BicomplexNumber(-4 - 4j, -4 - 4j)
45
+
46
+ def test_multiplication(self):
47
+ bc1 = BicomplexNumber(1 + 1j, 1 + 1j)
48
+ bc2 = BicomplexNumber(1 + 1j, 1 + 1j)
49
+ # (1+i)(1+i) - (1+i)(1+i) = 2i - 2i = 0
50
+ # (1+i)(1+i) + (1+i)(1+i) = 2i + 2i = 4i
51
+ assert bc1 * bc2 == BicomplexNumber(0, 4j)
52
+
53
+ def test_norm(self):
54
+ bc = BicomplexNumber(3 + 4j, 5 + 12j) # |3+4j|=5, |5+12j|=13
55
+ assert math.isclose(bc.norm(), math.sqrt(5**2 + 13**2))
56
+
57
+
58
+ class TestNeutrosophicNumber:
59
+ def test_addition(self):
60
+ n1 = NeutrosophicNumber(1.5, 2.5)
61
+ n2 = NeutrosophicNumber(3.0, 4.0)
62
+ assert n1 + n2 == NeutrosophicNumber(4.5, 6.5)
63
+
64
+ def test_multiplication(self):
65
+ n1 = NeutrosophicNumber(2, 3)
66
+ n2 = NeutrosophicNumber(4, 5)
67
+ # a*c = 2*4 = 8
68
+ # ad+bc+bd = 2*5 + 3*4 + 3*5 = 10 + 12 + 15 = 37
69
+ assert n1 * n2 == NeutrosophicNumber(8, 37)
70
+
71
+
72
+ class TestNeutrosophicComplexNumber:
73
+ def test_addition(self):
74
+ nc1 = NeutrosophicComplexNumber(1 + 2j, 3 + 4j)
75
+ nc2 = NeutrosophicComplexNumber(5 + 6j, 7 + 8j)
76
+ assert nc1 + nc2 == NeutrosophicComplexNumber(6 + 8j, 10 + 12j)
77
+
78
+ def test_multiplication(self):
79
+ A, B = 1 + 1j, 2 + 2j
80
+ C, D = 3 + 3j, 4 + 4j
81
+ nc1 = NeutrosophicComplexNumber(A, B)
82
+ nc2 = NeutrosophicComplexNumber(C, D)
83
+ # AC
84
+ det_part = A * C
85
+ # AD + BC + BD
86
+ ind_part = A * D + B * C + B * D
87
+ assert nc1 * nc2 == NeutrosophicComplexNumber(det_part, ind_part)
88
+
89
+
90
+ class TestNeutrosophicBicomplexNumber:
91
+ def test_addition(self):
92
+ nbc1 = NeutrosophicBicomplexNumber(BicomplexNumber(1,1j), BicomplexNumber(2,2j))
93
+ nbc2 = NeutrosophicBicomplexNumber(BicomplexNumber(3,3j), BicomplexNumber(4,4j))
94
+ result = nbc1 + nbc2
95
+ assert result.determinate == BicomplexNumber(4, 4j)
96
+ assert result.indeterminate == BicomplexNumber(6, 6j)
97
+
98
+
99
+ class TestHelperFunctions:
100
+ def test_oresme_sequence(self):
101
+ assert oresme_sequence(3) == [1/2, 2/4, 3/8]
102
+ assert oresme_sequence(0) == []
103
+
104
+ def test_harmonic_numbers(self):
105
+ harmonics = list(harmonic_numbers(3))
106
+ assert harmonics == [Fraction(1, 1), Fraction(3, 2), Fraction(11, 6)]
107
+
108
+ def test_binet_formula(self):
109
+ # F(10) = 55
110
+ assert math.isclose(binet_formula(10), 55.0)
111
+ with pytest.raises(ValueError):
112
+ binet_formula(-1)
@@ -1,19 +0,0 @@
1
- [tool.poetry]
2
- name = "adnus"
3
- version = "0.1.3"
4
- description = "A Python library for Advanced Number Systems (AdNuS), including Bicomplex, Neutrosophic, Hyperreal numbers, reals, Complex, Quaternion, Octonion, Sedenion, Pathion, Chingon, Routon, Voudon."
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"
12
- hypercomplex = "0.3.4"
13
-
14
- [tool.poetry.dev-dependencies]
15
- pytest = "^8.4.1"
16
-
17
- [build-system]
18
- requires = ["poetry-core", "cython", "setuptools"]
19
- build-backend = "poetry.core.masonry.api"
@@ -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
- ]
@@ -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
@@ -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)
File without changes
File without changes