mathai 0.8.0__py3-none-any.whl → 0.8.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.
- mathai/apart.py +5 -2
- mathai/base.py +1 -1
- mathai/linear.py +8 -4
- {mathai-0.8.0.dist-info → mathai-0.8.1.dist-info}/METADATA +1 -1
- {mathai-0.8.0.dist-info → mathai-0.8.1.dist-info}/RECORD +7 -7
- {mathai-0.8.0.dist-info → mathai-0.8.1.dist-info}/WHEEL +0 -0
- {mathai-0.8.0.dist-info → mathai-0.8.1.dist-info}/top_level.txt +0 -0
mathai/apart.py
CHANGED
|
@@ -107,13 +107,14 @@ def _apart(eq, v=None):
|
|
|
107
107
|
|
|
108
108
|
lst = poly(s.children[0], v)
|
|
109
109
|
|
|
110
|
-
lst = [TreeNode("f_eq", [item, tree_form("d_0")]) for item in lst if "v_" in str_form(item)]
|
|
110
|
+
lst = [simplify(TreeNode("f_eq", [item, tree_form("d_0")])) for item in lst if "v_" in str_form(item)]
|
|
111
111
|
lst2 = []
|
|
112
112
|
for item in lst:
|
|
113
113
|
lst2+=vlist(item)
|
|
114
114
|
origv = list(set(lst2)-set(origv))
|
|
115
115
|
|
|
116
116
|
out = linear_solve(TreeNode("f_and", lst), [tree_form(item) for item in origv])
|
|
117
|
+
|
|
117
118
|
for item in out.children:
|
|
118
119
|
|
|
119
120
|
final3 = replace(final3, tree_form(list(set(vlist(item))&set(origv))[0]), inverse(item.children[0], list(set(vlist(item))&set(origv))[0]))
|
|
@@ -139,4 +140,6 @@ def apart(eq):
|
|
|
139
140
|
return eq2
|
|
140
141
|
|
|
141
142
|
return TreeNode(eq.name, [helper(child) for child in eq.children])
|
|
142
|
-
|
|
143
|
+
eq = helper(eq)
|
|
144
|
+
eq = fx(eq)
|
|
145
|
+
return eq
|
mathai/base.py
CHANGED
|
@@ -334,7 +334,7 @@ def vlist(eq):
|
|
|
334
334
|
out.append(eq.name)
|
|
335
335
|
for child in eq.children:
|
|
336
336
|
out += vlist(child)
|
|
337
|
-
return sorted(list(set(out)), key=lambda x: int(x[2:]))
|
|
337
|
+
return list(sorted(list(set(out)), key=lambda x: int(x[2:])))
|
|
338
338
|
def product(lst):
|
|
339
339
|
if lst == []:
|
|
340
340
|
return tree_form("d_1")
|
mathai/linear.py
CHANGED
|
@@ -8,7 +8,7 @@ from .base import *
|
|
|
8
8
|
from .factor import factorconst
|
|
9
9
|
from .tool import poly
|
|
10
10
|
def ss(eq):
|
|
11
|
-
return dowhile(eq, lambda x: fraction(
|
|
11
|
+
return dowhile(eq, lambda x: fraction(simplify(x)))
|
|
12
12
|
def rref(matrix):
|
|
13
13
|
rows, cols = len(matrix), len(matrix[0])
|
|
14
14
|
lead = 0
|
|
@@ -34,12 +34,14 @@ def rref(matrix):
|
|
|
34
34
|
return matrix
|
|
35
35
|
def islinear(eq, fxconst):
|
|
36
36
|
eq =simplify(eq)
|
|
37
|
-
if all(fxconst(tree_form(item)) and poly(eq, item) is not None and len(poly(eq, item)) <= 2
|
|
37
|
+
if all(not fxconst(tree_form(item)) or (fxconst(tree_form(item)) and poly(eq, item) is not None and len(poly(eq, item)) <= 2)for item in vlist(eq)):
|
|
38
38
|
return True
|
|
39
|
+
else:
|
|
40
|
+
pass
|
|
39
41
|
return False
|
|
40
42
|
def linear(eqlist, fxconst):
|
|
41
43
|
orig = [item.copy_tree() for item in eqlist]
|
|
42
|
-
|
|
44
|
+
|
|
43
45
|
if eqlist == [] or not all(islinear(eq, fxconst) for eq in eqlist):
|
|
44
46
|
return None
|
|
45
47
|
|
|
@@ -53,10 +55,11 @@ def linear(eqlist, fxconst):
|
|
|
53
55
|
for eq in eqlist:
|
|
54
56
|
varlist(eq, fxconst)
|
|
55
57
|
vl = list(set(vl))
|
|
56
|
-
|
|
58
|
+
|
|
57
59
|
if len(vl) > len(eqlist):
|
|
58
60
|
return TreeNode("f_and", [TreeNode("f_eq", [x, tree_form("d_0")]) for x in eqlist])
|
|
59
61
|
m = []
|
|
62
|
+
|
|
60
63
|
for eq in eqlist:
|
|
61
64
|
s = copy.deepcopy(eq)
|
|
62
65
|
row = []
|
|
@@ -149,6 +152,7 @@ def linear_solve(eq, lst=None):
|
|
|
149
152
|
if lst is None:
|
|
150
153
|
out = linear(copy.deepcopy(eqlist), lambda x: "v_" in str_form(x))
|
|
151
154
|
else:
|
|
155
|
+
|
|
152
156
|
out = linear(copy.deepcopy(eqlist), lambda x: any(contain(x, item) for item in lst))
|
|
153
157
|
if out is None:
|
|
154
158
|
return None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
mathai/__init__.py,sha256=JdRPSes54qhzvi6f8Rni2sXljzzirrWZsaCmu9W9rws,1525
|
|
2
|
-
mathai/apart.py,sha256=
|
|
3
|
-
mathai/base.py,sha256=
|
|
2
|
+
mathai/apart.py,sha256=CbCX4pAWIaJgu21wZcW9XdEf82oXgxmtTyD3tUI31Ls,4235
|
|
3
|
+
mathai/base.py,sha256=Qp3V5kpEZpg1fM_pB8y5upjkuoIc3I_UUlkhpTj0-3Y,14849
|
|
4
4
|
mathai/bivariate_inequality.py,sha256=Da-A1kqVynR0tNOlEI7GSTf5T2vNkcF4etL9-EoyPJg,11415
|
|
5
5
|
mathai/diff.py,sha256=GEiAGMCTT0dO-ULTUGvTlBKy-Io-r2xcgvFJfmqGurY,6879
|
|
6
6
|
mathai/expand.py,sha256=yioVkQrtCz1fC8npcnokN1WwvJlGxrO1D4aKn8F8ky0,1757
|
|
@@ -9,7 +9,7 @@ mathai/fraction.py,sha256=44RuEPQ8z2CGhnxFXrHIy4MkgaE4QDtu7-sEV12GWjc,2597
|
|
|
9
9
|
mathai/integrate.py,sha256=6Ik_uAzkLyOWCE9M7mqwH_SVTvEdiG0-UYS2KsDgjLI,17454
|
|
10
10
|
mathai/inverse.py,sha256=ya7P8WjzfaAL3UXL7xqOh5GaIsXLDZ-F6lZFy3IEgaQ,2931
|
|
11
11
|
mathai/limit.py,sha256=9F8i9UZh2xb-V8A5Sd1gdhDf9c2RFgpE1GdNn9MvbWI,5703
|
|
12
|
-
mathai/linear.py,sha256=
|
|
12
|
+
mathai/linear.py,sha256=pTo4gXyosUnwG6h5G1zZOMCJPwQaBZyuaeH8XlrBy9o,5219
|
|
13
13
|
mathai/logic.py,sha256=wUenUEcIazQH2jnka43QQ9XpLQgY7x3Rq2QUxzFzf-U,9569
|
|
14
14
|
mathai/matrix.py,sha256=k8gIasxtEF1t_B0mJSbDvUJ3FDddvYI8hhy0FMMQ54k,5416
|
|
15
15
|
mathai/ode.py,sha256=F0Z_Zv2YsnVf4HwIJmqvIenjONaItzy5H739THkLvcU,11616
|
|
@@ -22,7 +22,7 @@ mathai/structure.py,sha256=u4usB0yPnem2VscgEBqKWxRN9Y4tTjymEaQh1de5Bsk,4121
|
|
|
22
22
|
mathai/tool.py,sha256=Wjp8pcBu7MkJr-oAa_bFzKr9mNAB9WrpPISSJd4p-x0,5407
|
|
23
23
|
mathai/trig.py,sha256=tkn6NgfXj5XzjVB261SuX_mx2g3stqNksoco4O6so90,10713
|
|
24
24
|
mathai/univariate_inequality.py,sha256=QoE6lZW_cUXa5sbbvwz88DjAVSY--RZt03w02edCVtA,16375
|
|
25
|
-
mathai-0.8.
|
|
26
|
-
mathai-0.8.
|
|
27
|
-
mathai-0.8.
|
|
28
|
-
mathai-0.8.
|
|
25
|
+
mathai-0.8.1.dist-info/METADATA,sha256=v2DpxYv_i3Tpxv1XmcNGSnX5EgLVShvGyRXFVNR5V6o,7735
|
|
26
|
+
mathai-0.8.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
27
|
+
mathai-0.8.1.dist-info/top_level.txt,sha256=ROP4l3OhGYw3ihkQGASr18xM9GsK4z3_6whV5AyXLwE,7
|
|
28
|
+
mathai-0.8.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|