Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double equationSolve(double x)
- {
- double answ = 0;
- for (int i = 0; i <= degree; i++)
- {
- double c = coeffs[i];
- if (degree != i)
- c *= Math.Pow(x, degree - i);
- answ += c;
- }
- return answ;
- }
- var koef = textBox2.Text.Split(',');
- foreach (var inf in koef) coeffs.Add(Convert.ToDouble(inf.Replace(".", ",")));
- double equationSolve(double x)
- {
- double answ = 0;
- for (int i = 0; i <= degree; i++)
- {
- double c = coeffs[i];
- if (degree != i)
- c *= Math.Pow(x, degree - i);
- answ += c;
- }
- return answ;
- }
- Plot(){
- chart1.Series[0].Points.Clear();
- chart1.Series[0].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Spline;
- chart1.ChartAreas[0].AxisX.Crossing = 0;
- chart1.ChartAreas[0].AxisY.Crossing = 0;
- chart1.ChartAreas[0].AxisX.IntervalOffset = 0;
- chart1.ChartAreas[0].AxisY.IntervalOffset = 0;
- chart1.ChartAreas[0].AxisY.Interval = 1;
- chart1.ChartAreas[0].AxisX.Interval = 1;
- chart1.ChartAreas[0].AxisX.LineWidth = 3;
- chart1.ChartAreas[0].AxisY.LineWidth = 3;
- // chart1.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = "";
- var xmax = Convert.ToInt32(textBox1.Text);
- var xmin = Convert.ToInt32(textBox3.Text);
- chart1.ChartAreas[0].AxisX.Maximum = xmax;
- chart1.ChartAreas[0].AxisX.Minimum = xmin;
- xmax++;
- for (double j = xmin; j < xmax; j += 1)
- {
- double yy = equationSolve(j);
- chart1.Series[0].Points.AddXY(j, yy);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement