mathai 0.3.8__tar.gz → 0.4.0__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.
- {mathai-0.3.8 → mathai-0.4.0}/PKG-INFO +1 -1
- {mathai-0.3.8 → mathai-0.4.0}/mathai/apart.py +1 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/base.py +0 -4
- {mathai-0.3.8 → mathai-0.4.0}/mathai/integrate.py +7 -14
- {mathai-0.3.8 → mathai-0.4.0}/mathai.egg-info/PKG-INFO +1 -1
- {mathai-0.3.8 → mathai-0.4.0}/setup.py +1 -1
- {mathai-0.3.8 → mathai-0.4.0}/README.md +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/__init__.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/console.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/diff.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/expand.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/factor.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/fraction.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/inverse.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/limit.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/linear.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/logic.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/parser.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/printeq.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/search.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/simplify.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/structure.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/tool.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/trig.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai/univariate_inequality.py +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai.egg-info/SOURCES.txt +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai.egg-info/dependency_links.txt +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai.egg-info/requires.txt +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/mathai.egg-info/top_level.txt +0 -0
- {mathai-0.3.8 → mathai-0.4.0}/setup.cfg +0 -0
@@ -131,8 +131,6 @@ def frac(eq):
|
|
131
131
|
return Fraction(int(eq.name[2:]))
|
132
132
|
if eq.name == "f_add":
|
133
133
|
p = frac(eq.children[0])
|
134
|
-
if p is None:
|
135
|
-
return None
|
136
134
|
for child in eq.children[1:]:
|
137
135
|
tmp = frac(child)
|
138
136
|
if isinstance(tmp, Fraction):
|
@@ -142,8 +140,6 @@ def frac(eq):
|
|
142
140
|
return p
|
143
141
|
if eq.name == "f_mul":
|
144
142
|
p = frac(eq.children[0])
|
145
|
-
if p is None:
|
146
|
-
return None
|
147
143
|
for child in eq.children[1:]:
|
148
144
|
tmp = frac(child)
|
149
145
|
if isinstance(tmp, Fraction):
|
@@ -104,6 +104,8 @@ def handle_try(eq):
|
|
104
104
|
else:
|
105
105
|
return TreeNode(eq.name, [handle_try(child) for child in eq.children])
|
106
106
|
def inteq(eq):
|
107
|
+
if "f_ref" not in str_form(eq):
|
108
|
+
return eq
|
107
109
|
if eq.name == "f_try":
|
108
110
|
eq2 = None
|
109
111
|
output = []
|
@@ -111,19 +113,13 @@ def inteq(eq):
|
|
111
113
|
if child.name == "f_ref":
|
112
114
|
eq2 = child.children[0]
|
113
115
|
break
|
114
|
-
if eq2 is None:
|
115
|
-
return eq
|
116
116
|
for child in eq.children:
|
117
117
|
if child.name == "f_ref":
|
118
118
|
output.append(child)
|
119
119
|
else:
|
120
120
|
eq3 = simplify(expand(simplify(eq2 - child)))
|
121
121
|
if contain(eq3, eq2):
|
122
|
-
|
123
|
-
if out is None:
|
124
|
-
output.append(child)
|
125
|
-
else:
|
126
|
-
output.append(out)
|
122
|
+
output.append(inverse(eq3, str_form(eq2)))
|
127
123
|
else:
|
128
124
|
output.append(child)
|
129
125
|
return TreeNode("f_try", output)
|
@@ -138,8 +134,7 @@ def solve_integrate(eq):
|
|
138
134
|
eq2 = dowhile(eq, _solve_integrate)
|
139
135
|
eq2 = dowhile(eq2, handle_try)
|
140
136
|
eq2 = rm(eq2)
|
141
|
-
|
142
|
-
eq2.children = list(set(eq2.children))
|
137
|
+
eq2.children = list(set(eq2.children))
|
143
138
|
return eq2
|
144
139
|
def integrate_subs(equation, term, v1, v2):
|
145
140
|
output = []
|
@@ -381,7 +376,6 @@ def rm_const(equation):
|
|
381
376
|
return rm_const(TreeNode("f_integrate",[equation, wrt])) *const
|
382
377
|
equation = eq2
|
383
378
|
return TreeNode(equation.name, [rm_const(child) for child in equation.children])
|
384
|
-
|
385
379
|
def integrate_formula(equation):
|
386
380
|
if equation.name == "f_ref":
|
387
381
|
return equation.copy_tree()
|
@@ -390,18 +384,17 @@ def integrate_formula(equation):
|
|
390
384
|
integrand = eq2.children[0]
|
391
385
|
wrt = eq2.children[1]
|
392
386
|
if integrand == wrt:
|
393
|
-
return wrt
|
387
|
+
return TreeNode("f_add", [TreeNode("f_power", [wrt.copy_tree(), TreeNode("2")]), TreeNode("f_div", [TreeNode("1"), TreeNode("2")])]) # x^2/2
|
394
388
|
if not contain(integrand, wrt):
|
395
|
-
return integrand*
|
389
|
+
return TreeNode("f_mul", [wrt.copy_tree(), integrand.copy_tree()]) # constant * dx
|
396
390
|
out = transform_formula(simplify(trig0(integrand)), wrt.name, formula_gen[0], formula_gen[1], formula_gen[2])
|
397
391
|
if out is not None:
|
398
|
-
|
399
392
|
return out
|
400
393
|
expr_str = str_form(integrand)
|
401
394
|
if expr_str.count("f_sin") + expr_str.count("f_cos") > 2:
|
402
395
|
out = transform_formula(integrand, wrt.name, formula_gen4[0], formula_gen4[1], formula_gen4[2])
|
403
396
|
if out is not None:
|
404
|
-
|
397
|
+
print(out, 111)
|
405
398
|
return out
|
406
399
|
return TreeNode(eq2.name, [integrate_formula(child) for child in eq2.children])
|
407
400
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|