Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Read();
            double res = 0;

            if (radioButton21.Checked)
            {
                MonteKarloEnum KK = MonteKarloEnum.Usual;
                if (radioButton23.Checked)
                {
                    KK = MonteKarloEnum.Geo;
                }
                МатКлассы.Point p = new МатКлассы.Point(a, b);
                MultiFunc       F = (double[] t) => f(t[0]);
                h_Count       = count;
                n             = count;
                EPS           = Double.NaN;
                res           = MonteKarlo(F, KK, p);
                textBox7.Text = Math.Abs(res - DefIntegral(f, a, b, C, Criterion.StepCount, count, eps, seq)).ToString();
                h_Count       = count;
                n             = count;
                EPS           = Double.NaN;
                //return;
            }
            else
            {
                Criterion K = Criterion.StepCount;
                if (radioButton19.Checked)
                {
                    K = Criterion.Accuracy;
                }
                if (radioButton20.Checked)
                {
                    K = Criterion.SegmentCount;
                }

                if ((int)C < 3)
                {
                    res = DefIntegral(f, a, b, C, K, count, eps, seq);
                }
                else
                {
                    res = DefIntegral(f, a, b, C, K, nn, eps, seq);
                }
            }
            textBox6.Text = res.ToString();
            textBox3.Text = h_Count.ToString();
            textBox4.Text = EPS.ToString();
        }
Ejemplo n.º 2
0
        public void Test()
        {
            Read();
            double res = 0;

            Criterion K = Criterion.StepCount;

            if (radioButton19.Checked)
            {
                K = Criterion.Accuracy;
            }
            if (radioButton20.Checked)
            {
                K = Criterion.SegmentCount;
            }

            for (C = 0; (int)C <= 2; C++)
            {
                res = DefIntegral(f, a, b, C, K, count, eps, seq);
                Program.PER.listView1.Items[(int)C].SubItems[1].Text = res.ToString();
            }
            C  += 2;
            res = DefIntegral(f, a, b, (Method)3, K, nn, eps, seq);
            Program.PER.listView1.Items[(int)C].SubItems[1].Text = res.ToString();
            C++;
            res = DefIntegral(f, a, b, (Method)4, K, nn, eps, seq);
            Program.PER.listView1.Items[(int)C].SubItems[1].Text = res.ToString();
            C++;
            res = DefIntegral(f, a, b, (Method)5, K, nn, eps, seq);
            Program.PER.listView1.Items[(int)C].SubItems[1].Text = res.ToString();

            for (MonteKarloEnum KK = 0; (int)KK < 2; KK++)
            {
                МатКлассы.Point p = new МатКлассы.Point(a, b);
                MultiFunc       F = (double[] t) => f(t[0]);
                h_Count = count;
                n       = count;
                EPS     = Double.NaN;
                res     = MonteKarlo(F, KK, p);
                Program.PER.listView1.Items[(int)KK + 3].SubItems[1].Text = res.ToString();
            }
        }