forked from bolverk/cyborg_math
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_1.py
More file actions
90 lines (58 loc) · 1.63 KB
/
verify_1.py
File metadata and controls
90 lines (58 loc) · 1.63 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
def check_1a(answer):
import sympy
return answer == sympy.Rational(1,3)
def check_2a(answer):
import sympy
return answer == sympy.Symbol('y')
def check_2b(answer):
import sympy
return answer == sympy.Symbol('chi')
def check_2c(answer):
import sympy
return answer == sympy.Symbol('alpha3')
def check_2d(answer):
import sympy
return answer == sympy.Symbol(r'\mathcal{L}')
def check_3a(answer):
import sympy
a = sympy.Symbol('a')
b = sympy.Symbol('b')
c = sympy.Symbol('c')
d = sympy.Symbol('d')
z = sympy.Symbol('z')
return answer == (a*z+b)/(c*z+d)
def check_3b(answer):
import sympy
n = sympy.Symbol('n')
return answer == 2**n-1
def check_3c(answer):
import sympy
temp = sympy.Rational(1)
for i in range(19):
temp = 1+1/temp
return answer == sympy.fraction(temp)[0]
def check_4a(answer):
import sympy
temp = (sympy.sqrt(3)+sympy.sqrt(2))/(sympy.sqrt(3)-sympy.sqrt(2))
temp = sympy.fraction(temp)
temp = (temp[0]*temp[0],temp[1]*temp[0])
temp = (temp[0].simplify(), temp[1].simplify())
temp = temp[0]/temp[1]
return answer == temp
def check_5a(answer):
import sympy
temp = 3+4*sympy.I
temp = temp**2
temp = sympy.im(temp)
return answer == temp
def check_6a(answer):
import sympy
x = sympy.Symbol('x')
rec = (3/x+x)/2
x_cur = 1
for i in range(9):
x_cur = rec.subs(x, x_cur)
return answer == x_cur
def check_8a(answer):
import sympy
return answer == (1+sympy.sqrt(5))/2