private void button1_Click(object sender, EventArgs e) { int n; int.TryParse(textBox2.Text, out n); double[] x = new double[n + 1]; double[] y = new double[n + 1]; Interpolation cInt = new Interpolation(); cInt.CalculateNodes(x, y, 0, 2, n); textBox1.Clear(); for (int i = 0; i <= n; i++) { textBox1.Text += x[i].ToString("F4") + '\t' + y[i].ToString("F4") + Environment.NewLine; } chart1.Series[0].Points.Clear(); chart1.Series[1].Points.Clear(); chart2.Series[0].Points.Clear(); double t = 0; while (t <= 2) { double f1 = cInt.Function(t); chart1.Series[0].Points.AddXY(t, f1); double f2 = cInt.Polinom(t, n, 0, 2); chart1.Series[1].Points.AddXY(t, f2); chart2.Series[0].Points.AddXY(t, f2 - f1); t += 0.001; } }