mathai 0.2.3__tar.gz → 0.2.5__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.2.3 → mathai-0.2.5}/PKG-INFO +1 -1
- {mathai-0.2.3 → mathai-0.2.5}/mathai/limit.py +12 -8
- {mathai-0.2.3 → mathai-0.2.5}/mathai/simplify.py +5 -2
- {mathai-0.2.3 → mathai-0.2.5}/mathai/univariate_inequality.py +3 -3
- {mathai-0.2.3 → mathai-0.2.5}/mathai.egg-info/PKG-INFO +1 -1
- {mathai-0.2.3 → mathai-0.2.5}/setup.py +1 -1
- {mathai-0.2.3 → mathai-0.2.5}/README.md +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/__init__.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/apart.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/base.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/console.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/diff.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/expand.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/factor.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/fraction.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/integrate.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/inverse.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/linear.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/logic.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/parser.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/printeq.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/structure.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/tool.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai/trig.py +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai.egg-info/SOURCES.txt +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai.egg-info/dependency_links.txt +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai.egg-info/requires.txt +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/mathai.egg-info/top_level.txt +0 -0
- {mathai-0.2.3 → mathai-0.2.5}/setup.cfg +0 -0
@@ -23,19 +23,22 @@ def subslimit(equation, var):
|
|
23
23
|
def check(num, den, var):
|
24
24
|
n, d = None, None
|
25
25
|
|
26
|
-
n, d = (dowhile(replace(e, var, tree_form("d_0")), lambda x: trig0(simplify(x))) for e in (num, den))
|
26
|
+
n, d = (dowhile(replace(e, tree_form(var), tree_form("d_0")), lambda x: trig0(simplify(x))) for e in (num, den))
|
27
|
+
|
27
28
|
if n is None or d is None:
|
28
29
|
return False
|
29
30
|
if n == 0 and d == 0: return True
|
30
|
-
if d != 0:
|
31
|
+
if d != 0:
|
32
|
+
return simplify(n/d)
|
31
33
|
return False
|
32
34
|
def lhospital(num, den, steps,var):
|
33
35
|
logs = []
|
36
|
+
|
34
37
|
out = check(num, den, var)
|
35
38
|
if isinstance(out, TreeNode):
|
36
39
|
return out,[]
|
37
40
|
for _ in range(steps):
|
38
|
-
num2, den2 = map(lambda e: simplify(diff(e, var
|
41
|
+
num2, den2 = map(lambda e: simplify(diff(e, var)), (num, den))
|
39
42
|
out = check(num2, den2, var)
|
40
43
|
if out is True:
|
41
44
|
num, den = num2, den2
|
@@ -49,7 +52,7 @@ def lhospital2(eq, var):
|
|
49
52
|
eq= simplify(eq)
|
50
53
|
if eq is None:
|
51
54
|
return None
|
52
|
-
if not contain(eq, var):
|
55
|
+
if not contain(eq, tree_form(var)):
|
53
56
|
return eq,[]
|
54
57
|
num, dem = [simplify(item) for item in num_dem(eq)]
|
55
58
|
if num is None or dem is None:
|
@@ -110,14 +113,15 @@ def approx(eq, var):
|
|
110
113
|
def approx_limit(equation, var):
|
111
114
|
return dowhile(equation, lambda x: approx(x, var))
|
112
115
|
|
113
|
-
def limit(equation, var=
|
116
|
+
def limit(equation, var="v_0"):
|
114
117
|
logs = [(0,"lim x->0 "+printeq_str(simplify(equation)))]
|
115
|
-
eq2 = dowhile(replace(equation, var, tree_form("d_0")), lambda x: trig0(simplify(x)))
|
116
|
-
if eq2 is not None and not contain(equation, var):
|
118
|
+
eq2 = dowhile(replace(equation, tree_form(var), tree_form("d_0")), lambda x: trig0(simplify(x)))
|
119
|
+
if eq2 is not None and not contain(equation, tree_form(var)):
|
117
120
|
return eq2,logs
|
121
|
+
|
118
122
|
equation, tmp = lhospital2(equation, var)
|
119
123
|
equation = simplify(expand(simplify(equation)))
|
120
|
-
if not contain(equation, var):
|
124
|
+
if not contain(equation, tree_form(var)):
|
121
125
|
return equation,logs+tmp
|
122
126
|
'''
|
123
127
|
if equation.name == "f_add":
|
@@ -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]
|
@@ -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
|
|
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
|