public static Polynomial From(params double[] coefficients) { var v = new Polynomial(); for (int i = 0; i < coefficients.Length; i++) v[i] = coefficients[i]; return v; }
public static Polynomial operator *(Polynomial p, Polynomial q) { var v = new Polynomial(); foreach (var x in p) foreach (var y in q) v[x.Exponent + y.Exponent] += x.Coefficient * y.Coefficient; return v; }
public static Polynomial Sum(params Polynomial[] args) { var v = new Polynomial(); foreach (var arg in args) foreach (var term in arg) v[term.Exponent] += term.Coefficient; return v; }