Skip to content

Commit 832aa36

Browse files
committed
0.0.2b0
1 parent 7fada87 commit 832aa36

File tree

9 files changed

+39
-28
lines changed

9 files changed

+39
-28
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
eggconfig.py
2-
.pypirc
2+
.pypirc
3+
*_pycache__*

eggdriver/resources/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626

2727
square = 2 * segment
2828
whiteSquare = white + square
29-
blackSquare = black + square
29+
blackSquare = black + square

eggdriver/resources/math/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
pi = 3.1415926535897932384626433832795028841971693993751058209749445923078164062
77

88
def itself(var):
9-
return var
9+
return var

eggdriver/resources/math/float.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ def floor(x):
88
return math.floor(x)
99

1010
def ceil(x):
11-
return math.ceil(x)
11+
return math.ceil(x)
12+

eggdriver/resources/math/functions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@ def sin(x):
2525
def tan(x):
2626
def tan_function(x):
2727
return sin(x) / cos(x)
28-
return lim(tan_function, x)
28+
return lim(tan_function, x)

eggdriver/resources/math/polynomial.py

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
from eggdriver.resources.math.linear import Vector, dualExpand, vectorize
22
from eggdriver.resources.math.algorithms.solver import solve
3-
from eggdriver.resources.structures.objects import varName
3+
from eggdriver.resources.structures.objects import var, varName
44

5-
def x(var):
6-
return var
5+
x = var("x")
6+
7+
from eggdriver.resources.math.linear import Vector, dualExpand, vectorize
8+
from eggdriver.resources.math.algorithms.solver import solve
9+
from eggdriver.resources.structures.objects import varName
710

811
class Polynomial(Vector):
912
def __init__(self, poly = [], variable = x):
@@ -42,14 +45,11 @@ def eval(self, x):
4245
result = 0
4346
for i in range(0, self.size):
4447
f = self[i]
45-
result += f * (self.variable(x) ** i)
48+
result += f * (self.variable.eval(x) ** i)
4649
return result
4750
@property
4851
def var(self):
49-
name = varName(self.variable)
50-
if name != None:
51-
return name
52-
return "x"
52+
return self.variable.var
5353

5454
@property
5555
def zeros(self):
@@ -62,19 +62,19 @@ def degree(self):
6262
deg = i
6363
return deg
6464

65-
def x_powered(i, variable = "x"):
65+
def x_powered(i, variable_str = "x"):
6666
if i == 0 :
6767
return ""
6868
elif i == 1:
69-
return variable
70-
return f"{variable}^{i}"
69+
return variable_str
70+
return f"{variable_str}^{i}"
7171

7272
def plusPoly(a, b):
7373
if type(a) != Polynomial:
7474
a = Polynomial([a])
7575
if type(b) != Polynomial:
7676
b = Polynomial([b])
77-
result = Polynomial()
77+
result = Polynomial([], a.variable)
7878
if len(a) != len(b):
7979
dualExpand(a, b)
8080
if len(a) != 0 and len(a) == len(b):
@@ -83,14 +83,14 @@ def plusPoly(a, b):
8383
return result
8484

8585
def scalePoly(polynomial, scalar):
86-
result = Vector()
86+
result = Polynomial([], polynomial.variable)
8787
if polynomial.size != 0:
8888
for i in polynomial:
8989
result.append(scalar * i)
9090
return result
9191

9292
def times(a, b):
93-
result = Polynomial()
93+
result = Polynomial([], a.variable)
9494
if len(a) != 0:
9595
for i in range(0, len(a)):
9696
product = Polynomial()
@@ -106,5 +106,3 @@ def fromZeros(zeros = []):
106106
for i in zeros:
107107
result = Polynomial([-i, 1]).times(result)
108108
return result
109-
110-

eggdriver/resources/structures/objects.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Imports
2+
from eggdriver.resources.utils import itself
23
from eggdriver.resources.strings import normalize
34

45
"""
@@ -82,8 +83,9 @@ def printVarType(variable):
8283
>>> El camion es mio
8384
"""
8485
class var():
85-
def __init__(self, var):
86+
def __init__(self, var, definition_function = itself):
8687
self.var = var
88+
self.__function__ = definition_function
8789
@property
8890
def float(self):
8991
return float(self.int)
@@ -108,6 +110,12 @@ def bool(self):
108110
@property
109111
def norm(self): # Remove accents from words
110112
return normalize(self.str)
113+
def __str__(self):
114+
return varName(self)
115+
def __repr__(self):
116+
return f"var({str(self.var)}, {str(varName(self.__function__))})"
117+
def eval(self, value):
118+
return self.__function__(value)
111119

112120
if __name__ == "__main__":
113121
If = "you are reading this,"

eggdriver/resources/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ def comment(file):
3232
text = line.split("#")
3333
commentary = text[1]
3434
if commentary.split(" ")[0] == "$doc":
35-
commentary = 3 * "\"" + commentary[5:] + 3 * "\"" """
35+
commentary = 3 * "\"" + commentary[5:] + 3 * "\"" """
36+
37+
def itself(var):
38+
return var

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
v = "0.0.1"
1+
v = "0.0.2b0"
22
"""A setuptools based setup module.
33
See:
44
https://packaging.python.org/guides/distributing-packages-using-setuptools/
@@ -88,7 +88,7 @@
8888
# 3 - Alpha
8989
# 4 - Beta
9090
# 5 - Production/Stable
91-
'Development Status :: 5 - Production/Stable',
91+
'Development Status :: 4 - Beta',
9292

9393
# Indicate who your project is intended for
9494
'Intended Audience :: Developers',
@@ -101,10 +101,10 @@
101101
# that you indicate you support Python 3. These classifiers are *not*
102102
# checked by 'pip install'. See instead 'python_requires' below.
103103
'Programming Language :: Python :: 3',
104+
'Programming Language :: Python :: 3.5',
104105
'Programming Language :: Python :: 3.6',
105106
'Programming Language :: Python :: 3.7',
106107
'Programming Language :: Python :: 3.8',
107-
'Programming Language :: Python :: 3.9',
108108
'Programming Language :: Python :: 3 :: Only',
109109
],
110110

@@ -135,15 +135,15 @@
135135
# 'Programming Language' classifiers above, 'pip install' will check this
136136
# and refuse to install the project if the version does not match. See
137137
# https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires
138-
python_requires = '>=3.6, <4',
138+
python_requires = '>=3.5, <=3.8',
139139

140140
# This field lists other packages that your project depends on to run.
141141
# Any package you put here will be installed by pip when your project is
142142
# installed, so they must be valid existing projects.
143143
#
144144
# For an analysis of "install_requires" vs pip's requirements files see:
145145
# https://packaging.python.org/en/latest/requirements.html
146-
install_requires = ["numpy", "tensorflow", "keras", "Colr", "opencv-contrib-python", "mediapipe", "pipwin"],# + ["nqs"] disabled
146+
install_requires = ["numpy", "tensorflow", "keras", "Colr", "opencv-contrib-python", "mediapipe", "pipwin"],
147147

148148
# List additional groups of dependencies here (e.g. development
149149
# dependencies). Users will be able to install these using the "extras"

0 commit comments

Comments
 (0)