-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.py
More file actions
56 lines (55 loc) · 1.16 KB
/
data.py
File metadata and controls
56 lines (55 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
MIN_PTS=50
MAX_DISTANCE=1e3
INIT_FUNC="1/((x-1)*(x-2))"
INIT_X1="-10"
INIT_X2="10"
TEST_COMB=20
is_funcx_err={
1:"The string is not a valid function of x, please try again",
# maybe deprecate this
2:"The function must not contain other symbols/variables than x, please try again"
}
is_number_err={
1:"Please enter a valid number"
}
is_validx_err={
1:"Interval betweem x1, x2 is too large. The distance between x1,x2 must not exceed "+str(MAX_DISTANCE)
}
operators=['+','-','*','/','^']
valid_functions=[
"x**2 + 2*x + 1",
"sin(x) + cos(x)",
"tan(x)",
"1/(1 + exp(-x))",
"log(x)",
"sqrt(x)",
"exp(x)",
"x**3 - 3*x**2 + 2*x",
"2*sin(x) - cos(2*x)",
"x**4 - 4*x**3 + 6*x**2 - 4*x + 1",
"1/x",
"1/(x**2 + 1)",
"log(x**2 + 1)",
"x*sin(x)",
"x**2*sin(x)",
"x**3 - 2*x**2 + x",
"2*x**3 + 3*x**2 - 12*x + 1",
"sqrt(x**2 + 1) - x",
"cos(x)**2 - sin(x)**2",
"sin(2*x)"
]
invalid_functions = [
"y + x",
"2 * x + ",
"x**2,2",
"tanx",
"2 * (x + 1))",
"x + 1 =",
"sin x",
"1/(x+y)",
"sqrt(x**2 + 1) + 1,2",
"1/2x",
"cos(x y)",
"sin(x, y)",
"sin(x"
]