-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.py
More file actions
42 lines (37 loc) · 1.43 KB
/
Copy pathexample.py
File metadata and controls
42 lines (37 loc) · 1.43 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
import commutator
from typing import List
import time
res1: List[str] = []
res2 = ""
t0 = time.time()
print("The commutator of a b4 c b a' b2' c' b3' in different orders.")
for orderInput in range(11):
res2 = commutator.search("a b4 c b a' b2' c' b3'", orderInput=orderInput, commuteInput={
}, initialReplaceInput={}, finalReplaceInput={})[0]
print("order = ", orderInput, ", commutator = ", res2)
t1 = time.time()
print("Test 1:", t1 - t0, "seconds")
t0 = time.time()
print("The expand of [a b,b3 c b2] in different orders.")
for orderInput in range(11):
res2 = commutator.expand("[a b,b3 c b2]", orderInput=orderInput, commuteInput={
}, initialReplaceInput={}, finalReplaceInput={})
print("order = ", orderInput, ", expand = ", res2)
t1 = time.time()
print("Test 2:", t1 - t0, "seconds")
t0 = time.time()
print("Single commutator:")
print("The commutator of U' R U R2 D' R2 U' R' U R2 D R2 in order 4.")
res1 = commutator.search("U' R U R2 D' R2 U' R' U R2 D R2",
orderInput=4, outerBracketInput=True, limit=3)
print(res1)
t1 = time.time()
print("Test 3:", t1 - t0, "seconds")
t0 = time.time()
print("Combination of commutators:")
print("The combination of commutators of R U' S U2 S R' S2 R U' R' in order 4.")
res1 = commutator.search("R U' S U2 S R' S2 R U' R'",
orderInput=4, outerBracketInput=True, limit=3)
print(res1)
t1 = time.time()
print("Test 4:", t1 - t0, "seconds")