mathai 2.3.7__tar.gz → 2.3.8__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.
Files changed (39) hide show
  1. {mathai-2.3.7 → mathai-2.3.8}/PKG-INFO +1 -1
  2. {mathai-2.3.7 → mathai-2.3.8}/mathai/integrate.py +18 -8
  3. {mathai-2.3.7 → mathai-2.3.8}/mathai.egg-info/PKG-INFO +1 -1
  4. {mathai-2.3.7 → mathai-2.3.8}/setup.py +1 -1
  5. {mathai-2.3.7 → mathai-2.3.8}/README.md +0 -0
  6. {mathai-2.3.7 → mathai-2.3.8}/mathai/__init__.py +0 -0
  7. {mathai-2.3.7 → mathai-2.3.8}/mathai/apart.py +0 -0
  8. {mathai-2.3.7 → mathai-2.3.8}/mathai/base.py +0 -0
  9. {mathai-2.3.7 → mathai-2.3.8}/mathai/decision.py +0 -0
  10. {mathai-2.3.7 → mathai-2.3.8}/mathai/diff.py +0 -0
  11. {mathai-2.3.7 → mathai-2.3.8}/mathai/electronic.py +0 -0
  12. {mathai-2.3.7 → mathai-2.3.8}/mathai/expand.py +0 -0
  13. {mathai-2.3.7 → mathai-2.3.8}/mathai/factor.py +0 -0
  14. {mathai-2.3.7 → mathai-2.3.8}/mathai/formula_applier.py +0 -0
  15. {mathai-2.3.7 → mathai-2.3.8}/mathai/fraction.py +0 -0
  16. {mathai-2.3.7 → mathai-2.3.8}/mathai/graphics.py +0 -0
  17. {mathai-2.3.7 → mathai-2.3.8}/mathai/inverse.py +0 -0
  18. {mathai-2.3.7 → mathai-2.3.8}/mathai/lambda_calculus.py +0 -0
  19. {mathai-2.3.7 → mathai-2.3.8}/mathai/limit.py +0 -0
  20. {mathai-2.3.7 → mathai-2.3.8}/mathai/linear.py +0 -0
  21. {mathai-2.3.7 → mathai-2.3.8}/mathai/logic.py +0 -0
  22. {mathai-2.3.7 → mathai-2.3.8}/mathai/matrix.py +0 -0
  23. {mathai-2.3.7 → mathai-2.3.8}/mathai/ml.py +0 -0
  24. {mathai-2.3.7 → mathai-2.3.8}/mathai/mlscalar.py +0 -0
  25. {mathai-2.3.7 → mathai-2.3.8}/mathai/ode.py +0 -0
  26. {mathai-2.3.7 → mathai-2.3.8}/mathai/parser.py +0 -0
  27. {mathai-2.3.7 → mathai-2.3.8}/mathai/pde.py +0 -0
  28. {mathai-2.3.7 → mathai-2.3.8}/mathai/printeq.py +0 -0
  29. {mathai-2.3.7 → mathai-2.3.8}/mathai/qm.py +0 -0
  30. {mathai-2.3.7 → mathai-2.3.8}/mathai/simplify.py +0 -0
  31. {mathai-2.3.7 → mathai-2.3.8}/mathai/statistics.py +0 -0
  32. {mathai-2.3.7 → mathai-2.3.8}/mathai/test.py +0 -0
  33. {mathai-2.3.7 → mathai-2.3.8}/mathai/tool.py +0 -0
  34. {mathai-2.3.7 → mathai-2.3.8}/mathai/trig.py +0 -0
  35. {mathai-2.3.7 → mathai-2.3.8}/mathai/univariate_inequality.py +0 -0
  36. {mathai-2.3.7 → mathai-2.3.8}/mathai.egg-info/SOURCES.txt +0 -0
  37. {mathai-2.3.7 → mathai-2.3.8}/mathai.egg-info/dependency_links.txt +0 -0
  38. {mathai-2.3.7 → mathai-2.3.8}/mathai.egg-info/top_level.txt +0 -0
  39. {mathai-2.3.7 → mathai-2.3.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mathai
3
- Version: 2.3.7
3
+ Version: 2.3.8
4
4
  Summary: Mathematics solving Ai tailored to NCERT
5
5
  Home-page: https://github.com/infinity390/mathai
6
6
  Requires-Python: >=3.7
@@ -8,7 +8,7 @@ from .fraction import fraction
8
8
  from .simplify import simplify
9
9
  from .expand import expand
10
10
  from .base import *
11
- from .formula_applier import formula_list_applier
11
+ from .formula_applier import formula_list_applier, formula_applier
12
12
  from .inverse import inverse
13
13
  from .tool import poly
14
14
  from fractions import Fraction
@@ -36,6 +36,8 @@ def subs_heuristic(eq, var):
36
36
  if eq.name == "f_pow" and frac(eq.children[1]) is not None and frac(eq.children[1]) == Fraction(1,2):
37
37
  if eq.children[0] == var:
38
38
  output.append(str_form(eq))
39
+ if eq.name == "f_log":
40
+ output.append(str_form(eq))
39
41
  if eq.name in ["f_pow"] and var.name in str_form(eq):
40
42
  if eq.children[1].name[:2] != "v_":
41
43
  output.append(str_form(eq))
@@ -66,20 +68,22 @@ def subs_heuristic(eq, var):
66
68
  tmp = list(set([simplify(tree_form(x)) for x in output]))
67
69
  tmp = sorted(tmp, key=lambda x: len(str_form(x)))
68
70
  poly_term = None
69
-
71
+ poly_size = -1
70
72
  fx = is_integrate_subs
71
73
  output = []
72
74
  if set(all_branch(eq)) <= set("f_add f_mul f_pow".split(" ")):
73
75
  for item in tmp:
74
76
  if fx(item).name == "s_true":
75
- poly_term = item
77
+ if len(item) > poly_size:
78
+ poly_term = item
79
+ poly_size = len(item)
76
80
  else:
77
81
  output.append(item)
78
82
  p = None
79
83
  if poly_term is None:
80
84
  p = tmp
81
85
  else:
82
- p = output+[poly_term]
86
+ p = [poly_term]+output
83
87
  last = list(set(last))
84
88
  if len(p)>3:
85
89
  p = p[:3]
@@ -176,12 +180,14 @@ def integrate_subs(equation, term, v1, v2, extra):
176
180
  equation = simplify(equation)
177
181
  eq = equation
178
182
  termeq = term
179
- t = inverse(copy.deepcopy(termeq), v1)
180
- g = inverse(copy.deepcopy(termeq), v2)
183
+ t = inverse(termeq, v1)
184
+ g = inverse(termeq, v2)
181
185
  if g is None:
182
186
  return none
183
187
  if t is None:
184
- return none
188
+ equation = simplify(factor2(factor0(simplify(replace(eq, g, tree_form(v2))/diff(g, v1)))))
189
+ if v1 in str_form(equation):
190
+ return none
185
191
  else:
186
192
  t = expand(t)
187
193
  eq3 = diff(g, v1)
@@ -193,6 +199,9 @@ def integrate_subs(equation, term, v1, v2, extra):
193
199
  eq = replace(eq, tree_form(v1), t)
194
200
  equation = eq/eq3
195
201
  equation = simplify(equation)
202
+ if v1 in str_form(equation):
203
+ equation = replace(equation, tree_form(v1), t)
204
+ equation = formula_applier(equation, "abs(x) x [] _ _ _ _")
196
205
  if v1 in str_form(equation):
197
206
  return none
198
207
  return dowhile(TreeNode("f_subs", [TreeNode("f_integrate", [simplify(equation), tree_form(origv2)]),tree_form(origv2) ,g]+extra), lambda x: simplify(trig4(trig0(x))))
@@ -321,13 +330,14 @@ def integrate_full(root):
321
330
  return "f_integrate" not in str_form(x)
322
331
  result = None
323
332
  root = normalize(root)
333
+ root = formula_applier(root, "(a^b)^c a^(b*c) [] b c _ _")
324
334
  normalize2 = lambda x: normalize(x, False)
325
335
  log = []
326
336
  orig = copy.deepcopy(root)
327
337
  eq = root
328
338
  for item in [[lambda x: x, simplify, expand, normalize], [factor2, apart, normalize2, normalize], [trig1, normalize2],\
329
339
  [factor1, normalize, trig6, normalize, expand, normalize, integrate_subs_main, normalize, factor2, simplify, integrate_trig_formula, trig1, apart, normalize2],\
330
- [normalize, integrate_subs_main, normalize2, expand, normalize, byparts, normalize], [simplify, integrate_trig_formula, trig1, integrate_formula]]:
340
+ [normalize2, integrate_subs_main, expand, normalize, byparts, normalize], [simplify, integrate_trig_formula, trig1, integrate_formula]]:
331
341
  for item2 in item:
332
342
  eq = item2(eq)
333
343
  if eq not in log:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mathai
3
- Version: 2.3.7
3
+ Version: 2.3.8
4
4
  Summary: Mathematics solving Ai tailored to NCERT
5
5
  Home-page: https://github.com/infinity390/mathai
6
6
  Requires-Python: >=3.7
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
3
3
 
4
4
  setup(
5
5
  name="mathai",
6
- version="2.3.7",
6
+ version="2.3.8",
7
7
  description="Mathematics solving Ai tailored to NCERT",
8
8
  long_description=Path("README.md").read_text(encoding="utf-8"),
9
9
  long_description_content_type="text/markdown",
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
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes