示例#1
0
        public static SquarePolynomial operator *(SquarePolynomial poly1, double k)
        {
            SquarePolynomial resultPoly = new SquarePolynomial(poly1.LineCoefficients);

            for (int i = 0; i < poly1.HeadPow; i++)
            {
                resultPoly[i] *= k;
            }

            return(resultPoly);
        }
示例#2
0
        public static SquarePolynomial operator +(SquarePolynomial poly1, SquarePolynomial poly2)
        {
            SquarePolynomial maxPoly = maxPowPoly(poly1, poly2);
            SquarePolynomial minPoly = minPowPoly(poly1, poly2);

            SquarePolynomial resultPoly = new SquarePolynomial(maxPoly.LineCoefficients);

            for (int i = 0; i < minPoly.HeadPow; i++)
            {
                resultPoly[i] = maxPoly[i] + minPoly[i];
            }

            return(resultPoly);
        }
示例#3
0
        public static SquarePolynomial operator *(SquarePolynomial poly1, SquarePolynomial poly2)
        {
            SquarePolynomial resultPoly = new SquarePolynomial(poly1.HeadPow + poly2.HeadPow - 1);

            resultPoly._array.Select(x => 0);

            for (int i = 0; i < poly1.HeadPow; i++)
            {
                for (int j = 0; j < poly2.HeadPow; j++)
                {
                    resultPoly[i + j] += poly1[i] * poly2[j];
                }
            }

            return(resultPoly);
        }
示例#4
0
 private void Write1_Click(object sender, RoutedEventArgs e)
 {
     poly1 = new SquarePolynomial(new List <double> {
         double.Parse(a1.Text), double.Parse(b1.Text), double.Parse(c1.Text)
     });
 }
示例#5
0
        private void MultButton_Click(object sender, RoutedEventArgs e)
        {
            SquarePolynomial polyMult = poly1 * poly2;

            Mult.Text = polyMult.ToString();
        }
示例#6
0
        private void DecButton_Click(object sender, RoutedEventArgs e)
        {
            SquarePolynomial polyDec = poly1 - poly2;

            Dec.Text = polyDec.ToString();
        }
示例#7
0
        private void SumButton_Click(object sender, RoutedEventArgs e)
        {
            SquarePolynomial polySum = poly1 + poly2;

            Sum.Text = polySum.ToString();
        }