Esempio n. 1
0
        public void UpdateChart()
        {
            DifferentiaEquationl2nd dif;
            double x1 = (point1.X - pictureBox1.Width / 2) / 100;
            double x2 = (point2.X - pictureBox1.Width / 2) / 100;
            double y1 = (point1.Y - pictureBox1.Height / 2) / 100;
            double y2 = (point2.Y - pictureBox1.Height / 2) / 100;

            if (y1 != 0)
            {
                dif = new DifferentiaEquationl2nd(1, -2 * x1, x1 * x1 + y1 * y1, set.K);
            }
            else
            {
                dif = new DifferentiaEquationl2nd(1, -(x1 + x2), x1 * x2, set.K);
            }

            chart1.Series.Clear();
            chart1.Series.Add("Y");

            chart1.Series["Y"].ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
            chart1.Series["Y"].BorderWidth = 3;

            double[] y = dif.decision(set.Step, set.Max, set.Y0, set.Dy0);
            int      j = 0;

            for (double i = 0; i <= set.Max; i += set.Step)
            {
                this.chart1.Series["Y"].Points.AddXY(i, y[j]);
                j++;
            }
            this.textBox1.Text = dif.toStr();
        }
Esempio n. 2
0
        public void UpdateChart()
        {
            DifferentiaEquationl2nd dif;
            double x1 = (point1.X - pictureBox1.Width / 2) / 100;
            double x2 = (point2.X - pictureBox1.Width / 2) / 100;
            double y1 = (point1.Y - pictureBox1.Height / 2) / 100;
            double y2 = (point2.Y - pictureBox1.Height / 2) / 100;

            if (y1 != 0)
            {
                dif = new DifferentiaEquationl2nd(1, -2 * x1, x1 * x1 + y1 * y1, set.K);
            }
            else
            {
                dif = new DifferentiaEquationl2nd(1, -(x1 + x2), x1 * x2, set.K);
            }

            chart1.Series.Clear();

            double[] DY = { 0, 1, 1, -1, -1, 2, -2, 2, -2, 2 };
            double[] Y  = { 0, -1, 1, -1, 1, 2, 2, -2, -2, 1 };

            for (int i = 0; i < 10; i++)
            {
                chart1.Series.Add("Y" + i);

                chart1.Series["Y" + i].ChartType   = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
                chart1.Series["Y" + i].BorderWidth = 3;
                chart1.Series["Y" + i].Color       = Color.Blue;
                double[] y  = dif.decision(set.Step, set.Max, Y[i], DY[i]);
                double[] dY = dif.Mas;

                for (int j = 0; j < dY.Length; j++)
                {
                    this.chart1.Series["Y" + i].Points.AddXY(y[j], dY[j]);
                    j++;
                }
            }

            this.textBox1.Text = dif.toStr();
        }