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); }
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); }
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); }
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) }); }
private void MultButton_Click(object sender, RoutedEventArgs e) { SquarePolynomial polyMult = poly1 * poly2; Mult.Text = polyMult.ToString(); }
private void DecButton_Click(object sender, RoutedEventArgs e) { SquarePolynomial polyDec = poly1 - poly2; Dec.Text = polyDec.ToString(); }
private void SumButton_Click(object sender, RoutedEventArgs e) { SquarePolynomial polySum = poly1 + poly2; Sum.Text = polySum.ToString(); }