Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. public Form1()
  2. {
  3. InitializeComponent();
  4. }
  5.  
  6. private void button1_Click(object sender, EventArgs e)
  7. {
  8. double xmin = double.Parse(textBox1.Text);
  9. double xmax = double.Parse(textBox2.Text);
  10. double step = double.Parse(textBox3.Text);
  11. int count = (int)Math.Ceiling((xmax - xmin) / step) + 1;
  12. double[] x = new double[count];
  13. double[] y1 = new double[count];
  14. double[] y2 = new double[count];
  15. for (int i = 0; i < count; i++)
  16. {
  17. x[i] = xmin + step * i;
  18. y1[i] = Math.Pow(x[i], 4) + Math.Cos(2 + Math.Pow(x[i], 3) - 1.3);
  19. y2[i] = Math.Sqrt(Math.Pow(x[i], 4) + Math.Cos(2 + Math.Pow(x[i], 3) - 1.3));
  20. }
  21. chart1.ChartAreas[0].AxisX.Minimum = xmin;
  22. chart1.ChartAreas[0].AxisX.Maximum = xmax;
  23. chart1.ChartAreas[0].AxisX.MajorGrid.Interval = step;
  24. chart1.Series[0].Points.DataBindXY(x, y1);
  25. chart1.Series[1].Points.DataBindXY(x, y2);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement