示例#1
0
        public Form1()
        {
            InitializeComponent();
            Plot.Series[0].Points.Clear();
            Plot.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            Plot.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dot;
            Plot.Series[0].IsVisibleInLegend = false;
            Plot.Series[0].Color             = Color.Green;
            radioButton1.Checked             = true;
            f2 = new f2();
            Random r = new Random();

            double[] A     = new double[14];
            double[] B     = new double[14];
            double   alpha = r.NextDouble();

            for (int i = 0; i < 14; i++)
            {
                A[i] = 2.0 * r.NextDouble() - 1.0;
                B[i] = 2.0 * r.NextDouble() - 1.0;
            }
            f2.A     = A;
            f2.B     = B;
            f2.alpha = alpha;
            f2.X     = X;
        }
示例#2
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                eps = Double.Parse(textBox1.Text);
            }
            catch (FormatException)
            {
                return;
            }
            double      a = -Math.PI / 2, b = Math.PI / 2;
            double      h    = 0.1;
            Integration task = new IntegrationRectangle();

            if (radioButton2.Checked)
            {
                task = new IntegrationTrapeze();
            }
            if (radioButton3.Checked)
            {
                task = new IntegrationSimpson();
            }
            var f3 = new f2();

            f3.A     = f2.A;
            f3.B     = f2.B;
            f3.alpha = f2.alpha;
            f3.X     = 0;
            var MAQ = new MAQ(task);

            int[] depth = new int[11];
            for (int i = 0; i <= 10; i++)
            {
                MAQ.compute(a, b, f3, eps);
                depth[i]  = MAQ.Depth;
                MAQ.Depth = 0;
                f3.X     += h;
            }
            var form = new PlotForm(depth);

            form.Show();
        }