public static LinearEquation operator *(LinearEquation le, double k) { LinearEquation result = new LinearEquation(le); for (int i = 0; i < result.coefficients.Length; i++) { result.coefficients[i] *= k; } return(result); }
public static LinearEquation operator -(LinearEquation le1, LinearEquation le2) { int count = Math.Max(le1.coefficients.Length, le2.coefficients.Length); LinearEquation result = new LinearEquation(count); for (int i = 0; i < count; i++) { result.coefficients[i] = ((i < le1.coefficients.Length) ? le1.coefficients[i] : 0) - ((i < le2.coefficients.Length) ? le2.coefficients[i] : 0); } return(result); }
public LinearEquation(LinearEquation le) { this.coefficients = (double[])le.coefficients.Clone(); }