public int TermGCD() { int res = 0; foreach (var term in Terms) { res = CasSystem.GCD(res, term.Coefficient); } return(res); }
public CasExpr Simplify() { int gcd = CasSystem.GCD(Poly1.TermGCD(), Poly2.TermGCD()); if (gcd == 0 || gcd == 1) { return(this); } else { return(new CasExpr(Poly1.DivideTerms(gcd), Poly2.DivideTerms(gcd))); } }