mathai 0.5.1__py3-none-any.whl → 0.5.2__py3-none-any.whl

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/__init__.py CHANGED
@@ -44,6 +44,8 @@ from .limit import limit
44
44
  from .univariate_inequality import wavycurvy, absolute, domain, handle_sqrt
45
45
  from .bivariate_inequality import inequality_solve
46
46
 
47
+ from .matrix import uncommute
48
+
47
49
  from .base import *
48
50
 
49
51
  from .tool import enclose_const
mathai/factor.py CHANGED
@@ -171,7 +171,8 @@ def factor_quar_formula_init():
171
171
  formula_gen9 = factor_quar_formula_init()
172
172
  def factor_helper(equation, complexnum, power=2):
173
173
  global formula_gen9
174
-
174
+ if equation.name in ["f_or", "f_and", "f_not", "f_eq", "f_gt", "f_lt", "f_ge", "f_le"]:
175
+ return TreeNode(equation.name, [factor_helper(child, complexnum, power) for child in equation.children])
175
176
  maxnum=1
176
177
  alloclst = []
177
178
  for i in range(0,26):
mathai/matrix.py ADDED
@@ -0,0 +1,22 @@
1
+ def uncommute(eq, inside=False):
2
+ if not inside and eq.name in ["f_add", "f_mul"]:
3
+ return TreeNode(eq.name[:2]+"w"+eq.name[2:], [uncommute(child) for child in eq.children])
4
+ return TreeNode(eq.name, [uncommute(child, True) if eq.name == "f_list" else uncommute(child, inside) for child in eq.children])
5
+
6
+ def matrix_solve(eq):
7
+ if eq.name == "f_wadd":
8
+ output = None
9
+ output2 = []
10
+ for child in eq.children:
11
+ if child.name == "f_list":
12
+ if output is None:
13
+ output = []
14
+ for i in range(len(child.children)):
15
+ output.append([child.children[i]])
16
+ else:
17
+ for i in range(len(child.children)):
18
+ output[i] += [child.children[i]]
19
+ output.append(child)
20
+ else:
21
+ output2.append(child)
22
+ output = [summation(item) for item in output]
mathai/simplify.py CHANGED
@@ -159,7 +159,12 @@ def clear_div(eq, denom=False):
159
159
  if len(lst3) % 2 == 1:
160
160
  sign = False
161
161
  if denom:
162
- return eq if sign else -eq, sign
162
+ eq2 = [item for item in lst if "v_" not in str_form(item)]
163
+ eq3 = [item for item in lst if "v_" in str_form(item)]
164
+ if eq3 == []:
165
+ return solve(product(eq2)),True
166
+ return solve(product(eq3)),sign
167
+ #return eq if sign else -eq, sign
163
168
  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)]
164
169
 
165
170
  lst2 = [item for item in lst if "v_" in str_form(item)]
@@ -361,7 +361,9 @@ def absolute(equation):
361
361
  equation = TreeNode("f_or", out2)
362
362
  return equation
363
363
  def handle_sqrt(eq):
364
+ d= []
364
365
  def helper2(eq):
366
+ nonlocal d
365
367
  if eq.name in ["f_lt", "f_gt", "f_le", "f_ge","f_eq"]:
366
368
  out = []
367
369
  def helper(eq):
@@ -378,11 +380,17 @@ def handle_sqrt(eq):
378
380
  eq2, sgn = inverse(simplify(eq.children[0]), str_form(item), True)
379
381
  if sgn == False:
380
382
  n = tree_form("d_-1")
383
+ d.append(TreeNode("f_ge", [eq2,tree_form("d_0")]))
384
+ #d.append(TreeNode("f_ge", [item.children[0],tree_form("d_0")]))
381
385
  eq3 = simplify(expand(simplify(eq2**2)))
382
386
 
383
387
  return simplify(TreeNode(eq.name, [simplify(n*item.children[0]-eq3*n), tree_form("d_0")]))
388
+
384
389
  return TreeNode(eq.name, [helper2(child) for child in eq.children])
385
- return helper2(eq)
390
+ out = helper2(eq)
391
+ if len(d) == 0:
392
+ return out
393
+ return TreeNode("f_and", [helper2(eq)]+d)
386
394
  def domain(eq):
387
395
  eq = solve(eq, True)
388
396
  out = []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mathai
3
- Version: 0.5.1
3
+ Version: 0.5.2
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
@@ -1,26 +1,27 @@
1
- mathai/__init__.py,sha256=O3P2_Q64gwo1CmgD4cwhl3fGUQc3wGa0-b9z8MBtFaI,1481
1
+ mathai/__init__.py,sha256=GciRnhsCDfd_xjC2VoDWVmbapNtR4YlVGEa4ibJi32w,1514
2
2
  mathai/apart.py,sha256=VSS3khE9PNuxiRvdU5JDl4IN-KJBSIFjwR17pkhviXI,4197
3
3
  mathai/base.py,sha256=Ma1oCRbaZP0bp0Qnt_ZjKAh3rt9nZXQ_rmJL0sAoz5c,12730
4
4
  mathai/bivariate_inequality.py,sha256=FJOC2zKU5zWCMybCrhEQ7nVDgRO_w19Zko8WPTaDTSo,11411
5
5
  mathai/console.py,sha256=Sn58iwYE79MLEh67s8X3q6vZjw6g7f9XM1T8_dBBR2o,3048
6
6
  mathai/diff.py,sha256=YUBpRsz0qmBkq5vGxeGnvR4nMKjdOQiIXlNMxpij2ns,3051
7
7
  mathai/expand.py,sha256=SnBltkpIENMGkP0AYmbMlSc4H-CF5RslO2PcBEkn1BQ,3359
8
- mathai/factor.py,sha256=Xkx2_lxq-Z-t55dA9F2W4EH-3Uc1CFXj_6oESQdWAHM,11332
8
+ mathai/factor.py,sha256=muPDOcClrqc2XyVlbyIrhiIqI0QxauYL3e2mq3qa6OI,11533
9
9
  mathai/fraction.py,sha256=Q2ztsh5Bpz6YhML2QU0tfufbAs0Q6J319AhlzKephIY,4396
10
10
  mathai/integrate.py,sha256=ewV46QDD0-oiTWpSkmcpcZhBz9StcntbTV1tBLCo1Wo,16502
11
11
  mathai/inverse.py,sha256=QCvDrzKquWsZv-BDAzZd9HnU0c3gZvcc44UztHVO5LQ,2919
12
12
  mathai/limit.py,sha256=bn7eofIOJv4AIh0-FmLppZ3DKnGfbwOzXks2XOPTOs0,4932
13
13
  mathai/linear.py,sha256=Mmmnn4IdnADRMuv6crB0a_Ba2drGUFXOh7eqIIkirYA,5709
14
14
  mathai/logic.py,sha256=UvHzRmKcO9AD51tRzHmpNSEhgW5gmaf4XPaQKFjGfC4,9653
15
+ mathai/matrix.py,sha256=dWIXF5oInIL3SZ3naRzKN5ElI5drXJNiVTDM48hfZOw,972
15
16
  mathai/ode.py,sha256=zxxTXAOpt7oSsfpgI4vHsCWKXevmM96ZOBZWWs-vj8Y,4801
16
17
  mathai/parser.py,sha256=f7bemieFmp0sbup1NlraMLvZDVFvqKGFknEVtlFRMVk,6979
17
18
  mathai/printeq.py,sha256=gIes-pstFOa6FcnpVIVvkjVKuWdsVdo11LlEnmHhakU,1303
18
- mathai/simplify.py,sha256=nR5IReewrJ7HbxEUzQ2zg9xoFcwI1R5lGjWnX1pBKko,16885
19
+ mathai/simplify.py,sha256=EGyEld0ZpOuHLeMmOKhvv0rTejEWjfkwkNJQx3lHSQc,17127
19
20
  mathai/structure.py,sha256=4Ww2IAx62RcQSO7_17TZES-DjMWBpcFQtL939FBIHwY,4103
20
21
  mathai/tool.py,sha256=r8ejBY4Bnk_t8USYQCuxwmmJ4M-5H5OR6A3VbV7W-5w,6066
21
22
  mathai/trig.py,sha256=BQd_Gl_u0g5ZuZIwKozuXKbMinqb6K-OYicrtftn7eg,11174
22
- mathai/univariate_inequality.py,sha256=_r-kkiS4Hr-jRN7f-EL_E4svAMFWJP1Ea50HJKKbjfk,14778
23
- mathai-0.5.1.dist-info/METADATA,sha256=zPDi8RasVepSv0JP4bBx_LszViwltoRJSgR3HOvLNkQ,7103
24
- mathai-0.5.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
25
- mathai-0.5.1.dist-info/top_level.txt,sha256=ROP4l3OhGYw3ihkQGASr18xM9GsK4z3_6whV5AyXLwE,7
26
- mathai-0.5.1.dist-info/RECORD,,
23
+ mathai/univariate_inequality.py,sha256=3Yr7d9mE-mUNkwOPQyFPBDp0-gKkqrpzEYeHFQ8JcXA,15060
24
+ mathai-0.5.2.dist-info/METADATA,sha256=sjO-RkjnEu_-D6ahvZq-z_Ad0ZX9GSkM1qZICMmPcmg,7103
25
+ mathai-0.5.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
26
+ mathai-0.5.2.dist-info/top_level.txt,sha256=ROP4l3OhGYw3ihkQGASr18xM9GsK4z3_6whV5AyXLwE,7
27
+ mathai-0.5.2.dist-info/RECORD,,
File without changes