private void pikardMethod(funcPointerPoly func, uint approximation, configurationAxisMethod cnf) { string resStringOfPolynoms = ""; // initialize polynom List <double> list1 = new List <double>(1) { 0 }; Polynomial poly1 = new Polynomial(list1); //poly1.printPolynomial(); resStringOfPolynoms += poly1.printPolynomial() + " == Это первый полином" + Environment.NewLine; List <double> list2 = new List <double>(2) { 1, 0 }; Polynomial poly2 = new Polynomial(list2); resStringOfPolynoms += poly2.printPolynomial() + " == Это второй полином" + Environment.NewLine; textBox1.Text = resStringOfPolynoms; Polynomial resPoly; for (uint i = 0; i <= approximation; i++) { resPoly = func(poly1, poly2); resPoly.integrate(); resPoly.printPolynomial(); poly1 = (Polynomial)resPoly.Clone(); int begin = 0; for (double j = cnf.x1; j < cnf.x2; j += cnf.h) { double res = resPoly.computeResult(j, false); dataGridView1.Rows[begin].HeaderCell.Value = j.ToString(); dataGridView1.Rows[begin].Cells[(int)i].Value = res; begin++; } } }
private void button1_Click(object sender, EventArgs e) { double x1 = 0; double x2 = 4; double h = 1e-3; uint approximation = 9; int tableHeight = (int)((x2 - x1) / h); int tableWidth = 3 + (int)approximation; dataGridView1.RowCount = tableHeight + 1; dataGridView1.ColumnCount = tableWidth; fillTable(approximation); funcPointerPoly funcPoly = testFunctionPoly; funcPointer func = testFunction; List <double> list1 = new List <double>(1) { 0 }; List <double> list2 = new List <double>(2) { 1, 0 }; configurationAxisMethod config = new configurationAxisMethod(x1, x2, h); pikardMethod(funcPoly, approximation, config); explicitMethod(approximation, func, config); implicitMethod(approximation, func, config); Polynomial poly = new Polynomial(list2); string res = poly.printPolynomial(); //textBox1.Text = res; }