mathai 0.2.4__py3-none-any.whl → 0.2.7__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/simplify.py +5 -2
- mathai/univariate_inequality.py +17 -14
- {mathai-0.2.4.dist-info → mathai-0.2.7.dist-info}/METADATA +1 -1
- {mathai-0.2.4.dist-info → mathai-0.2.7.dist-info}/RECORD +6 -6
- {mathai-0.2.4.dist-info → mathai-0.2.7.dist-info}/WHEEL +0 -0
- {mathai-0.2.4.dist-info → mathai-0.2.7.dist-info}/top_level.txt +0 -0
mathai/simplify.py
CHANGED
@@ -146,14 +146,17 @@ def solve(eq, specialfx=False):
|
|
146
146
|
return dowhile(eq, _solve)
|
147
147
|
def solve2(eq):
|
148
148
|
return solve(eq, True)
|
149
|
-
def clear_div(eq):
|
149
|
+
def clear_div(eq, denom=False):
|
150
150
|
lst = factor_generation(eq)
|
151
151
|
if tree_form("d_0") in lst:
|
152
152
|
return tree_form("d_0")
|
153
153
|
lst3 = [item for item in lst if "v_" not in str_form(item) and compute(item) < 0]
|
154
|
+
|
154
155
|
sign = True
|
155
156
|
if len(lst3) % 2 == 1:
|
156
157
|
sign = False
|
158
|
+
if denom:
|
159
|
+
return eq if sign else -eq, sign
|
157
160
|
lst = [item for item in lst if not(item.name == "f_pow" and frac(item.children[1]) is not None and frac(item.children[1]) == -1)]
|
158
161
|
|
159
162
|
lst2 = [item for item in lst if "v_" in str_form(item)]
|
@@ -168,7 +171,7 @@ def simplify(eq):
|
|
168
171
|
return TreeNode(eq.name, [simplify(child) for child in eq.children])
|
169
172
|
|
170
173
|
if eq.name in ["f_lt", "f_gt", "f_le", "f_ge", "f_eq"]:
|
171
|
-
tmp, sign = clear_div(simplify(eq.children[0]-eq.children[1]))
|
174
|
+
tmp, sign = clear_div(simplify(eq.children[0]-eq.children[1]), eq.name != "f_eq")
|
172
175
|
name2 = eq.name
|
173
176
|
if not sign:
|
174
177
|
name2 = {"f_lt":"f_gt", "f_gt":"f_lt", "f_eq":"f_eq", "f_le":"f_ge", "f_ge":"f_le"}[name2]
|
mathai/univariate_inequality.py
CHANGED
@@ -262,9 +262,9 @@ def helper(eq, var="v_0"):
|
|
262
262
|
out = inverse(item, vlist(item)[0])
|
263
263
|
critical.append(out)
|
264
264
|
if equ:
|
265
|
-
equal.append(
|
266
|
-
equal = list(set([simplify(
|
267
|
-
more = list(set([simplify(
|
265
|
+
equal.append(out)
|
266
|
+
equal = list(set([simplify(item) for item in equal]))
|
267
|
+
more = list(set([simplify(item) for item in more]))
|
268
268
|
critical = [simplify(item) for item in critical]
|
269
269
|
critical = Counter(critical)
|
270
270
|
|
@@ -365,9 +365,8 @@ def absolute(equation):
|
|
365
365
|
equation = TreeNode("f_or", out2)
|
366
366
|
return equation
|
367
367
|
def handle_sqrt(eq):
|
368
|
-
eq = domain(eq)
|
369
368
|
def helper2(eq):
|
370
|
-
if eq.name in ["f_lt", "f_gt", "f_le", "f_ge"]:
|
369
|
+
if eq.name in ["f_lt", "f_gt", "f_le", "f_ge","f_eq"]:
|
371
370
|
out = []
|
372
371
|
def helper(eq):
|
373
372
|
nonlocal out
|
@@ -376,15 +375,15 @@ def handle_sqrt(eq):
|
|
376
375
|
x = [helper(child) for child in eq.children]
|
377
376
|
helper(eq)
|
378
377
|
for item in out:
|
379
|
-
|
380
|
-
eq2, sgn = inverse(simplify(eq.children[0]), str_form(item), True)
|
381
378
|
n = tree_form("d_1")
|
382
|
-
if
|
383
|
-
|
379
|
+
if eq.name == "f_eq":
|
380
|
+
eq2 = inverse(simplify(eq.children[0]), str_form(item))
|
381
|
+
else:
|
382
|
+
eq2, sgn = inverse(simplify(eq.children[0]), str_form(item), True)
|
383
|
+
if sgn == False:
|
384
|
+
n = tree_form("d_-1")
|
384
385
|
eq3 = simplify(expand(simplify(eq2**2)))
|
385
|
-
|
386
|
-
if "v_" in str_form(eq3) and not (eq2.name == "f_pow" and frac(eq2.children[1]) == Fraction(1,2)):
|
387
|
-
return simplify(TreeNode(eq.name, [simplify(n*item.children[0]-eq3*n), tree_form("d_0")])) & TreeNode("f_ge", [eq2, tree_form("d_0")])
|
386
|
+
|
388
387
|
return simplify(TreeNode(eq.name, [simplify(n*item.children[0]-eq3*n), tree_form("d_0")]))
|
389
388
|
return TreeNode(eq.name, [helper2(child) for child in eq.children])
|
390
389
|
return helper2(eq)
|
@@ -394,9 +393,13 @@ def domain(eq):
|
|
394
393
|
def helper2(eq):
|
395
394
|
nonlocal out
|
396
395
|
if eq.name == "f_pow" and frac(eq.children[1]) is not None and frac(eq.children[1]).denominator == 2:
|
397
|
-
|
396
|
+
if "v_" in str_form(eq.children[0]):
|
397
|
+
out.append(TreeNode("f_ge", [eq.children[0], tree_form("d_0")]))
|
398
|
+
out.append(TreeNode("f_ge", [eq, tree_form("d_0")]))
|
398
399
|
if eq.name == "f_pow" and frac(eq.children[1]) is not None and frac(eq.children[1]) <0:
|
399
|
-
|
400
|
+
tmp = TreeNode("f_eq", [eq.children[0], tree_form("d_0")]).fx("not")
|
401
|
+
if "v_" in str_form(tmp):
|
402
|
+
out.append(tmp)
|
400
403
|
x = [helper2(child) for child in eq.children]
|
401
404
|
helper2(eq)
|
402
405
|
out = list(set([simplify(item) for item in out]))
|
@@ -13,12 +13,12 @@ mathai/linear.py,sha256=eVnDbJYC1TWwg4J7ovBKsaHYlSoDmXk5jQpsqwtVPyI,5481
|
|
13
13
|
mathai/logic.py,sha256=UvHzRmKcO9AD51tRzHmpNSEhgW5gmaf4XPaQKFjGfC4,9653
|
14
14
|
mathai/parser.py,sha256=ENtMMm7Q_5QZL6cjbwsXGVJv-H53ueCPGEosJy4LcjY,6809
|
15
15
|
mathai/printeq.py,sha256=JTB0_RBcgt1yFviqlHtXGXuSXcpKrxzSxj5WHkOHon4,1318
|
16
|
-
mathai/simplify.py,sha256=
|
16
|
+
mathai/simplify.py,sha256=FZrQkG-dhUJqD-V856139Ogj2SAQQ8pNkvUCyfTwZr0,15034
|
17
17
|
mathai/structure.py,sha256=Hgw2y43dwasa6G8z6OS2lmReh7JHwlChGn-FUdEaWY8,4106
|
18
18
|
mathai/tool.py,sha256=87N5Ya7DmHdFOobTYDAjPHNWZuMzMIDjYN0ZtlHjxqE,1099
|
19
19
|
mathai/trig.py,sha256=ywu89MJfAB81JCzsVPBLpGGv8od0LhLn5cgDtLtYwmw,6897
|
20
|
-
mathai/univariate_inequality.py,sha256=
|
21
|
-
mathai-0.2.
|
22
|
-
mathai-0.2.
|
23
|
-
mathai-0.2.
|
24
|
-
mathai-0.2.
|
20
|
+
mathai/univariate_inequality.py,sha256=zSbpMMaG0QVAU74b6hQstv4gmBJkRGjkn9jHWLBotEE,14725
|
21
|
+
mathai-0.2.7.dist-info/METADATA,sha256=0lJc4A1TrhIkka4RMILKnZfIn08WqVVT9wQThDIe6rw,7087
|
22
|
+
mathai-0.2.7.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
|
23
|
+
mathai-0.2.7.dist-info/top_level.txt,sha256=ROP4l3OhGYw3ihkQGASr18xM9GsK4z3_6whV5AyXLwE,7
|
24
|
+
mathai-0.2.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|