def full(self): # remove unused commands self.clean() # evalf for command in self.commands: command.expr = mypowsimp(mycollectsimp(command.expr.evalf())) command.expr = command.expr.subs(C.Real(-1.0), -1) command.expr = command.expr.subs(C.Real(-2.0), -2) # substitute as much as possible while self.autosub(level=0): pass while self.autosub(level=1): pass # substitute back temporary variables that are used only once self.singles() # mypowsimp for command in self.commands: command.expr = mypowsimp(command.expr) command.expr = command.expr.subs(C.Real(-1.0), -1) command.expr = command.expr.subs(C.Real(-2.0), -2)