AxiomX 0.1.0.dev8__tar.gz → 0.1.2__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.
- axiomx-0.1.2/AxiomX/calculus.py +95 -0
- {axiomx-0.1.0.dev8 → axiomx-0.1.2}/AxiomX/constants.py +3 -1
- {axiomx-0.1.0.dev8 → axiomx-0.1.2}/AxiomX/exp.py +1 -1
- {axiomx-0.1.0.dev8 → axiomx-0.1.2}/AxiomX/functions.py +19 -1
- axiomx-0.1.2/AxiomX/matrix.py +182 -0
- {axiomx-0.1.0.dev8 → axiomx-0.1.2}/AxiomX/trig.py +17 -1
- axiomx-0.1.2/AxiomX.egg-info/PKG-INFO +133 -0
- {axiomx-0.1.0.dev8 → axiomx-0.1.2}/AxiomX.egg-info/SOURCES.txt +1 -0
- axiomx-0.1.2/PKG-INFO +133 -0
- axiomx-0.1.2/README.md +121 -0
- {axiomx-0.1.0.dev8 → axiomx-0.1.2}/pyproject.toml +1 -1
- {axiomx-0.1.0.dev8 → axiomx-0.1.2}/setup.py +1 -1
- axiomx-0.1.0.dev8/AxiomX/calculus.py +0 -60
- axiomx-0.1.0.dev8/AxiomX.egg-info/PKG-INFO +0 -18
- axiomx-0.1.0.dev8/PKG-INFO +0 -18
- axiomx-0.1.0.dev8/README.md +0 -6
- {axiomx-0.1.0.dev8 → axiomx-0.1.2}/AxiomX/__init__.py +0 -0
- {axiomx-0.1.0.dev8 → axiomx-0.1.2}/AxiomX/hyperbolic.py +0 -0
- {axiomx-0.1.0.dev8 → axiomx-0.1.2}/AxiomX.egg-info/dependency_links.txt +0 -0
- {axiomx-0.1.0.dev8 → axiomx-0.1.2}/AxiomX.egg-info/top_level.txt +0 -0
- {axiomx-0.1.0.dev8 → axiomx-0.1.2}/LICENSE +0 -0
- {axiomx-0.1.0.dev8 → axiomx-0.1.2}/setup.cfg +0 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# integrating integrals
|
|
2
|
+
def integrate(function, lowlim, uplim, n=10000):
|
|
3
|
+
h = (uplim - lowlim) / n
|
|
4
|
+
s = function(lowlim) + function(uplim)
|
|
5
|
+
|
|
6
|
+
for i in range(1, n):
|
|
7
|
+
x = lowlim + i * h
|
|
8
|
+
if i % 2 == 0:
|
|
9
|
+
s += 2 * function(x)
|
|
10
|
+
else:
|
|
11
|
+
s += 4 * function(x)
|
|
12
|
+
|
|
13
|
+
return s * h / 3
|
|
14
|
+
|
|
15
|
+
def summation(lowlim, uplim, function, max_terms=10**6):
|
|
16
|
+
total = 0
|
|
17
|
+
count = 0
|
|
18
|
+
|
|
19
|
+
if uplim == float("inf"):
|
|
20
|
+
n = lowlim
|
|
21
|
+
while count < max_terms:
|
|
22
|
+
try:
|
|
23
|
+
term = function(n)
|
|
24
|
+
except ZeroDivisionError:
|
|
25
|
+
n += 1
|
|
26
|
+
continue
|
|
27
|
+
|
|
28
|
+
total += term
|
|
29
|
+
|
|
30
|
+
# Stop if terms are negligible
|
|
31
|
+
if abs(term) < 1e-10:
|
|
32
|
+
break
|
|
33
|
+
|
|
34
|
+
n += 1
|
|
35
|
+
count += 1
|
|
36
|
+
|
|
37
|
+
return total
|
|
38
|
+
|
|
39
|
+
else:
|
|
40
|
+
for n in range(int(lowlim), int(uplim) + 1):
|
|
41
|
+
total += function(n)
|
|
42
|
+
return total
|
|
43
|
+
|
|
44
|
+
def converges(f, tolerance=1e-6, max_terms=10**6):
|
|
45
|
+
total = 0
|
|
46
|
+
prev = 0
|
|
47
|
+
|
|
48
|
+
for n in range(1, max_terms):
|
|
49
|
+
try:
|
|
50
|
+
total += f(n)
|
|
51
|
+
except ZeroDivisionError:
|
|
52
|
+
continue
|
|
53
|
+
|
|
54
|
+
# Check if partial sum stabilizes
|
|
55
|
+
if abs(total - prev) < tolerance:
|
|
56
|
+
return True
|
|
57
|
+
|
|
58
|
+
prev = total
|
|
59
|
+
|
|
60
|
+
return False
|
|
61
|
+
|
|
62
|
+
def lim(f, xlim, tol=1e-5):
|
|
63
|
+
# Try direct substitution
|
|
64
|
+
try:
|
|
65
|
+
return f(xlim)
|
|
66
|
+
except ZeroDivisionError:
|
|
67
|
+
pass # expected for limits
|
|
68
|
+
except Exception as e:
|
|
69
|
+
return None # or raise e if you want strict behavior
|
|
70
|
+
|
|
71
|
+
hs = [1e-1, 1e-2, 1e-3, 1e-4, 1e-5]
|
|
72
|
+
left_vals = []
|
|
73
|
+
right_vals = []
|
|
74
|
+
|
|
75
|
+
for h in hs:
|
|
76
|
+
try:
|
|
77
|
+
left_vals.append(f(xlim - h))
|
|
78
|
+
except ZeroDivisionError:
|
|
79
|
+
continue
|
|
80
|
+
|
|
81
|
+
try:
|
|
82
|
+
right_vals.append(f(xlim + h))
|
|
83
|
+
except ZeroDivisionError:
|
|
84
|
+
continue
|
|
85
|
+
|
|
86
|
+
if not left_vals or not right_vals:
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
left = left_vals[-1]
|
|
90
|
+
right = right_vals[-1]
|
|
91
|
+
|
|
92
|
+
if abs(left - right) < tol:
|
|
93
|
+
return (left + right) / 2
|
|
94
|
+
|
|
95
|
+
return None
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
pi = 3.141592653589793
|
|
2
2
|
e = 2.718281828459045
|
|
3
|
-
|
|
3
|
+
tau = 2*pi
|
|
4
|
+
lemniscate = 2.622057554292119
|
|
4
5
|
gauss = lemniscate / pi
|
|
5
6
|
euler_mascheroni = 0.577215664901533
|
|
6
7
|
sqrt_2 = 2**0.5
|
|
@@ -10,6 +11,7 @@ golden_ratio = (1 + sqrt_5) / 2
|
|
|
10
11
|
silver_ratio = 1 + sqrt_2
|
|
11
12
|
gelfond = e**pi
|
|
12
13
|
gelfond_schneider = 2**sqrt_2
|
|
14
|
+
infinity = float("inf")
|
|
13
15
|
|
|
14
16
|
def metallic_ratio(n):
|
|
15
17
|
return (n + (n**2 + 4)**0.5) / 2
|
|
@@ -85,4 +85,22 @@ def beta(n):
|
|
|
85
85
|
total = 0.0
|
|
86
86
|
for i in range(100000):
|
|
87
87
|
total += ((-1)**i) / ((2*i + 1)**n)
|
|
88
|
-
return total
|
|
88
|
+
return total
|
|
89
|
+
|
|
90
|
+
def bc(n, k):
|
|
91
|
+
if k < 0 or k > n:
|
|
92
|
+
raise ValueError("Binomial coefficient (n k) doesn't work for negative n or k, or if n < k")
|
|
93
|
+
|
|
94
|
+
k = min(k, n - k) # symmetry optimization
|
|
95
|
+
result = 1
|
|
96
|
+
|
|
97
|
+
for i in range(1, k + 1):
|
|
98
|
+
result = result * (n - i + 1) // i
|
|
99
|
+
|
|
100
|
+
return result
|
|
101
|
+
|
|
102
|
+
def pascal(row):
|
|
103
|
+
pr = []
|
|
104
|
+
for i in range(0, row+1):
|
|
105
|
+
pr.append(int(bc(row, i)))
|
|
106
|
+
return pr
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
class Matrix:
|
|
2
|
+
def __str__(self):
|
|
3
|
+
result = ""
|
|
4
|
+
for row in self.matrix:
|
|
5
|
+
result += " ".join(str(x) for x in row) + "\n"
|
|
6
|
+
return result
|
|
7
|
+
|
|
8
|
+
def __init__(self, rows, columns):
|
|
9
|
+
self.rows = rows
|
|
10
|
+
self.columns = columns
|
|
11
|
+
self.order = (rows,columns)
|
|
12
|
+
self.matrix = []
|
|
13
|
+
|
|
14
|
+
for i in range(rows):
|
|
15
|
+
row = []
|
|
16
|
+
for j in range(columns):
|
|
17
|
+
row.append(0)
|
|
18
|
+
self.matrix.append(row)
|
|
19
|
+
|
|
20
|
+
@classmethod
|
|
21
|
+
def from_list(cls, data):
|
|
22
|
+
rows = len(data)
|
|
23
|
+
columns = len(data[0]) if rows > 0 else 0
|
|
24
|
+
|
|
25
|
+
obj = cls(rows, columns)
|
|
26
|
+
obj.matrix = data
|
|
27
|
+
return obj
|
|
28
|
+
|
|
29
|
+
def transpose(self):
|
|
30
|
+
data = [[self.matrix[i][j] for i in range(self.rows)] for j in range(self.columns)]
|
|
31
|
+
return Matrix.from_list(data)
|
|
32
|
+
|
|
33
|
+
def zero(self):
|
|
34
|
+
self.matrix = []
|
|
35
|
+
self.matrix = [[0 for _ in range(self.columns)] for _ in range(self.rows)]
|
|
36
|
+
|
|
37
|
+
def identity(self):
|
|
38
|
+
self.matrix = [] # reset matrix
|
|
39
|
+
|
|
40
|
+
for i in range(self.rows):
|
|
41
|
+
row = []
|
|
42
|
+
for j in range(self.columns):
|
|
43
|
+
if (i!=j):
|
|
44
|
+
row.append(0)
|
|
45
|
+
else:
|
|
46
|
+
row.append(1)
|
|
47
|
+
self.matrix.append(row)
|
|
48
|
+
|
|
49
|
+
def __getitem__(self, key):
|
|
50
|
+
if isinstance(key, tuple):
|
|
51
|
+
i, j = key
|
|
52
|
+
return self.matrix[i][j]
|
|
53
|
+
return self.matrix[key]
|
|
54
|
+
|
|
55
|
+
def __setitem__(self, key, value):
|
|
56
|
+
if isinstance(key, tuple):
|
|
57
|
+
i, j = key
|
|
58
|
+
self.matrix[i][j] = value
|
|
59
|
+
else:
|
|
60
|
+
self.matrix[key] = value
|
|
61
|
+
|
|
62
|
+
def __add__(self, other):
|
|
63
|
+
if self.rows != other.rows or self.columns != other.columns:
|
|
64
|
+
raise ValueError("matrices cannot be added")
|
|
65
|
+
|
|
66
|
+
data = [
|
|
67
|
+
[self[i, j] + other[i, j] for j in range(self.columns)]
|
|
68
|
+
for i in range(self.rows)
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
return Matrix.from_list(data)
|
|
72
|
+
|
|
73
|
+
def __sub__(self, other):
|
|
74
|
+
if self.rows != other.rows or self.columns != other.columns:
|
|
75
|
+
raise ValueError("matrices cannot be added")
|
|
76
|
+
|
|
77
|
+
data = [
|
|
78
|
+
[self[i, j] - other[i, j] for j in range(self.columns)]
|
|
79
|
+
for i in range(self.rows)
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
return Matrix.from_list(data)
|
|
83
|
+
|
|
84
|
+
def __mul__(self, other):
|
|
85
|
+
if isinstance(other, (int, float)):
|
|
86
|
+
return Matrix.from_list([
|
|
87
|
+
[self[i, j] * other for j in range(self.columns)]
|
|
88
|
+
for i in range(self.rows)
|
|
89
|
+
])
|
|
90
|
+
|
|
91
|
+
if self.columns != other.rows:
|
|
92
|
+
raise ValueError("Matrix dimensions do not match")
|
|
93
|
+
|
|
94
|
+
data = [
|
|
95
|
+
[
|
|
96
|
+
sum(self[i, k] * other[k, j] for k in range(self.columns))
|
|
97
|
+
for j in range(other.columns)
|
|
98
|
+
]
|
|
99
|
+
for i in range(self.rows)
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
return Matrix.from_list(data)
|
|
103
|
+
|
|
104
|
+
def det(self):
|
|
105
|
+
if self.rows != self.columns:
|
|
106
|
+
raise ValueError("determinant is only defined for square matrices")
|
|
107
|
+
|
|
108
|
+
# 1x1
|
|
109
|
+
if self.rows == 1:
|
|
110
|
+
return self[0, 0]
|
|
111
|
+
|
|
112
|
+
# 2x2
|
|
113
|
+
if self.rows == 2:
|
|
114
|
+
return self[0, 0]*self[1, 1] - self[0, 1]*self[1, 0]
|
|
115
|
+
|
|
116
|
+
# nxn (recursive expansion)
|
|
117
|
+
determinant = 0
|
|
118
|
+
|
|
119
|
+
for j in range(self.columns):
|
|
120
|
+
submatrix = []
|
|
121
|
+
|
|
122
|
+
for i in range(1, self.rows):
|
|
123
|
+
row = []
|
|
124
|
+
for k in range(self.columns):
|
|
125
|
+
if k != j:
|
|
126
|
+
row.append(self[i, k])
|
|
127
|
+
submatrix.append(row)
|
|
128
|
+
|
|
129
|
+
sign = (-1) ** j
|
|
130
|
+
determinant += Matrix.from_list(submatrix).det() * sign * self[0, j]
|
|
131
|
+
return determinant
|
|
132
|
+
|
|
133
|
+
def _minor(self, i, j):
|
|
134
|
+
return Matrix.from_list([
|
|
135
|
+
[self[r, c] for c in range(self.columns) if c != j]
|
|
136
|
+
for r in range(self.rows) if r != i
|
|
137
|
+
])
|
|
138
|
+
|
|
139
|
+
def _cofactor_matrix(self):
|
|
140
|
+
data = []
|
|
141
|
+
|
|
142
|
+
for i in range(self.rows):
|
|
143
|
+
row = []
|
|
144
|
+
for j in range(self.columns):
|
|
145
|
+
minor = self._minor(i, j)
|
|
146
|
+
sign = (-1) ** (i + j)
|
|
147
|
+
row.append(sign * minor.det())
|
|
148
|
+
data.append(row)
|
|
149
|
+
|
|
150
|
+
return Matrix.from_list(data)
|
|
151
|
+
|
|
152
|
+
def inverse(self):
|
|
153
|
+
if self.rows != self.columns:
|
|
154
|
+
raise ValueError("Inverse only defined for square matrices")
|
|
155
|
+
|
|
156
|
+
det = self.det()
|
|
157
|
+
|
|
158
|
+
if det == 0:
|
|
159
|
+
raise ValueError("Matrix is singular (no inverse)")
|
|
160
|
+
|
|
161
|
+
# Special case: 1x1
|
|
162
|
+
if self.rows == 1:
|
|
163
|
+
return Matrix.from_list([[1 / self[0, 0]]])
|
|
164
|
+
|
|
165
|
+
cofactor = self._cofactor_matrix()
|
|
166
|
+
adjoint = cofactor.transpose()
|
|
167
|
+
|
|
168
|
+
# Multiply by 1/det
|
|
169
|
+
return adjoint*(1 / det)
|
|
170
|
+
|
|
171
|
+
def __truediv__(self, other):
|
|
172
|
+
return self*other.inverse()
|
|
173
|
+
|
|
174
|
+
def __pow__(self, other):
|
|
175
|
+
if not isinstance(other, int):
|
|
176
|
+
raise ValueError("exponent is not a number")
|
|
177
|
+
else:
|
|
178
|
+
p = Matrix(self.rows,self.columns)
|
|
179
|
+
p.identity()
|
|
180
|
+
for i in range(other):
|
|
181
|
+
p *= self
|
|
182
|
+
return p
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
from AxiomX.constants import *
|
|
2
|
+
from AxiomX.functions import *
|
|
3
|
+
|
|
1
4
|
def radians(deg):
|
|
2
5
|
return (pi/180)*deg
|
|
3
6
|
|
|
@@ -18,7 +21,6 @@ def sin(x, terms=20):
|
|
|
18
21
|
for n in range(terms):
|
|
19
22
|
term = ((-1)**n) * (x**(2*n + 1)) / factorial(2*n + 1)
|
|
20
23
|
sine_value += term
|
|
21
|
-
return sine_value
|
|
22
24
|
if quarter == 1:
|
|
23
25
|
return sine_value
|
|
24
26
|
elif quarter == 2:
|
|
@@ -32,15 +34,23 @@ def cos(x):
|
|
|
32
34
|
return sin((pi/2)-x)
|
|
33
35
|
|
|
34
36
|
def tan(x):
|
|
37
|
+
if cos(x) == 0:
|
|
38
|
+
return float("inf")
|
|
35
39
|
return sin(x) / cos(x)
|
|
36
40
|
|
|
37
41
|
def cot(x):
|
|
42
|
+
if tan(x) == 0:
|
|
43
|
+
return float("inf")
|
|
38
44
|
return 1 / tan(x)
|
|
39
45
|
|
|
40
46
|
def sec(x):
|
|
47
|
+
if cos(x) == 0:
|
|
48
|
+
return float("inf")
|
|
41
49
|
return 1 / cos(x)
|
|
42
50
|
|
|
43
51
|
def cosec(x):
|
|
52
|
+
if sin(x) == 0:
|
|
53
|
+
return float("inf")
|
|
44
54
|
return 1 / sin(x)
|
|
45
55
|
|
|
46
56
|
def arcsin(x, iterations=10):
|
|
@@ -48,6 +58,8 @@ def arcsin(x, iterations=10):
|
|
|
48
58
|
raise ValueError("x must be in [-1, 1]")
|
|
49
59
|
y = x
|
|
50
60
|
for _ in range(iterations):
|
|
61
|
+
if cos(y) == 0:
|
|
62
|
+
break
|
|
51
63
|
y -= (sin(y) - x) / cos(y)
|
|
52
64
|
return y
|
|
53
65
|
|
|
@@ -61,7 +73,11 @@ def arccot(x):
|
|
|
61
73
|
return (pi/2) - arctan(x)
|
|
62
74
|
|
|
63
75
|
def arcsec(x):
|
|
76
|
+
if x < 1:
|
|
77
|
+
raise ValueError("x < 1")
|
|
64
78
|
return arccos(1/x)
|
|
65
79
|
|
|
66
80
|
def arccosec(x):
|
|
81
|
+
if x < 1:
|
|
82
|
+
raise ValueError("x < 1")
|
|
67
83
|
return arcsin(1/x)
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: AxiomX
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: A dynamic Python math library containing numerous mathematical functions implemented from scratch.
|
|
5
|
+
Author: Eric Joseph
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=2.7
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
Dynamic: requires-python
|
|
12
|
+
|
|
13
|
+
# 🔢 AxiomX
|
|
14
|
+
|
|
15
|
+
**AxiomX** is a lightweight, pure-Python mathematical library built from
|
|
16
|
+
first principles --- designed for accuracy, learning, and mathematical
|
|
17
|
+
exploration.
|
|
18
|
+
|
|
19
|
+
------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
## 📢 Community
|
|
22
|
+
|
|
23
|
+
Join Discord for updates and feature requests. Join [here](https://discord.gg/CrEf8mDB).
|
|
24
|
+
|
|
25
|
+
------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
## 🚀 Features
|
|
28
|
+
|
|
29
|
+
### 📐 Core Mathematics
|
|
30
|
+
|
|
31
|
+
- Constants (π, e, φ, √2, γ, ...)
|
|
32
|
+
- Custom implementations
|
|
33
|
+
|
|
34
|
+
### 📈 Exponential & Logarithmic
|
|
35
|
+
|
|
36
|
+
- exp(x)
|
|
37
|
+
- ln(x)
|
|
38
|
+
- log10(x)
|
|
39
|
+
- log2(x)
|
|
40
|
+
- log(arg, base)
|
|
41
|
+
|
|
42
|
+
### 📐 Trigonometry
|
|
43
|
+
|
|
44
|
+
- sin, cos, tan, cot, sec, cosec
|
|
45
|
+
- inverse functions
|
|
46
|
+
|
|
47
|
+
### 🔢 Hyperbolic Functions
|
|
48
|
+
|
|
49
|
+
- sinh, cosh, tanh, coth
|
|
50
|
+
|
|
51
|
+
### 🧮 General Functions
|
|
52
|
+
|
|
53
|
+
- absolute(x)
|
|
54
|
+
- sqrt(x)
|
|
55
|
+
- gamma(x)
|
|
56
|
+
- cbrt(x)
|
|
57
|
+
- zeta(n) and beta(n)
|
|
58
|
+
|
|
59
|
+
### ∫ Calculus
|
|
60
|
+
|
|
61
|
+
- Numerical integration
|
|
62
|
+
- summation
|
|
63
|
+
- convergence analysis
|
|
64
|
+
- limit evaluation
|
|
65
|
+
|
|
66
|
+
------------------------------------------------------------------------
|
|
67
|
+
|
|
68
|
+
## 🧱 Matrix Engine (NEW)
|
|
69
|
+
|
|
70
|
+
- Matrix creation
|
|
71
|
+
- A\[i, j\] access
|
|
72
|
+
- Addition, subtraction, multiplication by using actual mathematical operators.
|
|
73
|
+
- Transpose
|
|
74
|
+
- Determinant
|
|
75
|
+
- Inverse
|
|
76
|
+
- Division (via inverse) by using / operator
|
|
77
|
+
|
|
78
|
+
If you want to create a zero matrix or identity of any order, you can do it this way:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
from AxiomX.matrix import Matrix
|
|
82
|
+
|
|
83
|
+
a = Matrix(x,y) # you can put your values in place of x and y.
|
|
84
|
+
a.zero() # for zero matrix
|
|
85
|
+
a.identity() # for identity matrix.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
If you want to create a matrix, from a list, you can try it this way:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
from AxiomX.matrix import Matrix
|
|
92
|
+
|
|
93
|
+
a = Matrix.from_list([]) # enter your matrix in it.
|
|
94
|
+
```
|
|
95
|
+
------------------------------------------------------------------------
|
|
96
|
+
|
|
97
|
+
## 📦 Installation
|
|
98
|
+
|
|
99
|
+
`pip install axiomx`
|
|
100
|
+
|
|
101
|
+
------------------------------------------------------------------------
|
|
102
|
+
|
|
103
|
+
## ▶️ Usage
|
|
104
|
+
```
|
|
105
|
+
from AxiomX.matrix import Matrix
|
|
106
|
+
|
|
107
|
+
A = Matrix.from_list(\[\[1, 2\], \[3, 4\]\]) print(A.det())
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
------------------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
## 🧠 Philosophy
|
|
113
|
+
|
|
114
|
+
Accuracy \> Speed
|
|
115
|
+
|
|
116
|
+
------------------------------------------------------------------------
|
|
117
|
+
|
|
118
|
+
## 🌐 Website
|
|
119
|
+
|
|
120
|
+
https://axiomxpy.wordpress.com
|
|
121
|
+
|
|
122
|
+
------------------------------------------------------------------------
|
|
123
|
+
|
|
124
|
+
## 🛣️ Roadmap
|
|
125
|
+
|
|
126
|
+
- Advanced linear algebra
|
|
127
|
+
- Series & constants
|
|
128
|
+
|
|
129
|
+
------------------------------------------------------------------------
|
|
130
|
+
|
|
131
|
+
## 📜 License
|
|
132
|
+
|
|
133
|
+
MIT License
|
axiomx-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: AxiomX
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: A dynamic Python math library containing numerous mathematical functions implemented from scratch.
|
|
5
|
+
Author: Eric Joseph
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=2.7
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Dynamic: license-file
|
|
11
|
+
Dynamic: requires-python
|
|
12
|
+
|
|
13
|
+
# 🔢 AxiomX
|
|
14
|
+
|
|
15
|
+
**AxiomX** is a lightweight, pure-Python mathematical library built from
|
|
16
|
+
first principles --- designed for accuracy, learning, and mathematical
|
|
17
|
+
exploration.
|
|
18
|
+
|
|
19
|
+
------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
## 📢 Community
|
|
22
|
+
|
|
23
|
+
Join Discord for updates and feature requests. Join [here](https://discord.gg/CrEf8mDB).
|
|
24
|
+
|
|
25
|
+
------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
## 🚀 Features
|
|
28
|
+
|
|
29
|
+
### 📐 Core Mathematics
|
|
30
|
+
|
|
31
|
+
- Constants (π, e, φ, √2, γ, ...)
|
|
32
|
+
- Custom implementations
|
|
33
|
+
|
|
34
|
+
### 📈 Exponential & Logarithmic
|
|
35
|
+
|
|
36
|
+
- exp(x)
|
|
37
|
+
- ln(x)
|
|
38
|
+
- log10(x)
|
|
39
|
+
- log2(x)
|
|
40
|
+
- log(arg, base)
|
|
41
|
+
|
|
42
|
+
### 📐 Trigonometry
|
|
43
|
+
|
|
44
|
+
- sin, cos, tan, cot, sec, cosec
|
|
45
|
+
- inverse functions
|
|
46
|
+
|
|
47
|
+
### 🔢 Hyperbolic Functions
|
|
48
|
+
|
|
49
|
+
- sinh, cosh, tanh, coth
|
|
50
|
+
|
|
51
|
+
### 🧮 General Functions
|
|
52
|
+
|
|
53
|
+
- absolute(x)
|
|
54
|
+
- sqrt(x)
|
|
55
|
+
- gamma(x)
|
|
56
|
+
- cbrt(x)
|
|
57
|
+
- zeta(n) and beta(n)
|
|
58
|
+
|
|
59
|
+
### ∫ Calculus
|
|
60
|
+
|
|
61
|
+
- Numerical integration
|
|
62
|
+
- summation
|
|
63
|
+
- convergence analysis
|
|
64
|
+
- limit evaluation
|
|
65
|
+
|
|
66
|
+
------------------------------------------------------------------------
|
|
67
|
+
|
|
68
|
+
## 🧱 Matrix Engine (NEW)
|
|
69
|
+
|
|
70
|
+
- Matrix creation
|
|
71
|
+
- A\[i, j\] access
|
|
72
|
+
- Addition, subtraction, multiplication by using actual mathematical operators.
|
|
73
|
+
- Transpose
|
|
74
|
+
- Determinant
|
|
75
|
+
- Inverse
|
|
76
|
+
- Division (via inverse) by using / operator
|
|
77
|
+
|
|
78
|
+
If you want to create a zero matrix or identity of any order, you can do it this way:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
from AxiomX.matrix import Matrix
|
|
82
|
+
|
|
83
|
+
a = Matrix(x,y) # you can put your values in place of x and y.
|
|
84
|
+
a.zero() # for zero matrix
|
|
85
|
+
a.identity() # for identity matrix.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
If you want to create a matrix, from a list, you can try it this way:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
from AxiomX.matrix import Matrix
|
|
92
|
+
|
|
93
|
+
a = Matrix.from_list([]) # enter your matrix in it.
|
|
94
|
+
```
|
|
95
|
+
------------------------------------------------------------------------
|
|
96
|
+
|
|
97
|
+
## 📦 Installation
|
|
98
|
+
|
|
99
|
+
`pip install axiomx`
|
|
100
|
+
|
|
101
|
+
------------------------------------------------------------------------
|
|
102
|
+
|
|
103
|
+
## ▶️ Usage
|
|
104
|
+
```
|
|
105
|
+
from AxiomX.matrix import Matrix
|
|
106
|
+
|
|
107
|
+
A = Matrix.from_list(\[\[1, 2\], \[3, 4\]\]) print(A.det())
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
------------------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
## 🧠 Philosophy
|
|
113
|
+
|
|
114
|
+
Accuracy \> Speed
|
|
115
|
+
|
|
116
|
+
------------------------------------------------------------------------
|
|
117
|
+
|
|
118
|
+
## 🌐 Website
|
|
119
|
+
|
|
120
|
+
https://axiomxpy.wordpress.com
|
|
121
|
+
|
|
122
|
+
------------------------------------------------------------------------
|
|
123
|
+
|
|
124
|
+
## 🛣️ Roadmap
|
|
125
|
+
|
|
126
|
+
- Advanced linear algebra
|
|
127
|
+
- Series & constants
|
|
128
|
+
|
|
129
|
+
------------------------------------------------------------------------
|
|
130
|
+
|
|
131
|
+
## 📜 License
|
|
132
|
+
|
|
133
|
+
MIT License
|
axiomx-0.1.2/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# 🔢 AxiomX
|
|
2
|
+
|
|
3
|
+
**AxiomX** is a lightweight, pure-Python mathematical library built from
|
|
4
|
+
first principles --- designed for accuracy, learning, and mathematical
|
|
5
|
+
exploration.
|
|
6
|
+
|
|
7
|
+
------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
## 📢 Community
|
|
10
|
+
|
|
11
|
+
Join Discord for updates and feature requests. Join [here](https://discord.gg/CrEf8mDB).
|
|
12
|
+
|
|
13
|
+
------------------------------------------------------------------------
|
|
14
|
+
|
|
15
|
+
## 🚀 Features
|
|
16
|
+
|
|
17
|
+
### 📐 Core Mathematics
|
|
18
|
+
|
|
19
|
+
- Constants (π, e, φ, √2, γ, ...)
|
|
20
|
+
- Custom implementations
|
|
21
|
+
|
|
22
|
+
### 📈 Exponential & Logarithmic
|
|
23
|
+
|
|
24
|
+
- exp(x)
|
|
25
|
+
- ln(x)
|
|
26
|
+
- log10(x)
|
|
27
|
+
- log2(x)
|
|
28
|
+
- log(arg, base)
|
|
29
|
+
|
|
30
|
+
### 📐 Trigonometry
|
|
31
|
+
|
|
32
|
+
- sin, cos, tan, cot, sec, cosec
|
|
33
|
+
- inverse functions
|
|
34
|
+
|
|
35
|
+
### 🔢 Hyperbolic Functions
|
|
36
|
+
|
|
37
|
+
- sinh, cosh, tanh, coth
|
|
38
|
+
|
|
39
|
+
### 🧮 General Functions
|
|
40
|
+
|
|
41
|
+
- absolute(x)
|
|
42
|
+
- sqrt(x)
|
|
43
|
+
- gamma(x)
|
|
44
|
+
- cbrt(x)
|
|
45
|
+
- zeta(n) and beta(n)
|
|
46
|
+
|
|
47
|
+
### ∫ Calculus
|
|
48
|
+
|
|
49
|
+
- Numerical integration
|
|
50
|
+
- summation
|
|
51
|
+
- convergence analysis
|
|
52
|
+
- limit evaluation
|
|
53
|
+
|
|
54
|
+
------------------------------------------------------------------------
|
|
55
|
+
|
|
56
|
+
## 🧱 Matrix Engine (NEW)
|
|
57
|
+
|
|
58
|
+
- Matrix creation
|
|
59
|
+
- A\[i, j\] access
|
|
60
|
+
- Addition, subtraction, multiplication by using actual mathematical operators.
|
|
61
|
+
- Transpose
|
|
62
|
+
- Determinant
|
|
63
|
+
- Inverse
|
|
64
|
+
- Division (via inverse) by using / operator
|
|
65
|
+
|
|
66
|
+
If you want to create a zero matrix or identity of any order, you can do it this way:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
from AxiomX.matrix import Matrix
|
|
70
|
+
|
|
71
|
+
a = Matrix(x,y) # you can put your values in place of x and y.
|
|
72
|
+
a.zero() # for zero matrix
|
|
73
|
+
a.identity() # for identity matrix.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
If you want to create a matrix, from a list, you can try it this way:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
from AxiomX.matrix import Matrix
|
|
80
|
+
|
|
81
|
+
a = Matrix.from_list([]) # enter your matrix in it.
|
|
82
|
+
```
|
|
83
|
+
------------------------------------------------------------------------
|
|
84
|
+
|
|
85
|
+
## 📦 Installation
|
|
86
|
+
|
|
87
|
+
`pip install axiomx`
|
|
88
|
+
|
|
89
|
+
------------------------------------------------------------------------
|
|
90
|
+
|
|
91
|
+
## ▶️ Usage
|
|
92
|
+
```
|
|
93
|
+
from AxiomX.matrix import Matrix
|
|
94
|
+
|
|
95
|
+
A = Matrix.from_list(\[\[1, 2\], \[3, 4\]\]) print(A.det())
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
------------------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
## 🧠 Philosophy
|
|
101
|
+
|
|
102
|
+
Accuracy \> Speed
|
|
103
|
+
|
|
104
|
+
------------------------------------------------------------------------
|
|
105
|
+
|
|
106
|
+
## 🌐 Website
|
|
107
|
+
|
|
108
|
+
https://axiomxpy.wordpress.com
|
|
109
|
+
|
|
110
|
+
------------------------------------------------------------------------
|
|
111
|
+
|
|
112
|
+
## 🛣️ Roadmap
|
|
113
|
+
|
|
114
|
+
- Advanced linear algebra
|
|
115
|
+
- Series & constants
|
|
116
|
+
|
|
117
|
+
------------------------------------------------------------------------
|
|
118
|
+
|
|
119
|
+
## 📜 License
|
|
120
|
+
|
|
121
|
+
MIT License
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="AxiomX", # rename to your project name
|
|
5
|
-
version="0.1.
|
|
5
|
+
version="0.1.2",
|
|
6
6
|
description="A custom Python math library with special functions.",
|
|
7
7
|
author="Eric Joseph", # change if needed
|
|
8
8
|
packages=find_packages(),
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# integrating integrals
|
|
2
|
-
def integrate(function, lowlim, uplim, n=10000):
|
|
3
|
-
h = (uplim - lowlim) / n
|
|
4
|
-
s = function(lowlim) + function(uplim)
|
|
5
|
-
|
|
6
|
-
for i in range(1, n):
|
|
7
|
-
x = lowlim + i * h
|
|
8
|
-
if i % 2 == 0:
|
|
9
|
-
s += 2 * function(x)
|
|
10
|
-
else:
|
|
11
|
-
s += 4 * function(x)
|
|
12
|
-
|
|
13
|
-
return s * h / 3
|
|
14
|
-
|
|
15
|
-
def summation(lowlim, uplim, function):
|
|
16
|
-
sum = 0
|
|
17
|
-
for _ in range(lowlim, uplim + 1):
|
|
18
|
-
sum += function(_)
|
|
19
|
-
return sum
|
|
20
|
-
|
|
21
|
-
def converges(f):
|
|
22
|
-
if (f(2) == 0.5):
|
|
23
|
-
return False
|
|
24
|
-
try:
|
|
25
|
-
n1 = 10**5
|
|
26
|
-
n2 = 10**6
|
|
27
|
-
|
|
28
|
-
a1 = abs(f(n1))
|
|
29
|
-
a2 = abs(f(n2))
|
|
30
|
-
|
|
31
|
-
# 1) nth-term test (stronger)
|
|
32
|
-
if a2 > 1e-3:
|
|
33
|
-
return False
|
|
34
|
-
|
|
35
|
-
# 2) Ratio test
|
|
36
|
-
if a1 != 0:
|
|
37
|
-
L = abs(a2 / a1)
|
|
38
|
-
if L < 0.9:
|
|
39
|
-
return True
|
|
40
|
-
if L > 1.1:
|
|
41
|
-
return False
|
|
42
|
-
|
|
43
|
-
# 3) Alternating test
|
|
44
|
-
if f(1000) * f(1001) < 0 and a2 < a1:
|
|
45
|
-
return "Conditional"
|
|
46
|
-
|
|
47
|
-
# 4) Partial sum growth test
|
|
48
|
-
S1 = sum(f(n) for n in range(1,2000))
|
|
49
|
-
S2 = sum(f(n) for n in range(1,4000))
|
|
50
|
-
|
|
51
|
-
if abs(S2) > abs(S1) * 1.2:
|
|
52
|
-
return False
|
|
53
|
-
|
|
54
|
-
if abs(S2 - S1) < 1e-3:
|
|
55
|
-
return True
|
|
56
|
-
|
|
57
|
-
except:
|
|
58
|
-
return "Inconclusive"
|
|
59
|
-
|
|
60
|
-
return "Inconclusive"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: AxiomX
|
|
3
|
-
Version: 0.1.0.dev8
|
|
4
|
-
Summary: A dynamic Python math library containing numerous mathematical functions implemented from scratch.
|
|
5
|
-
Author: Eric Joseph
|
|
6
|
-
License: MIT
|
|
7
|
-
Requires-Python: >=2.7
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Dynamic: license-file
|
|
11
|
-
Dynamic: requires-python
|
|
12
|
-
|
|
13
|
-
# AxiomX 0.1.0.dev8
|
|
14
|
-
|
|
15
|
-
AxiomX is proud to release the 0.1.0.dev8 bugfix release. We're extremely sorry for the inconvenience we have caused. We had realized about a bug running in our module. We have fixed it and as this is a bugfix release, we have not added anything new.
|
|
16
|
-
\
|
|
17
|
-
\
|
|
18
|
-
This module is licensed under MIT. No one is allowed to copy code from AxiomX. Hope you all enjoy AxiomX.
|
axiomx-0.1.0.dev8/PKG-INFO
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: AxiomX
|
|
3
|
-
Version: 0.1.0.dev8
|
|
4
|
-
Summary: A dynamic Python math library containing numerous mathematical functions implemented from scratch.
|
|
5
|
-
Author: Eric Joseph
|
|
6
|
-
License: MIT
|
|
7
|
-
Requires-Python: >=2.7
|
|
8
|
-
Description-Content-Type: text/markdown
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
Dynamic: license-file
|
|
11
|
-
Dynamic: requires-python
|
|
12
|
-
|
|
13
|
-
# AxiomX 0.1.0.dev8
|
|
14
|
-
|
|
15
|
-
AxiomX is proud to release the 0.1.0.dev8 bugfix release. We're extremely sorry for the inconvenience we have caused. We had realized about a bug running in our module. We have fixed it and as this is a bugfix release, we have not added anything new.
|
|
16
|
-
\
|
|
17
|
-
\
|
|
18
|
-
This module is licensed under MIT. No one is allowed to copy code from AxiomX. Hope you all enjoy AxiomX.
|
axiomx-0.1.0.dev8/README.md
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# AxiomX 0.1.0.dev8
|
|
2
|
-
|
|
3
|
-
AxiomX is proud to release the 0.1.0.dev8 bugfix release. We're extremely sorry for the inconvenience we have caused. We had realized about a bug running in our module. We have fixed it and as this is a bugfix release, we have not added anything new.
|
|
4
|
-
\
|
|
5
|
-
\
|
|
6
|
-
This module is licensed under MIT. No one is allowed to copy code from AxiomX. Hope you all enjoy AxiomX.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|