예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
 public LinearEquation(LinearEquation le)
 {
     this.coefficients = (double[])le.coefficients.Clone();
 }