-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmoving_generator.py
More file actions
33 lines (30 loc) · 894 Bytes
/
Copy pathmoving_generator.py
File metadata and controls
33 lines (30 loc) · 894 Bytes
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
class generator_experssion:
def __init__(self,expr):
self.expr=expr
def SimplifyToMonomial(self):
temp=self.expr
tempmono=temp.split('+')
mono=[]
for i in tempmono:
strr=i.split('-')
if(strr[0]==''):
strr.pop(0)
for j in strr:
mono.append('-'+j)
else:
mono.append(strr[0])
strr.pop(0)
for j in strr:
mono.append('-'+j)
'''base=temp.split('E_')
print(base)
base=base[1:]
basepow=[]
for i in base:
basepow.append(list(map(int,(i.split('^')))))
return basepow'''
return mono
def __str__(self) -> str:
pass
a=generator_experssion('-E_2^4E_1^3+E_2^3E_1^4+E_2^2E_1^5-E_2E_1^6+E_1^7')
print(a.SimplifyToMonomial())