mathai 2.4.4__tar.gz → 2.4.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.
- {mathai-2.4.4 → mathai-2.4.6}/PKG-INFO +1 -1
- {mathai-2.4.4 → mathai-2.4.6}/mathai/__init__.py +1 -1
- mathai-2.4.6/mathai/benchmark.py +63 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/ncert_data.txt +22 -11
- {mathai-2.4.4 → mathai-2.4.6}/mathai/univariate_inequality.py +0 -7
- {mathai-2.4.4 → mathai-2.4.6}/mathai.egg-info/PKG-INFO +1 -1
- {mathai-2.4.4 → mathai-2.4.6}/setup.py +1 -1
- mathai-2.4.4/mathai/benchmark.py +0 -25
- {mathai-2.4.4 → mathai-2.4.6}/README.md +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/apart.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/base.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/decision.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/diff.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/electronic.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/expand.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/factor.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/formula_applier.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/formula_compiler.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/fraction.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/graphics.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/integrate.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/inverse.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/lambda_calculus.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/limit.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/linear.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/logic.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/matrix.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/ml.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/mlscalar.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/ode.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/parser.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/pde.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/printeq.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/qm.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/simplify.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/statistics.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/test.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/tool.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai/trig.py +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai.egg-info/SOURCES.txt +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai.egg-info/dependency_links.txt +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/mathai.egg-info/top_level.txt +0 -0
- {mathai-2.4.4 → mathai-2.4.6}/setup.cfg +0 -0
|
@@ -7,7 +7,7 @@ from .qm import hydrogen_gse, helium_gse, power_rule
|
|
|
7
7
|
|
|
8
8
|
from .graphics import draw_graphics_from_solution, solve_graphics, solve_graphics_string
|
|
9
9
|
|
|
10
|
-
from .benchmark import
|
|
10
|
+
from .benchmark import benchmark
|
|
11
11
|
|
|
12
12
|
from .formula_compiler import formula_compiler
|
|
13
13
|
from .formula_compiler import formula_list_compiler
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import random
|
|
2
|
+
import copy
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from .simplify import simplify
|
|
5
|
+
from .expand import expand
|
|
6
|
+
from .parser import parse
|
|
7
|
+
from .fraction import fraction
|
|
8
|
+
from .apart import apart
|
|
9
|
+
from .integrate import integrate_formula, integrate_trig_formula, integrate_fraction
|
|
10
|
+
from .integrate import integrate_subs_main as integrate_subs
|
|
11
|
+
from .integrate import solve_integrate as integrate_clean
|
|
12
|
+
from .factor import factor2
|
|
13
|
+
from .trig import trig0, trig1, trig4, trig6
|
|
14
|
+
from .univariate_inequality import simple_wavycurvy, absolute
|
|
15
|
+
from .limit import limit1
|
|
16
|
+
from .logic import logic0
|
|
17
|
+
from .base import *
|
|
18
|
+
|
|
19
|
+
fx_list = [lambda x: dowhile(x, absolute), logic0, limit1, simple_wavycurvy, simplify, expand, fraction, integrate_formula, integrate_subs, integrate_trig_formula, integrate_clean, apart, trig0, trig1, trig4, integrate_fraction, factor2, trig6]
|
|
20
|
+
name_list = "absolute, logic0, limit1, simple_wavycurvy, simplify, expand, fraction, integrate_formula, integrate_subs, integrate_trig_formula, integrate_clean, apart, trig0, trig1, trig4, integrate_fraction, factor2, trig6".split(", ")
|
|
21
|
+
|
|
22
|
+
def benchmark(s="ncert_data"):
|
|
23
|
+
data_path = Path(__file__).parent / f"{s}.txt"
|
|
24
|
+
output_path = Path(__file__).parent / f"{s}_optimized.txt"
|
|
25
|
+
|
|
26
|
+
optimized_lines = []
|
|
27
|
+
|
|
28
|
+
with open(data_path, "r", encoding="utf-8") as file:
|
|
29
|
+
content = file.read().strip().split("\n")
|
|
30
|
+
count = 0
|
|
31
|
+
for item in content:
|
|
32
|
+
count += 1
|
|
33
|
+
item = item.strip()
|
|
34
|
+
if not item:
|
|
35
|
+
continue
|
|
36
|
+
parts = item.split(" ")
|
|
37
|
+
expr_str = parts[0]
|
|
38
|
+
eq = simplify(parse(expr_str))
|
|
39
|
+
|
|
40
|
+
effective_steps = [expr_str]
|
|
41
|
+
|
|
42
|
+
for func_name in parts[1:]:
|
|
43
|
+
func_idx = name_list.index(func_name)
|
|
44
|
+
func = fx_list[func_idx]
|
|
45
|
+
|
|
46
|
+
# Deepcopy to avoid in-place mutation reference traps
|
|
47
|
+
prev_eq = copy.deepcopy(eq)
|
|
48
|
+
eq = func(eq)
|
|
49
|
+
|
|
50
|
+
# Check if the function changed the equation
|
|
51
|
+
if eq == prev_eq:
|
|
52
|
+
pass
|
|
53
|
+
else:
|
|
54
|
+
effective_steps.append(func_name)
|
|
55
|
+
|
|
56
|
+
print(f"{count}. {expr_str} => {eq}")
|
|
57
|
+
optimized_lines.append(" ".join(effective_steps))
|
|
58
|
+
|
|
59
|
+
# Write out the optimized lines without non-changing functions
|
|
60
|
+
with open(output_path, "w", encoding="utf-8") as outfile:
|
|
61
|
+
outfile.write("\n".join(optimized_lines) + "\n")
|
|
62
|
+
|
|
63
|
+
print(f"\nOptimized dataset successfully written to: {output_path}")
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
abs(3*x-5)+abs(8-x)=abs(3+2*x) absolute simplify simple_wavycurvy
|
|
2
|
+
(sin(x)+cosec(x))^2+(cos(x)+sec(x))^2=7+tan(x)^2+cot(x)^2 trig0 fraction trig1 fraction simplify trig1 logic0
|
|
3
|
+
(1/(1-4*i)-2/(1+i))*((3-4*i)/(5+i))
|
|
4
|
+
limit((1-cos(x))/x,x) limit1
|
|
5
|
+
limit(sin(4*x)/sin(2*x),x) limit1
|
|
6
|
+
4*x+3<6*x+7 simple_wavycurvy
|
|
7
|
+
integrate(x/((x+1)*(x+2)),x) apart integrate_formula
|
|
8
|
+
integrate((x^2+1)/(x^2-5*x+6),x) factor2 expand integrate_formula factor2 apart integrate_formula
|
|
9
|
+
integrate(sin(2*x+5)^2,x) trig1 integrate_formula
|
|
10
|
+
integrate((1-cos(x))/(1+cos(x)),x) trig6 expand integrate_formula integrate_trig_formula simplify integrate_trig_formula integrate_formula
|
|
11
|
+
integrate(sin(x)/(1+cos(x)),x) trig6 expand integrate_formula simplify integrate_trig_formula
|
|
1
12
|
integrate(cos(2*x),x) integrate_formula
|
|
2
13
|
integrate(3*x^2+4*x^3,x) integrate_formula
|
|
3
14
|
integrate(1/x,x) integrate_formula
|
|
@@ -5,7 +16,7 @@ integrate((x^3-1)/x^2,x) expand simplify integrate_formula
|
|
|
5
16
|
integrate(x^(2/3)+1,x) integrate_formula
|
|
6
17
|
integrate(x^(3/2)+2*e^x-1/x,x) integrate_formula
|
|
7
18
|
integrate(sin(x)+cos(x),x) integrate_formula
|
|
8
|
-
integrate(cosec(x)*(cosec(x)+cot(x)),x) trig0 fraction
|
|
19
|
+
integrate(cosec(x)*(cosec(x)+cot(x)),x) trig0 fraction expand integrate_formula simplify integrate_trig_formula
|
|
9
20
|
integrate((1-sin(x))/cos(x)^2,x) expand integrate_formula integrate_trig_formula
|
|
10
21
|
integrate(sin(2*x),x) integrate_formula
|
|
11
22
|
integrate(cos(3*x),x) integrate_formula
|
|
@@ -22,24 +33,24 @@ integrate((x^3+3*x+4)/sqrt(x),x) expand simplify integrate_formula
|
|
|
22
33
|
integrate((x^3-x^2+x-1)/(x-1),x) expand integrate_formula apart integrate_formula integrate_subs expand simplify integrate_formula integrate_clean
|
|
23
34
|
integrate((1-x)*sqrt(x),x) expand simplify integrate_formula
|
|
24
35
|
integrate(sqrt(x)*(3*x^2+2*x+3),x) expand simplify integrate_formula
|
|
25
|
-
integrate(2*x-3*cos(x)+e^x,x)
|
|
36
|
+
integrate(2*x-3*cos(x)+e^x,x) integrate_formula
|
|
26
37
|
integrate(2*x^2-3*sin(x)+5*sqrt(x),x) integrate_formula
|
|
27
|
-
integrate(sec(x)*(sec(x)+tan(x)),x) expand trig0 simplify integrate_formula integrate_trig_formula
|
|
28
|
-
integrate(sec(x)^2/cosec(x)^2,x) trig0 simplify integrate_trig_formula integrate_formula trig1
|
|
29
|
-
integrate((2-3*sin(x))/cos(x)^2,x) expand simplify
|
|
30
|
-
integrate(sqrt(x)+1/sqrt(x),x)
|
|
38
|
+
integrate(sec(x)*(sec(x)+tan(x)),x) expand trig0 simplify integrate_formula integrate_trig_formula
|
|
39
|
+
integrate(sec(x)^2/cosec(x)^2,x) trig0 simplify integrate_trig_formula integrate_formula trig1
|
|
40
|
+
integrate((2-3*sin(x))/cos(x)^2,x) expand simplify integrate_formula integrate_trig_formula
|
|
41
|
+
integrate(sqrt(x)+1/sqrt(x),x) integrate_formula
|
|
31
42
|
integrate(sin(x)^3*cos(x)^2,x) trig1 integrate_formula
|
|
32
|
-
integrate(sin(x)/sin(x+a),x) integrate_subs
|
|
43
|
+
integrate(sin(x)/sin(x+a),x) integrate_subs expand simplify integrate_formula integrate_trig_formula integrate_clean
|
|
33
44
|
integrate((e^(2*x)-1)/(e^(2*x)+1),x) integrate_subs integrate_formula expand simplify apart integrate_formula integrate_clean
|
|
34
45
|
integrate((e^(2*x)-e^(-2*x))/(e^(2*x)+e^(-2*x)),x) integrate_subs integrate_formula fraction simplify apart integrate_formula integrate_fraction integrate_clean
|
|
35
46
|
integrate(tan(2*x-3)^2,x) trig0 integrate_trig_formula integrate_formula
|
|
36
|
-
integrate(sec(7-4*x)^2,x) trig0 simplify integrate_trig_formula
|
|
47
|
+
integrate(sec(7-4*x)^2,x) trig0 simplify integrate_trig_formula
|
|
37
48
|
integrate((4*x+2)*sqrt(x^2+x+1),x) integrate_subs integrate_formula integrate_clean
|
|
38
49
|
integrate(1/(x-sqrt(x)),x) integrate_subs integrate_formula factor2 apart integrate_formula integrate_clean
|
|
39
50
|
integrate(e^arctan(x)/(1+x^2),x) integrate_subs integrate_formula integrate_clean
|
|
40
51
|
integrate(x/e^(x^2),x) integrate_subs integrate_formula integrate_clean
|
|
41
52
|
integrate(e^(2*x+3),x) integrate_formula
|
|
42
|
-
integrate(x/(9-4*x^2),x) factor2 integrate_formula
|
|
53
|
+
integrate(x/(9-4*x^2),x) factor2 simplify integrate_formula apart integrate_formula
|
|
43
54
|
integrate(x^2/(2+3*x^3)^3,x) integrate_subs integrate_formula integrate_clean
|
|
44
55
|
integrate(x*sqrt(1+2*x^2),x) integrate_subs integrate_formula integrate_clean
|
|
45
56
|
integrate(x*sqrt(x+2),x) integrate_subs integrate_formula expand simplify integrate_formula integrate_clean
|
|
@@ -47,7 +58,7 @@ integrate(sqrt(a*x+b),x) integrate_formula
|
|
|
47
58
|
integrate(sin(a*x+b)*cos(a*x+b),x) trig1 integrate_formula
|
|
48
59
|
integrate(sin(cos(x))*sin(x),x) integrate_subs integrate_formula integrate_clean
|
|
49
60
|
integrate(2*x/(1+x^2),x) integrate_formula integrate_fraction
|
|
50
|
-
integrate(log(x)^2/x,x) integrate_subs
|
|
61
|
+
integrate(log(x)^2/x,x) integrate_subs integrate_formula integrate_clean
|
|
51
62
|
integrate(sin(arctan(x))/(1+x^2),x) integrate_subs integrate_formula integrate_clean
|
|
52
63
|
integrate(2*x*sin(x^2+1),x) integrate_formula integrate_subs integrate_formula integrate_clean
|
|
53
|
-
integrate(sin(m*x),x) integrate_formula
|
|
64
|
+
integrate(sin(m*x),x) integrate_formula
|
|
@@ -603,13 +603,6 @@ def domain(eq):
|
|
|
603
603
|
return out
|
|
604
604
|
|
|
605
605
|
def simple_wavycurvy(eq, mode=False):
|
|
606
|
-
if vlist(eq) == [] and (contain2(eq, "f_floor") or contain2(eq, "f_ceil")):
|
|
607
|
-
return dowhile(eq, lambda x: logic0(nothing(x)))
|
|
608
|
-
fx = lambda x: dowhile(x, lambda y: logic0(fraction(simplify(y))))
|
|
609
|
-
eq = fx(eq)
|
|
610
|
-
if "sqrt" in str(eq):
|
|
611
|
-
eq = handle_sqrt(eq)
|
|
612
|
-
eq = fx(eq)
|
|
613
606
|
eq = factor2(eq)
|
|
614
607
|
eq = simplify(eq, True, True)
|
|
615
608
|
eq = wavycurvy(eq, mode)
|
|
@@ -3,7 +3,7 @@ from setuptools import setup, find_packages
|
|
|
3
3
|
|
|
4
4
|
setup(
|
|
5
5
|
name="mathai",
|
|
6
|
-
version="2.4.
|
|
6
|
+
version="2.4.6",
|
|
7
7
|
description="Mathematics solving Ai tailored to NCERT",
|
|
8
8
|
long_description=Path("README.md").read_text(encoding="utf-8"),
|
|
9
9
|
long_description_content_type="text/markdown",
|
mathai-2.4.4/mathai/benchmark.py
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import random
|
|
2
|
-
from .simplify import simplify
|
|
3
|
-
from .expand import expand
|
|
4
|
-
from .parser import parse
|
|
5
|
-
from .fraction import fraction
|
|
6
|
-
from .apart import apart
|
|
7
|
-
from .integrate import integrate_formula, integrate_trig_formula, integrate_fraction
|
|
8
|
-
from .integrate import integrate_subs_main as integrate_subs
|
|
9
|
-
from .integrate import solve_integrate as integrate_clean
|
|
10
|
-
from .factor import factor2
|
|
11
|
-
from .trig import trig0, trig1, trig4
|
|
12
|
-
fx_list = [simplify, expand, fraction, integrate_formula, integrate_subs, integrate_trig_formula, integrate_clean, apart, trig0, trig1, trig4, integrate_fraction, factor2]
|
|
13
|
-
name_list = "simplify, expand, fraction, integrate_formula, integrate_subs, integrate_trig_formula, integrate_clean, apart, trig0, trig1, trig4, integrate_fraction, factor2".split(", ")
|
|
14
|
-
def benchmark_ncert():
|
|
15
|
-
with importlib.resources.open_text("mathai.data", "ncert_integrals.txt", encoding="utf-8") as file:
|
|
16
|
-
content = file.read()
|
|
17
|
-
content = content.strip().split("\n")
|
|
18
|
-
count = 0
|
|
19
|
-
for item in content:
|
|
20
|
-
count += 1
|
|
21
|
-
item = item.strip()
|
|
22
|
-
eq = simplify(parse(item.split(" ")[0]))
|
|
23
|
-
for item2 in item.split(" ")[1:]:
|
|
24
|
-
eq = fx_list[name_list.index(item2)](eq)
|
|
25
|
-
print(f"{count}. {item.split(" ")[0]} => {eq}")
|
|
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
|
|
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
|