mathai 0.7.3__py3-none-any.whl → 0.7.5__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/diff.py CHANGED
@@ -63,6 +63,12 @@ def diff(equation, var="v_0"):
63
63
  else:
64
64
  return equation
65
65
  return TreeNode(equation.name, [helper(child, var) for child in equation.children])
66
+ def calc(eq):
67
+ if eq.name == "f_dif":
68
+ return diffeq(trig0(eq.children[0]))
69
+ return TreeNode(eq.name, [calc(child) for child in eq.children])
70
+ if var is None:
71
+ return simplify(calc(equation))
66
72
  equation = diffeq(trig0(equation))
67
73
  equation = helper(equation, var)
68
74
  return simplify(equation)
mathai/expand.py CHANGED
@@ -70,9 +70,9 @@ def expand_nc(expr, label="f_mul"):
70
70
  return TreeNode(label, factors)
71
71
 
72
72
 
73
- def expand(eq):
74
- s = str_form(eq)
75
- for item in ["f_mul", "f_wmul", "f_dot", "f_cross"]:
76
- if item in s:
77
- eq = expand_nc(eq, item)
78
- return eq
73
+ def expand2(eq, over="*"):
74
+ over = {"@": "f_wmul", ".":"f_dot", "*":"f_mul"}[over]
75
+ return expand_nc(eq, over)
76
+ def expand(eq, over="*"):
77
+ eq = expand2(eq, over)
78
+ return TreeNode(eq.name, [expand(child, over) for child in eq.children])
mathai/factor.py CHANGED
@@ -134,6 +134,11 @@ def merge_sqrt(eq):
134
134
  n = int(eq.children[0].name[2:])
135
135
  a, b =sqrt_to_a_sqrt_b(n)
136
136
  return tree_form("d_"+str(b))**(tree_form("d_2")**-1)*tree_form("d_"+str(a))
137
+ if eq.name == "f_pow" and frac(eq.children[1]) == Fraction(-1,2):
138
+ if frac(eq.children[0]) is not None:
139
+ out = frac(eq.children[0])
140
+ b, a = [tree_form("d_"+str(x)) for x in [out.numerator, out.denominator]]
141
+ return a**(tree_form("d_2")**-1)/b**(tree_form("d_2")**-1)
137
142
  return TreeNode(eq.name, [helper(child) for child in eq.children])
138
143
  return helper(_merge_sqrt(eq))
139
144
  def rationalize_sqrt(eq):
mathai/fraction.py CHANGED
@@ -92,7 +92,7 @@ def fraction(eq):
92
92
  c = TreeNode("f_mul", c_children)
93
93
  c = TreeNode("f_pow", [c, tree_form("d_-1")])
94
94
 
95
- result_map[node] = TreeNode("f_mul", [simplify(expand(a)), c])
95
+ result_map[node] = TreeNode("f_mul", [simplify(expand(simplify(a))), c])
96
96
  continue
97
97
 
98
98
  # Default: just reconstruct node
mathai/ode.py CHANGED
@@ -1,3 +1,4 @@
1
+ from .diff import diff
1
2
  from .factor import factor
2
3
  from .expand import expand
3
4
  from .base import *
@@ -118,7 +119,17 @@ def diffsolve(eq):
118
119
  orig = eq.copy_tree()
119
120
 
120
121
 
121
- eq = diffsolve_sep2(eq)
122
+ eq = diffsolve_sep2(diffsolve_sep(eq))
122
123
  if eq is None:
124
+ for i in range(2):
125
+ a = tree_form(f"v_{i}")
126
+ b = tree_form(f"v_{1-i}")
127
+ c = tree_form("v_2")
128
+ eq2 = replace(orig, b,b*a)
129
+ eq2 = expand(simplify(fraction(simplify(diff(eq2, None)))))
130
+ eq2 = diffsolve_sep(eq2)
131
+ eq2 = diffsolve_sep2(eq2)
132
+ if eq2 is not None:
133
+ return e0(TreeNode("f_subs", [replace(eq2.children[0],b,c), c,b/a]).fx("try"))
123
134
  return orig
124
135
  return eq
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mathai
3
- Version: 0.7.3
3
+ Version: 0.7.5
4
4
  Summary: Mathematics solving Ai tailored to NCERT
5
5
  Home-page: https://github.com/infinity390/mathai4
6
6
  Requires-Python: >=3.7
@@ -3,17 +3,17 @@ mathai/apart.py,sha256=VSS3khE9PNuxiRvdU5JDl4IN-KJBSIFjwR17pkhviXI,4197
3
3
  mathai/base.py,sha256=XNmXWADG7mA4AeyFbCUsjBvUzDnw8AzWscX0Cc3GjvA,14854
4
4
  mathai/bivariate_inequality.py,sha256=Da-A1kqVynR0tNOlEI7GSTf5T2vNkcF4etL9-EoyPJg,11415
5
5
  mathai/console.py,sha256=Sn58iwYE79MLEh67s8X3q6vZjw6g7f9XM1T8_dBBR2o,3048
6
- mathai/diff.py,sha256=RSTwlfeddvYXUDShCeRdcPjsmAS8Vf5OkYJAaUBPaiM,3060
7
- mathai/expand.py,sha256=AEX-inLztL6i7VWSu0Zw1z9OVwhomrnoqGrQiDuoPQE,2502
8
- mathai/factor.py,sha256=3wcmZOGUqMlLj4v2DA14ZLqEQ7khavOi7PjZJU6VX40,12494
9
- mathai/fraction.py,sha256=88xvRpDGfFi8tbe1QIyejdSP91HcErrN4VS2MxzbhrY,4392
6
+ mathai/diff.py,sha256=3__PoEqs_JlS2fRkebXyL-7eyV69ZoV8vCjpYgDWcXE,3297
7
+ mathai/expand.py,sha256=IuzMX6emCT480VE27aCtR0eWU-rJ2VElvRLVa2xcRw0,2582
8
+ mathai/factor.py,sha256=mz_UlPuAqwvsextLB0FM5KWIuuDiMMKG51bXrofqzw8,12830
9
+ mathai/fraction.py,sha256=3Qer3K20ZO2exMAYp1z80H69qRjVMfWKg5Ik0Ud8wf4,4402
10
10
  mathai/integrate.py,sha256=C_lqYgQN4UiriCb_LDkpwtKx7XJhp_K8T9skCkxWqas,17208
11
11
  mathai/inverse.py,sha256=ya7P8WjzfaAL3UXL7xqOh5GaIsXLDZ-F6lZFy3IEgaQ,2931
12
12
  mathai/limit.py,sha256=9F8i9UZh2xb-V8A5Sd1gdhDf9c2RFgpE1GdNn9MvbWI,5703
13
13
  mathai/linear.py,sha256=viGlPU8BPrjLWHlyNUvnfPHNH5d4ZBImiQMdyXaKGg0,5702
14
14
  mathai/logic.py,sha256=Ndz4Fd6aNCmzFlqoPyyIpSmV_BXmYHsurePjLyZJoNc,9809
15
15
  mathai/matrix.py,sha256=MFe6tUL4a3jYuP13fXWGwER_34AbqfoOK5kHwVHfsKk,7169
16
- mathai/ode.py,sha256=zxxTXAOpt7oSsfpgI4vHsCWKXevmM96ZOBZWWs-vj8Y,4801
16
+ mathai/ode.py,sha256=csfXXodMmfujl5klMQFXFqQsm31mfqJC0R3A-Fh2XA0,5297
17
17
  mathai/parser.py,sha256=FcjOTM_2-YFqPNS9EyZfo76pa4CedDJCbcs8wOXc_uU,7130
18
18
  mathai/parsetab.py,sha256=TL-4jvRM_Tx6ipwet8CFJc2DkjR4tGsbrGF_r4IC8xI,9651
19
19
  mathai/printeq.py,sha256=4UgLJo-vV_YlVw_3QUQY_jQMHrFnG-ZKAyVZsd7yD6o,1450
@@ -23,7 +23,7 @@ mathai/structure.py,sha256=wrU7kqphSN7CqaVffyHHXD2-3t5My_Z_TtYFoUe_lTU,4099
23
23
  mathai/tool.py,sha256=ozcXTXLbKUnyPM9r9kz9M43YA2CBcWezcqLZfEs8rpc,6051
24
24
  mathai/trig.py,sha256=fnBbfiopcQzFg4ya1BoO5M0X_aCBnse2bjnKh1juw4I,11223
25
25
  mathai/univariate_inequality.py,sha256=LPFdWgC1y5zBwnsy1wwZxj-yP_SbqFDhCmTTzhuwoiY,16469
26
- mathai-0.7.3.dist-info/METADATA,sha256=O-xwE15PJRC2oY1xe7-JWyBlDlvcIcCwSxlcDNwdk5s,7735
27
- mathai-0.7.3.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
28
- mathai-0.7.3.dist-info/top_level.txt,sha256=ROP4l3OhGYw3ihkQGASr18xM9GsK4z3_6whV5AyXLwE,7
29
- mathai-0.7.3.dist-info/RECORD,,
26
+ mathai-0.7.5.dist-info/METADATA,sha256=GSXYZlfllT4oNidG0NEqx549V4kq5GMgyCwNSAh1K-k,7735
27
+ mathai-0.7.5.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
28
+ mathai-0.7.5.dist-info/top_level.txt,sha256=ROP4l3OhGYw3ihkQGASr18xM9GsK4z3_6whV5AyXLwE,7
29
+ mathai-0.7.5.dist-info/RECORD,,
File without changes