mathai 0.6.3__py3-none-any.whl → 0.6.4__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/base.py +3 -0
- mathai/matrix.py +22 -5
- mathai/simplify.py +0 -1
- {mathai-0.6.3.dist-info → mathai-0.6.4.dist-info}/METADATA +1 -1
- {mathai-0.6.3.dist-info → mathai-0.6.4.dist-info}/RECORD +7 -7
- {mathai-0.6.3.dist-info → mathai-0.6.4.dist-info}/WHEEL +0 -0
- {mathai-0.6.3.dist-info → mathai-0.6.4.dist-info}/top_level.txt +0 -0
mathai/base.py
CHANGED
mathai/matrix.py
CHANGED
|
@@ -60,6 +60,13 @@ def contains_neg(node):
|
|
|
60
60
|
return True
|
|
61
61
|
# ---------- multiplication (fully simplified) ----------
|
|
62
62
|
def multiply(left,right):
|
|
63
|
+
left2, right2 = left, right
|
|
64
|
+
if left2.name != "f_pow":
|
|
65
|
+
left2 = left2 ** 1
|
|
66
|
+
if right2.name != "f_pow":
|
|
67
|
+
right2 = right2 ** 1
|
|
68
|
+
if left2.name == "f_pow" and right2.name == "f_pow" and left2.children[0]==right2.children[0]:
|
|
69
|
+
return simplify(left2.children[0]**(left2.children[1]+right2.children[1]))
|
|
63
70
|
A,B = promote(left), promote(right)
|
|
64
71
|
|
|
65
72
|
# vector · vector
|
|
@@ -79,23 +86,33 @@ def multiply(left,right):
|
|
|
79
86
|
return None
|
|
80
87
|
|
|
81
88
|
def fold_wmul(eq):
|
|
82
|
-
if eq.name=="
|
|
89
|
+
if eq.name == "f_pow" and eq.children[1].name.startswith("d_"):
|
|
90
|
+
n = int(eq.children[1].name[2:])
|
|
91
|
+
if n == 1:
|
|
92
|
+
eq = eq.children[0]
|
|
93
|
+
elif n > 1:
|
|
94
|
+
tmp = promote(eq.children[0])
|
|
95
|
+
if is_matrix(tmp):
|
|
96
|
+
orig =tmp
|
|
97
|
+
for i in range(n-1):
|
|
98
|
+
tmp = matmul(orig, tmp)
|
|
99
|
+
eq = py_to_tree(tmp)
|
|
100
|
+
elif eq.name=="f_wmul":
|
|
101
|
+
|
|
83
102
|
i = len(eq.children)-1
|
|
84
103
|
while i>0:
|
|
85
104
|
out = multiply(eq.children[i], eq.children[i-1])
|
|
86
105
|
if out is not None:
|
|
87
106
|
eq.children.pop(i)
|
|
88
107
|
eq.children.pop(i-1)
|
|
89
|
-
eq.children.
|
|
108
|
+
eq.children.insert(i-1,out)
|
|
90
109
|
i = i-1
|
|
91
|
-
return eq
|
|
92
110
|
return TreeNode(eq.name, [fold_wmul(child) for child in eq.children])
|
|
93
111
|
def flat(eq):
|
|
94
|
-
return flatten_tree(
|
|
112
|
+
return flatten_tree(eq, ["f_wmul"])
|
|
95
113
|
def matrix_solve(eq):
|
|
96
114
|
if TreeNode.matmul == True:
|
|
97
115
|
TreeNode.matmul = False
|
|
98
|
-
eq = simplify(eq)
|
|
99
116
|
eq = flat(dowhile(eq, lambda x: fold_wmul(flat(x))))
|
|
100
117
|
TreeNode.matmul = True
|
|
101
118
|
return eq
|
mathai/simplify.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
mathai/__init__.py,sha256=gzddzgNCG3Bg5BnqrDYvO71SzK4hu9fbo4nGEaDaG5Q,1554
|
|
2
2
|
mathai/apart.py,sha256=VSS3khE9PNuxiRvdU5JDl4IN-KJBSIFjwR17pkhviXI,4197
|
|
3
|
-
mathai/base.py,sha256=
|
|
3
|
+
mathai/base.py,sha256=HSmUAUAVlKhjn-i3_IDoduyRzNrhw9kTHDgpUpahdK8,15660
|
|
4
4
|
mathai/bivariate_inequality.py,sha256=Da-A1kqVynR0tNOlEI7GSTf5T2vNkcF4etL9-EoyPJg,11415
|
|
5
5
|
mathai/console.py,sha256=Sn58iwYE79MLEh67s8X3q6vZjw6g7f9XM1T8_dBBR2o,3048
|
|
6
6
|
mathai/diff.py,sha256=RSTwlfeddvYXUDShCeRdcPjsmAS8Vf5OkYJAaUBPaiM,3060
|
|
@@ -12,17 +12,17 @@ mathai/inverse.py,sha256=ya7P8WjzfaAL3UXL7xqOh5GaIsXLDZ-F6lZFy3IEgaQ,2931
|
|
|
12
12
|
mathai/limit.py,sha256=9F8i9UZh2xb-V8A5Sd1gdhDf9c2RFgpE1GdNn9MvbWI,5703
|
|
13
13
|
mathai/linear.py,sha256=viGlPU8BPrjLWHlyNUvnfPHNH5d4ZBImiQMdyXaKGg0,5702
|
|
14
14
|
mathai/logic.py,sha256=Ndz4Fd6aNCmzFlqoPyyIpSmV_BXmYHsurePjLyZJoNc,9809
|
|
15
|
-
mathai/matrix.py,sha256=
|
|
15
|
+
mathai/matrix.py,sha256=gExDBHre3f2JTkj63-58b2YKnlLhqVYszOaNTvG9maE,3927
|
|
16
16
|
mathai/ode.py,sha256=zxxTXAOpt7oSsfpgI4vHsCWKXevmM96ZOBZWWs-vj8Y,4801
|
|
17
17
|
mathai/parser.py,sha256=dhI4hRiYDdmSAOrhIWkBs_Boo2BFzC1m5cbAOOfHUas,7220
|
|
18
18
|
mathai/parsetab.py,sha256=TL-4jvRM_Tx6ipwet8CFJc2DkjR4tGsbrGF_r4IC8xI,9651
|
|
19
19
|
mathai/printeq.py,sha256=MKsR6-qXig80R07vLnFPYHQMeS41FrMVj3n3arrhJpQ,1329
|
|
20
|
-
mathai/simplify.py,sha256=
|
|
20
|
+
mathai/simplify.py,sha256=nvpwTLEgnGeXgc9NGGmQLAjKZ9c4XTdEVqAuo04oSrw,19588
|
|
21
21
|
mathai/structure.py,sha256=wrU7kqphSN7CqaVffyHHXD2-3t5My_Z_TtYFoUe_lTU,4099
|
|
22
22
|
mathai/tool.py,sha256=ozcXTXLbKUnyPM9r9kz9M43YA2CBcWezcqLZfEs8rpc,6051
|
|
23
23
|
mathai/trig.py,sha256=fnBbfiopcQzFg4ya1BoO5M0X_aCBnse2bjnKh1juw4I,11223
|
|
24
24
|
mathai/univariate_inequality.py,sha256=LPFdWgC1y5zBwnsy1wwZxj-yP_SbqFDhCmTTzhuwoiY,16469
|
|
25
|
-
mathai-0.6.
|
|
26
|
-
mathai-0.6.
|
|
27
|
-
mathai-0.6.
|
|
28
|
-
mathai-0.6.
|
|
25
|
+
mathai-0.6.4.dist-info/METADATA,sha256=vj85R6gzXafAT_M4LhpjwqOp_Ru32chy8M2SMiZGzaU,7103
|
|
26
|
+
mathai-0.6.4.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
27
|
+
mathai-0.6.4.dist-info/top_level.txt,sha256=ROP4l3OhGYw3ihkQGASr18xM9GsK4z3_6whV5AyXLwE,7
|
|
28
|
+
mathai-0.6.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|