mathai 0.6.1__tar.gz → 0.6.3__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 (33) hide show
  1. {mathai-0.6.1 → mathai-0.6.3}/PKG-INFO +1 -1
  2. {mathai-0.6.1 → mathai-0.6.3}/mathai/base.py +4 -4
  3. {mathai-0.6.1 → mathai-0.6.3}/mathai/matrix.py +6 -1
  4. {mathai-0.6.1 → mathai-0.6.3}/mathai/parser.py +7 -4
  5. {mathai-0.6.1 → mathai-0.6.3}/mathai/simplify.py +1 -0
  6. {mathai-0.6.1 → mathai-0.6.3}/mathai.egg-info/PKG-INFO +1 -1
  7. {mathai-0.6.1 → mathai-0.6.3}/setup.py +1 -1
  8. {mathai-0.6.1 → mathai-0.6.3}/README.md +0 -0
  9. {mathai-0.6.1 → mathai-0.6.3}/mathai/__init__.py +0 -0
  10. {mathai-0.6.1 → mathai-0.6.3}/mathai/apart.py +0 -0
  11. {mathai-0.6.1 → mathai-0.6.3}/mathai/bivariate_inequality.py +0 -0
  12. {mathai-0.6.1 → mathai-0.6.3}/mathai/console.py +0 -0
  13. {mathai-0.6.1 → mathai-0.6.3}/mathai/diff.py +0 -0
  14. {mathai-0.6.1 → mathai-0.6.3}/mathai/expand.py +0 -0
  15. {mathai-0.6.1 → mathai-0.6.3}/mathai/factor.py +0 -0
  16. {mathai-0.6.1 → mathai-0.6.3}/mathai/fraction.py +0 -0
  17. {mathai-0.6.1 → mathai-0.6.3}/mathai/integrate.py +0 -0
  18. {mathai-0.6.1 → mathai-0.6.3}/mathai/inverse.py +0 -0
  19. {mathai-0.6.1 → mathai-0.6.3}/mathai/limit.py +0 -0
  20. {mathai-0.6.1 → mathai-0.6.3}/mathai/linear.py +0 -0
  21. {mathai-0.6.1 → mathai-0.6.3}/mathai/logic.py +0 -0
  22. {mathai-0.6.1 → mathai-0.6.3}/mathai/ode.py +0 -0
  23. {mathai-0.6.1 → mathai-0.6.3}/mathai/parsetab.py +0 -0
  24. {mathai-0.6.1 → mathai-0.6.3}/mathai/printeq.py +0 -0
  25. {mathai-0.6.1 → mathai-0.6.3}/mathai/structure.py +0 -0
  26. {mathai-0.6.1 → mathai-0.6.3}/mathai/tool.py +0 -0
  27. {mathai-0.6.1 → mathai-0.6.3}/mathai/trig.py +0 -0
  28. {mathai-0.6.1 → mathai-0.6.3}/mathai/univariate_inequality.py +0 -0
  29. {mathai-0.6.1 → mathai-0.6.3}/mathai.egg-info/SOURCES.txt +0 -0
  30. {mathai-0.6.1 → mathai-0.6.3}/mathai.egg-info/dependency_links.txt +0 -0
  31. {mathai-0.6.1 → mathai-0.6.3}/mathai.egg-info/requires.txt +0 -0
  32. {mathai-0.6.1 → mathai-0.6.3}/mathai.egg-info/top_level.txt +0 -0
  33. {mathai-0.6.1 → mathai-0.6.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mathai
3
- Version: 0.6.1
3
+ Version: 0.6.3
4
4
  Summary: Mathematics solving Ai tailored to NCERT
5
5
  Home-page: https://github.com/infinity390/mathai4
6
6
  Author: educated indians are having a low iq and are good for nothing
@@ -8,7 +8,7 @@ def contains_list_or_neg(node):
8
8
  return True
9
9
  return False
10
10
  class TreeNode:
11
- matmul = True
11
+ matmul = None
12
12
 
13
13
  def __init__(self, name, children=None):
14
14
  if children is None:
@@ -18,11 +18,11 @@ class TreeNode:
18
18
  children = copy.deepcopy(children)
19
19
  self.name = name
20
20
 
21
- if name == "f_add" or (name == "f_mul" and TreeNode.matmul):
21
+ if name == "f_add" or (name == "f_mul" and (TreeNode.matmul == True or TreeNode.matmul is None)):
22
22
  keyed = [(str_form(c), c) for c in children]
23
23
  self.children = [c for _, c in sorted(keyed)]
24
24
 
25
- elif name == "f_mul":
25
+ elif name == "f_mul" and TreeNode.matmul == False:
26
26
  sortable = []
27
27
  fixed = []
28
28
  for c in children:
@@ -291,7 +291,7 @@ def compute(eq):
291
291
  return values[0] - values[1]
292
292
  elif eq.name == "f_rad":
293
293
  return values[0] * math.pi / 180
294
- elif eq.name == "f_mul":
294
+ elif eq.name in ["f_wmul", "f_mul"]:
295
295
  result = 1.0
296
296
  for v in values:
297
297
  result *= v
@@ -93,4 +93,9 @@ def fold_wmul(eq):
93
93
  def flat(eq):
94
94
  return flatten_tree(tree_form(str_form(eq).replace("f_w","f_")))
95
95
  def matrix_solve(eq):
96
- return flat(dowhile(eq, lambda x: fold_wmul(flat(x))))
96
+ if TreeNode.matmul == True:
97
+ TreeNode.matmul = False
98
+ eq = simplify(eq)
99
+ eq = flat(dowhile(eq, lambda x: fold_wmul(flat(x))))
100
+ TreeNode.matmul = True
101
+ return eq
@@ -33,7 +33,7 @@ grammar = """
33
33
  | comparison "<=" arithmetic -> le
34
34
  | comparison ">=" arithmetic -> ge
35
35
 
36
- ?arithmetic: arithmetic "+" term -> wadd
36
+ ?arithmetic: arithmetic "+" term -> add
37
37
  | arithmetic "-" term -> sub
38
38
  | term
39
39
 
@@ -130,7 +130,7 @@ def parse(equation, funclist=None):
130
130
  if tree_node.name == "pass_through":
131
131
  return fxchange(tree_node.children[0])
132
132
  return TreeNode(
133
- "f_" + tree_node.name if tree_node.name in tmp3 + ["limitpinf", "limit", "try", "ref", "sqrt","imply","forall","exist","exclude","union","intersection","len","index","angle","charge","sum2","electricfield","line","point","sum","transpose","equationrhs","equationlhs","equation","covariance","variance","expect","error","laplace","dot","curl","pdif","diverge","gradient","rad","ge","le","gt","lt","eqtri","linesegment","midpoint","mag","point1","point2","point3","line1","line2","line3","log10","arcsin","arccos","arctan","list","cosec","sec","cot","equiv","or","not","and","circumcenter","eq","sub","wadd","sin","cos","tan","wmul","integrate","dif","pow","div","log","abs"] else "d_" + tree_node.name,
133
+ "f_" + tree_node.name if tree_node.name in tmp3 + ["limitpinf", "limit", "try", "ref", "sqrt","imply","forall","exist","exclude","union","intersection","len","index","angle","charge","sum2","electricfield","line","point","sum","transpose","equationrhs","equationlhs","equation","covariance","variance","expect","error","laplace","dot","curl","pdif","diverge","gradient","rad","ge","le","gt","lt","eqtri","linesegment","midpoint","mag","point1","point2","point3","line1","line2","line3","log10","arcsin","arccos","arctan","list","cosec","sec","cot","equiv","or","not","and","circumcenter","eq","sub","add","sin","cos","tan","wmul","integrate","dif","pow","div","log","abs"] else "d_" + tree_node.name,
134
134
  [fxchange(child) for child in tree_node.children]
135
135
  )
136
136
 
@@ -153,6 +153,9 @@ def parse(equation, funclist=None):
153
153
  tree_node.children = [rfx(child) for child in tree_node.children]
154
154
  return tree_node
155
155
  tree_node = rfx(tree_node)
156
- tree_node = flatten_tree(tree_node, ["f_wmul","f_wadd"])
157
- tree_node = tree_form(str_form(tree_node).replace("f_w","f_"))
156
+ tree_node = flatten_tree(tree_node, ["f_wmul"])
157
+ if TreeNode.matmul == True:
158
+ TreeNode.matmul = False
159
+ tree_node = tree_form(str_form(tree_node).replace("f_w","f_"))
160
+ TreeNode.matmul = True
158
161
  return tree_node
@@ -20,6 +20,7 @@ def clear_div(eq, denom):
20
20
  return tree_form("d_0"), True
21
21
  lst3 = []
22
22
  for item in lst:
23
+ print(str_form(item))
23
24
  if "v_" not in str_form(item) and compute(item) < 0:
24
25
  lst3.append(item)
25
26
  sign = denom
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mathai
3
- Version: 0.6.1
3
+ Version: 0.6.3
4
4
  Summary: Mathematics solving Ai tailored to NCERT
5
5
  Home-page: https://github.com/infinity390/mathai4
6
6
  Author: educated indians are having a low iq and are good for nothing
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="mathai",
5
- version="0.6.1",
5
+ version="0.6.3",
6
6
  description="Mathematics solving Ai tailored to NCERT",
7
7
  long_description=open("README.md").read(),
8
8
  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