mathai 0.7.5__tar.gz → 0.7.6__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 (34) hide show
  1. {mathai-0.7.5 → mathai-0.7.6}/PKG-INFO +1 -1
  2. {mathai-0.7.5 → mathai-0.7.6}/mathai/__init__.py +0 -2
  3. {mathai-0.7.5 → mathai-0.7.6}/mathai/integrate.py +8 -2
  4. {mathai-0.7.5 → mathai-0.7.6}/mathai/ode.py +57 -1
  5. {mathai-0.7.5 → mathai-0.7.6}/mathai.egg-info/PKG-INFO +1 -1
  6. {mathai-0.7.5 → mathai-0.7.6}/setup.py +1 -1
  7. {mathai-0.7.5 → mathai-0.7.6}/README.md +0 -0
  8. {mathai-0.7.5 → mathai-0.7.6}/mathai/apart.py +0 -0
  9. {mathai-0.7.5 → mathai-0.7.6}/mathai/base.py +0 -0
  10. {mathai-0.7.5 → mathai-0.7.6}/mathai/bivariate_inequality.py +0 -0
  11. {mathai-0.7.5 → mathai-0.7.6}/mathai/console.py +0 -0
  12. {mathai-0.7.5 → mathai-0.7.6}/mathai/diff.py +0 -0
  13. {mathai-0.7.5 → mathai-0.7.6}/mathai/expand.py +0 -0
  14. {mathai-0.7.5 → mathai-0.7.6}/mathai/factor.py +0 -0
  15. {mathai-0.7.5 → mathai-0.7.6}/mathai/fraction.py +0 -0
  16. {mathai-0.7.5 → mathai-0.7.6}/mathai/inverse.py +0 -0
  17. {mathai-0.7.5 → mathai-0.7.6}/mathai/limit.py +0 -0
  18. {mathai-0.7.5 → mathai-0.7.6}/mathai/linear.py +0 -0
  19. {mathai-0.7.5 → mathai-0.7.6}/mathai/logic.py +0 -0
  20. {mathai-0.7.5 → mathai-0.7.6}/mathai/matrix.py +0 -0
  21. {mathai-0.7.5 → mathai-0.7.6}/mathai/parser.py +0 -0
  22. {mathai-0.7.5 → mathai-0.7.6}/mathai/parsetab.py +0 -0
  23. {mathai-0.7.5 → mathai-0.7.6}/mathai/printeq.py +0 -0
  24. {mathai-0.7.5 → mathai-0.7.6}/mathai/simplify.py +0 -0
  25. {mathai-0.7.5 → mathai-0.7.6}/mathai/statistics.py +0 -0
  26. {mathai-0.7.5 → mathai-0.7.6}/mathai/structure.py +0 -0
  27. {mathai-0.7.5 → mathai-0.7.6}/mathai/tool.py +0 -0
  28. {mathai-0.7.5 → mathai-0.7.6}/mathai/trig.py +0 -0
  29. {mathai-0.7.5 → mathai-0.7.6}/mathai/univariate_inequality.py +0 -0
  30. {mathai-0.7.5 → mathai-0.7.6}/mathai.egg-info/SOURCES.txt +0 -0
  31. {mathai-0.7.5 → mathai-0.7.6}/mathai.egg-info/dependency_links.txt +0 -0
  32. {mathai-0.7.5 → mathai-0.7.6}/mathai.egg-info/requires.txt +0 -0
  33. {mathai-0.7.5 → mathai-0.7.6}/mathai.egg-info/top_level.txt +0 -0
  34. {mathai-0.7.5 → mathai-0.7.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mathai
3
- Version: 0.7.5
3
+ Version: 0.7.6
4
4
  Summary: Mathematics solving Ai tailored to NCERT
5
5
  Home-page: https://github.com/infinity390/mathai4
6
6
  Requires-Python: >=3.7
@@ -11,14 +11,12 @@ from .printeq import printeq, printeq_str
11
11
 
12
12
  from .simplify import simplify
13
13
 
14
- from .integrate import ref as integrate_save
15
14
  from .integrate import integrate_subs_main as integrate_subs
16
15
  from .integrate import byparts as integrate_byparts
17
16
  from .integrate import sqint as integrate_fraction
18
17
  from .integrate import integrate_summation
19
18
  from .integrate import rm_const as integrate_const
20
19
  from .integrate import solve_integrate as integrate_clean
21
- from .integrate import inteq as integrate_recursive
22
20
  from .integrate import integrate_formula
23
21
 
24
22
  from .diff import diff
@@ -376,6 +376,7 @@ def integration_formula_init():
376
376
  (f"1/cos(A*{var}+B)^2", f"tan(A*{var}+B)/A"),
377
377
  (f"1/sin(A*{var}+B)", f"log(abs(tan((A*{var}+B)/2)))/A"),
378
378
  (f"1/cos(A*{var}+B)^3", f"(sec(A*{var}+B)*tan(A*{var}+B)+log(abs(sec(A*{var}+B)+tan(A*{var}+B))))/(2*A)")
379
+ #(f"cos({var})*e^(A*{var})", f"e^(A*{var})/(A^2+1)*(A*cos({var})+sin({var}))")
379
380
  ]
380
381
  formula_list = [[simplify(parse(y)) for y in x] for x in formula_list]
381
382
  expr = [[parse("A"), parse("1")], [parse("B"), parse("0")]]
@@ -449,13 +450,18 @@ def integrate_formula(equation):
449
450
  if out is not None:
450
451
 
451
452
  return out
452
- expr_str = str_form(shorten(integrand))
453
- if len(expr_str) < 30:
453
+
454
+ short = shorten(integrand)
455
+ expr_str = str_form(short)
456
+
457
+ if len(str(short)) < 25:
458
+
454
459
  if expr_str.count("f_sin") + expr_str.count("f_cos") > 2:
455
460
  out = transform_formula(integrand, wrt.name, formula_gen4[0], formula_gen4[1], formula_gen4[2])
456
461
  if out is not None:
457
462
  return out
458
463
  if "f_cos" in expr_str and contain(integrand, tree_form("s_e")):
464
+
459
465
  out = transform_formula(integrand, wrt.name, formula_gen11[0], formula_gen11[1], formula_gen11[2])
460
466
  if out is not None:
461
467
  return out
@@ -1,3 +1,4 @@
1
+ from collections import Counter
1
2
  from .diff import diff
2
3
  from .factor import factor
3
4
  from .expand import expand
@@ -131,5 +132,60 @@ def diffsolve(eq):
131
132
  eq2 = diffsolve_sep2(eq2)
132
133
  if eq2 is not None:
133
134
  return e0(TreeNode("f_subs", [replace(eq2.children[0],b,c), c,b/a]).fx("try"))
134
- return orig
135
+ eq = orig
136
+
137
+ eq = fraction(eq)
138
+ eq = simplify(eq)
139
+ for i in range(2):
140
+ out = linear_dif(eq, tree_form(f"v_{i}"), tree_form(f"v_{1-i}"))
141
+ if out is not None:
142
+ return out
135
143
  return eq
144
+ def clist(x):
145
+ return list(x.elements())
146
+ def collect_term(eq, term_lst):
147
+
148
+ lst = None
149
+ if eq.name == "f_add":
150
+ lst = eq.children
151
+ else:
152
+ lst = [eq]
153
+
154
+ other = []
155
+ dic = {}
156
+ term_lst = sorted(term_lst, key=lambda x: -len(factor_generation(x)))
157
+ for item2 in lst:
158
+ done = True
159
+ tmp2 = Counter(factor_generation(item2))
160
+ for index, item in enumerate(term_lst):
161
+ tmp = Counter(factor_generation(item))
162
+
163
+ if (tmp2&tmp) == tmp and clist((tmp2 - tmp)&tmp)==[]:
164
+ if item in dic.keys():
165
+ dic[item] += product(clist(tmp2-tmp))
166
+ else:
167
+ dic[item] = product(clist(tmp2-tmp))
168
+ done = False
169
+ break
170
+ if done:
171
+ other.append(item2)
172
+ other = summation(other)
173
+
174
+ for key in dic.keys():
175
+ dic[key] = simplify(dic[key])
176
+ return [dic, simplify(other)]
177
+ def linear_dif(eq, a, b):
178
+ eq = simplify(eq)
179
+ out = collect_term(eq.children[0], [b.fx("dif"), b*a.fx("dif"), a.fx("dif")])
180
+
181
+ if out[1] == tree_form("d_0"):
182
+ tmp = out[0][b.fx("dif")]
183
+ if tmp != tree_form("d_0"):
184
+
185
+ for key in out[0].keys():
186
+ out[0][key] = simplify(out[0][key]/tmp)
187
+ p, q = out[0][b*a.fx("dif")], -out[0][a.fx("dif")]
188
+
189
+ f = tree_form("s_e") ** TreeNode("f_integrate", [p, a])
190
+ return simplify(TreeNode("f_eq", [b*f, TreeNode("f_integrate", [q*f, a])+allocvar()]))
191
+ return None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mathai
3
- Version: 0.7.5
3
+ Version: 0.7.6
4
4
  Summary: Mathematics solving Ai tailored to NCERT
5
5
  Home-page: https://github.com/infinity390/mathai4
6
6
  Requires-Python: >=3.7
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="mathai",
5
- version="0.7.5",
5
+ version="0.7.6",
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
File without changes