Пример #1
0
        private void FillGrid()
        {
            dgvMeasurements.Rows.Clear();

            List <MeasurementsModel> results = new List <MeasurementsModel>();
            var newtones = NewtonDevidedDifferencescs.Calc(xz, x, y);
            var q1s      = LessSquares.Calc(x, y, xz, 1);
            var q2s      = LessSquares.Calc(x, y, xz, 2);
            var q3s      = LessSquares.Calc(x, y, xz, 3);
            var q4s      = LessSquares.Calc(x, y, xz, 4);

            for (int i = 0; i < xz.Length; i++)
            {
                var newMeasurement = new MeasurementsModel();
                newMeasurement.X  = xz[i];
                newMeasurement.L  = Lagrange.Calc(x, y, xz[i]);
                newMeasurement.P  = newtones[i];
                newMeasurement.Q1 = q1s[i];
                newMeasurement.Q2 = q2s[i];
                newMeasurement.Q3 = q3s[i];
                newMeasurement.Q4 = q4s[i];

                results.Add(newMeasurement);
                var idx = dgvMeasurements.Rows.Add();
                dgvMeasurements.Rows[idx].Cells["dcX"].Value  = newMeasurement.X;
                dgvMeasurements.Rows[idx].Cells["dcL"].Value  = newMeasurement.L;
                dgvMeasurements.Rows[idx].Cells["dcP"].Value  = newMeasurement.P;
                dgvMeasurements.Rows[idx].Cells["dcQ1"].Value = newMeasurement.Q1;
                dgvMeasurements.Rows[idx].Cells["dcQ2"].Value = newMeasurement.Q2;
                dgvMeasurements.Rows[idx].Cells["dcQ3"].Value = newMeasurement.Q3;
                dgvMeasurements.Rows[idx].Cells["dcQ4"].Value = newMeasurement.Q4;
            }
        }
Пример #2
0
        private void cbxLagrange_CheckedChanged(object sender, EventArgs e)
        {
            sLagrange.Points.Clear();

            if (cbxLagrange.Checked)
            {
                for (int i = 0; i < xz.Length; i++)
                {
                    sLagrange.Points.Add(new DataPoint(xz[i], Lagrange.Calc(x, y, xz[i])));
                }
            }
        }