mathai 0.6.3__tar.gz → 0.6.4__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.3 → mathai-0.6.4}/PKG-INFO +1 -1
  2. {mathai-0.6.3 → mathai-0.6.4}/mathai/base.py +3 -0
  3. {mathai-0.6.3 → mathai-0.6.4}/mathai/matrix.py +22 -5
  4. {mathai-0.6.3 → mathai-0.6.4}/mathai/simplify.py +0 -1
  5. {mathai-0.6.3 → mathai-0.6.4}/mathai.egg-info/PKG-INFO +1 -1
  6. {mathai-0.6.3 → mathai-0.6.4}/setup.py +1 -1
  7. {mathai-0.6.3 → mathai-0.6.4}/README.md +0 -0
  8. {mathai-0.6.3 → mathai-0.6.4}/mathai/__init__.py +0 -0
  9. {mathai-0.6.3 → mathai-0.6.4}/mathai/apart.py +0 -0
  10. {mathai-0.6.3 → mathai-0.6.4}/mathai/bivariate_inequality.py +0 -0
  11. {mathai-0.6.3 → mathai-0.6.4}/mathai/console.py +0 -0
  12. {mathai-0.6.3 → mathai-0.6.4}/mathai/diff.py +0 -0
  13. {mathai-0.6.3 → mathai-0.6.4}/mathai/expand.py +0 -0
  14. {mathai-0.6.3 → mathai-0.6.4}/mathai/factor.py +0 -0
  15. {mathai-0.6.3 → mathai-0.6.4}/mathai/fraction.py +0 -0
  16. {mathai-0.6.3 → mathai-0.6.4}/mathai/integrate.py +0 -0
  17. {mathai-0.6.3 → mathai-0.6.4}/mathai/inverse.py +0 -0
  18. {mathai-0.6.3 → mathai-0.6.4}/mathai/limit.py +0 -0
  19. {mathai-0.6.3 → mathai-0.6.4}/mathai/linear.py +0 -0
  20. {mathai-0.6.3 → mathai-0.6.4}/mathai/logic.py +0 -0
  21. {mathai-0.6.3 → mathai-0.6.4}/mathai/ode.py +0 -0
  22. {mathai-0.6.3 → mathai-0.6.4}/mathai/parser.py +0 -0
  23. {mathai-0.6.3 → mathai-0.6.4}/mathai/parsetab.py +0 -0
  24. {mathai-0.6.3 → mathai-0.6.4}/mathai/printeq.py +0 -0
  25. {mathai-0.6.3 → mathai-0.6.4}/mathai/structure.py +0 -0
  26. {mathai-0.6.3 → mathai-0.6.4}/mathai/tool.py +0 -0
  27. {mathai-0.6.3 → mathai-0.6.4}/mathai/trig.py +0 -0
  28. {mathai-0.6.3 → mathai-0.6.4}/mathai/univariate_inequality.py +0 -0
  29. {mathai-0.6.3 → mathai-0.6.4}/mathai.egg-info/SOURCES.txt +0 -0
  30. {mathai-0.6.3 → mathai-0.6.4}/mathai.egg-info/dependency_links.txt +0 -0
  31. {mathai-0.6.3 → mathai-0.6.4}/mathai.egg-info/requires.txt +0 -0
  32. {mathai-0.6.3 → mathai-0.6.4}/mathai.egg-info/top_level.txt +0 -0
  33. {mathai-0.6.3 → mathai-0.6.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mathai
3
- Version: 0.6.3
3
+ Version: 0.6.4
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
@@ -45,6 +45,9 @@ class TreeNode:
45
45
 
46
46
  else:
47
47
  self.children = list(sorted(sortable, key=lambda x: str_form(x)))
48
+ elif name == "f_mul" and TreeNode.matmul == 0:
49
+
50
+ self.children = children
48
51
  else:
49
52
  self.children = children
50
53
 
@@ -60,6 +60,13 @@ def contains_neg(node):
60
60
  return True
61
61
  # ---------- multiplication (fully simplified) ----------
62
62
  def multiply(left,right):
63
+ left2, right2 = left, right
64
+ if left2.name != "f_pow":
65
+ left2 = left2 ** 1
66
+ if right2.name != "f_pow":
67
+ right2 = right2 ** 1
68
+ if left2.name == "f_pow" and right2.name == "f_pow" and left2.children[0]==right2.children[0]:
69
+ return simplify(left2.children[0]**(left2.children[1]+right2.children[1]))
63
70
  A,B = promote(left), promote(right)
64
71
 
65
72
  # vector · vector
@@ -79,23 +86,33 @@ def multiply(left,right):
79
86
  return None
80
87
 
81
88
  def fold_wmul(eq):
82
- if eq.name=="f_wmul" and any(item.name=="f_list" or item.name.startswith("v_-") for item in eq.children):
89
+ if eq.name == "f_pow" and eq.children[1].name.startswith("d_"):
90
+ n = int(eq.children[1].name[2:])
91
+ if n == 1:
92
+ eq = eq.children[0]
93
+ elif n > 1:
94
+ tmp = promote(eq.children[0])
95
+ if is_matrix(tmp):
96
+ orig =tmp
97
+ for i in range(n-1):
98
+ tmp = matmul(orig, tmp)
99
+ eq = py_to_tree(tmp)
100
+ elif eq.name=="f_wmul":
101
+
83
102
  i = len(eq.children)-1
84
103
  while i>0:
85
104
  out = multiply(eq.children[i], eq.children[i-1])
86
105
  if out is not None:
87
106
  eq.children.pop(i)
88
107
  eq.children.pop(i-1)
89
- eq.children.append(out)
108
+ eq.children.insert(i-1,out)
90
109
  i = i-1
91
- return eq
92
110
  return TreeNode(eq.name, [fold_wmul(child) for child in eq.children])
93
111
  def flat(eq):
94
- return flatten_tree(tree_form(str_form(eq).replace("f_w","f_")))
112
+ return flatten_tree(eq, ["f_wmul"])
95
113
  def matrix_solve(eq):
96
114
  if TreeNode.matmul == True:
97
115
  TreeNode.matmul = False
98
- eq = simplify(eq)
99
116
  eq = flat(dowhile(eq, lambda x: fold_wmul(flat(x))))
100
117
  TreeNode.matmul = True
101
118
  return eq
@@ -20,7 +20,6 @@ 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))
24
23
  if "v_" not in str_form(item) and compute(item) < 0:
25
24
  lst3.append(item)
26
25
  sign = denom
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mathai
3
- Version: 0.6.3
3
+ Version: 0.6.4
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.3",
5
+ version="0.6.4",
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
File without changes