AxiomX 0.0.1__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.
AxiomX/__init__.py ADDED
@@ -0,0 +1 @@
1
+ from core import *
AxiomX/core.py ADDED
@@ -0,0 +1,253 @@
1
+ # AxiomX-0.0.1
2
+ # A dynamic math library
3
+
4
+ from time import sleep
5
+
6
+ """
7
+ This library is a project initiated by Eric Joseph. It contains a large amount of methods.
8
+ Here are the methods of AxiomX:
9
+ 1. absolute(x) - Returns the absolute value of x.
10
+ 2. get_digits(x) - Returns the digits of x in a list.
11
+ 3. gamma(x) - It returns the value of gamma(x). It only is accurate for 0.5 and other integers. It is still under research.
12
+ 4. factorial(x) - It is based on the gamma function.
13
+ 5. continued_fraction(constant) - This method returns the list of the denominators of the simple continued fraction of the constant. An additional argument can be supplied for the no. of denominators.
14
+ 6. evaluate_continued_fraction(denominators) - This method evaluates a continued fraction by the list of denominators supplied.
15
+ 7. sqrt(n) - This method returns the square root of n using Newton-Raphson Method.
16
+ 8. zeta(n) - This method returns the value of the Riemann zeta function at n. Throws an error if n <= 1.
17
+ 9. exp(n) - This method returns the value of e**n.
18
+ 10. ln(x) - This method returns the natural logarithm of x.
19
+ 11. log10(x) - This method returns the common logarithm of x.
20
+ 12. log(a, b) - This method returns the logarithm of a to the base b.
21
+ 13. radians(degrees) - This method converts degrees into radians.
22
+ 14. degrees(radians) - This method converts radians to degrees.
23
+ 15. sin(x) - This method gives the value of sin(x), where x is in radians.
24
+ """
25
+
26
+ print("AxiomX loading...")
27
+ sleep(3)
28
+ print("AxiomX is ready to use!\n")
29
+ version = "0.0.1"
30
+
31
+ # Constants
32
+ pi = 3.141592653589793
33
+ e = 2.718281828459045
34
+ tau = 2 * pi
35
+ lemniscate = 2.622057554292119
36
+
37
+ # Number Operations
38
+
39
+ def absolute(x):
40
+ if x >= 0:
41
+ return x
42
+ return -x
43
+
44
+ def get_digits(x):
45
+ digits = []
46
+ while x > 0:
47
+ digits.append(x % 10)
48
+ x //= 10
49
+ digits.reverse()
50
+ return digits
51
+
52
+ def gamma(x):
53
+ # Lanczos approximation constants
54
+ p = [
55
+ 0.99999999999980993,
56
+ 676.5203681218851,
57
+ -1259.1392167224028,
58
+ 771.32342877765313,
59
+ -176.61502916214059,
60
+ 12.507343278686905,
61
+ -0.13857109526572012,
62
+ 9.9843695780195716e-6,
63
+ 1.5056327351493116e-7
64
+ ]
65
+
66
+ if x < 0.5:
67
+ # Reflection formula
68
+ return pi / (sin(pi * x) * gamma(1 - x))
69
+
70
+ x -= 1
71
+ t = p[0]
72
+ for i in range(1, len(p)):
73
+ t += p[i] / (x + i)
74
+
75
+ g = 7
76
+ return sqrt(2 * pi) * (x + g + 0.5)**(x + 0.5) * (e**(-(x + g + 0.5))) * t
77
+
78
+ def factorial(x):
79
+ return gamma(x+1)
80
+
81
+ def continued_fraction(constant, terms=5):
82
+ denominator = []
83
+ denominator.append(int(constant))
84
+ for i in range(terms-1):
85
+ constant = constant - denominator[i]
86
+ denominator.append(int(float(1) / float(constant)))
87
+ constant = 1 / constant
88
+ return denominator
89
+
90
+ def evaluate_continued_fraction(denominators):
91
+ result = 0
92
+ for denominator in reversed(denominators):
93
+ result = denominator + (1 / result) if result != 0 else denominator
94
+ return result
95
+
96
+ def sqrt(n):
97
+ if n < 0:
98
+ raise ValueError("square root of negative number is imaginary")
99
+ x1 = int(n**0.5)
100
+ x2 = 0
101
+ if n == 0:
102
+ return 0
103
+ for a in range(100000):
104
+ x2 = 0.5 * (x1 + (n / x1))
105
+ x1 = x2
106
+ return x1
107
+
108
+ # Riemann Zeta function
109
+ def zeta(n):
110
+ if n <= 1:
111
+ raise ValueError("zeta(n) is undefined for n <= 1")
112
+ zetval = 0
113
+ for b in range(100000):
114
+ zetval += 1 / ((b+1)**n)
115
+ return zetval
116
+
117
+ # Defining more constants
118
+ gelfond = e**pi
119
+ sqrt_2 = sqrt(2)
120
+ sqrt_3 = sqrt(3)
121
+ sqrt_5 = sqrt(5)
122
+ golden_ratio = (1 + sqrt_5) / 2
123
+ silver_ratio = 1 + sqrt_2
124
+ apery = zeta(3)
125
+ gauss = lemniscate / pi
126
+ ramanujan = gelfond**sqrt(163)
127
+ euler_mascheroni = 0.577215664901533
128
+
129
+ # Exponential functions
130
+ def exp(n):
131
+ return e**n
132
+
133
+ def ln(x, terms=100):
134
+ if x <= 0:
135
+ raise ValueError("ln(x) is undefined for x <= 0")
136
+ y = (x - 1) / (x + 1)
137
+ result = 0.0
138
+ for n in range(terms):
139
+ term = (y ** (2 * n + 1)) / (2 * n + 1)
140
+ result += term
141
+ return 2 * result
142
+
143
+ def log10(x, terms=100):
144
+ return ln(x, terms) / ln(10, terms)
145
+
146
+ def log(argument, base):
147
+ return log10(argument) / log10(base)
148
+
149
+ #Trig Functions
150
+
151
+ def radians(deg):
152
+ return (pi/180)*deg
153
+
154
+ def degrees(rad):
155
+ return (180/pi)*rad
156
+
157
+ def sin(x, terms=20):
158
+ quarter = ((x // tau) + 1) % 4
159
+ if x == pi:
160
+ return 0
161
+ x = x % tau
162
+ # Input validation
163
+ if not isinstance(x, (int, float)):
164
+ raise TypeError("x must be a number (int or float).")
165
+ if not isinstance(terms, int) or terms <= 0:
166
+ raise ValueError("terms must be a positive integer.")
167
+ sine_value = 0.0
168
+ for n in range(terms):
169
+ term = ((-1)**n) * (x**(2*n + 1)) / factorial(2*n + 1)
170
+ sine_value += term
171
+ return sine_value
172
+ if quarter == 1:
173
+ return sine_value
174
+ elif quarter == 2:
175
+ return sqrt(1 - (sine_value**2))
176
+ elif quarter == 3:
177
+ return -sine_value
178
+ elif quarter == 0:
179
+ return -sqrt(1 - (sine_value**2))
180
+
181
+ def cos(x):
182
+ return sin((pi/2)-x)
183
+
184
+ def tan(x):
185
+ return sin(x) / cos(x)
186
+
187
+ def cot(x):
188
+ return 1 / tan(x)
189
+
190
+ def sec(x):
191
+ return 1 / cos(x)
192
+
193
+ def cosec(x):
194
+ return 1 / sin(x)
195
+
196
+ def arcsin(x, iterations=10):
197
+ if abs(x) > 1:
198
+ raise ValueError("x must be in [-1, 1]")
199
+ y = x
200
+ for _ in range(iterations):
201
+ y -= (sin(y) - x) / cos(y)
202
+ return y
203
+
204
+ def arccos(x):
205
+ return (pi / 2) - arcsin(x)
206
+
207
+ def arctan(x):
208
+ return arcsin(x / sqrt(1+ x**2))
209
+
210
+ def arccot(x):
211
+ return (pi/2) - arctan(x)
212
+
213
+ def arcsec(x):
214
+ return arccos(1/x)
215
+
216
+ def arccosec(x):
217
+ return arcsin(1/x)
218
+
219
+ def sinh(x):
220
+ return (e**x - e**(-x))/2
221
+
222
+ def cosh(x):
223
+ return (e**x + e**(-x))/2
224
+
225
+ def tanh(x):
226
+ return sinh(x) / cosh(x)
227
+
228
+ def coth(x):
229
+ return cosh(x) / sinh(x)
230
+
231
+ def sech(x):
232
+ return 1 / cosh(x)
233
+
234
+ def cosech(x):
235
+ return 1 / sinh(x)
236
+
237
+ def arcsinh(x):
238
+ return ln(x + sqrt(x**2 + 1))
239
+
240
+ def arccosh(x):
241
+ return abs(arcsinh(sqrt(x**2 - 1)))
242
+
243
+ def arccoth(x):
244
+ return 0.5 * ((x+1)/(x-1))
245
+
246
+ def arctanh(x):
247
+ return arccoth(1/x)
248
+
249
+ def arcsech(x):
250
+ return arccosh(1/x)
251
+
252
+ def arccosech(x):
253
+ return arcsinh(1/x)
@@ -0,0 +1,89 @@
1
+ Metadata-Version: 2.4
2
+ Name: AxiomX
3
+ Version: 0.0.1
4
+ Summary: A dynamic Python math library containing numerous mathematical functions implemented from scratch.
5
+ Author: Eric Joseph
6
+ License: MIT
7
+ Requires-Python: >=3.8
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Dynamic: license-file
11
+ Dynamic: requires-python
12
+
13
+ AxiomX Math Library
14
+
15
+ AxiomX is a dynamic Python math library created by Eric Joseph.
16
+ It includes numerous mathematical functions implemented from scratch,
17
+ such as:
18
+
19
+ Features
20
+
21
+ 🔢 Number Operations
22
+
23
+ - absolute(x) - Absolute value
24
+ - get_digits(x) - Extract digits of a number
25
+ - gamma(x) - Lanczos-based Gamma function
26
+ - factorial(x) - Based on Gamma function
27
+ - sqrt(n) - Newton-Raphson square root
28
+
29
+ ➗ Continued Fractions
30
+
31
+ - continued_fraction(constant, [terms]) - This method generates a list of the denominators of the simple fraction of the give constant. The number of terms can be adjusted.
32
+ - evaluate_continued_fraction(list) - This method evaluates a simple continued fraction by its denominators.
33
+
34
+ 📚 Constants
35
+
36
+ Includes:
37
+ pi - 3.141592653589793
38
+ e - 2.718281828459045
39
+ tau - 2 * pi
40
+ lemniscate - 2.622057554292119
41
+ gelfond - e ** pi
42
+ sqrt_2 - sqrt(2)
43
+ sqrt_3 - sqrt(3)
44
+ sqrt_5 - sqrt(5)
45
+ golden_ratio - (1 + sqrt_5) / 2
46
+ silver_ratio - 1 + sqrt_2
47
+ apery - zeta(3)
48
+ gauss - lemniscate / pi
49
+ ramanujan - gelfond ** sqrt(163)
50
+ euler_mascheroni - 0.577215664901533
51
+
52
+ 🔢 Zeta Function
53
+
54
+ - zeta(n) - Riemann zeta approximation
55
+
56
+ 📈 Logarithmic & Exponential
57
+
58
+ - exp(n) - Returns e**n.
59
+ - ln(x) - Returns the natural logarithm of x.
60
+ - log10(x) - Returns the common logarithm of x.
61
+ - log(a, b) - Returns the logarithm of a to the base b.
62
+
63
+ 🔺 Trigonometric Functions
64
+
65
+ - sin(x)
66
+ - cos(x)
67
+ - tan(x)
68
+ - Inverse trig functions like arcsin, arccos, etc.
69
+ - Hyperbolic functions and their inverses
70
+
71
+ Version
72
+
73
+ 0.0.1
74
+
75
+ Usage
76
+
77
+ # python
78
+ import AxiomX as ax
79
+
80
+ print(ax.sin(ax.pi/2))
81
+
82
+
83
+ Notes
84
+
85
+ Gamma and some trigonometric handling are still experimental and may be
86
+ refined in future versions.
87
+ AxiomX is open-source and can be used anywhere. This library is licensed
88
+ under MIT and no one is allowed to copy code from AxiomX. Hope you all
89
+ enjoy AxiomX.
@@ -0,0 +1,7 @@
1
+ AxiomX/__init__.py,sha256=rgY0eDivdgd67ObFQW5jEa47c09RME4uksRBeJC3pxQ,18
2
+ AxiomX/core.py,sha256=2DmXpvrkmsa_f4V_f_fjTXseeNXv4CVTTUDZ5PZ1hMc,6955
3
+ axiomx-0.0.1.dist-info/licenses/LICENSE,sha256=UqMhL5J0KvJWWKKblZAkzBSMSq1wYZSiOVEKwlaxJhg,1076
4
+ axiomx-0.0.1.dist-info/METADATA,sha256=Jw-kWA1l87FhAGkgsBCn1373oQT972D_PsQ6ftKp6PA,2420
5
+ axiomx-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ axiomx-0.0.1.dist-info/top_level.txt,sha256=algeF8ebYw9MiovrpuUutcpMi-f45DiSW0GZl83qzIg,7
7
+ axiomx-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Eric Joseph
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a
6
+ copy of this software and associated documentation files (the
7
+ “Software”), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included
14
+ in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
17
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1 @@
1
+ AxiomX