class Equation: def __init__(self, string): self.string = string; split = string.rstrip().split("="); if (len(split) != 2): raise Exception("the equation must have one left hand side and one right hand side"); else: self.lhs = Polynomial(split[0]); self.rhs = Polynomial(split[1]); def isPopulated(self): return self.lhs.isPopulated() and self.rhs.isPopulated(); def equals(self, other): return self.lhs.equals(other.lhs) and self.rhs.equals(other.rhs); def isolate(self): print self; tmp = copy.deepcopy(self); self.lhs.sub(self.rhs); self.rhs.monomials = [Monomial(0, 0)]; if (not self.equals(tmp)): print self; tmp = copy.deepcopy(self); self.lhs.reduce(); self.lhs.sort(); self.power = self.lhs.power(); if (not self.equals(tmp)): print self; def __repr__(self): return repr(self.lhs) + " = " + repr(self.rhs);