Esempio n. 1
0
        private void DrawGraph41(double a, double b)
        {
            int numb = 16;

            int nom = 100000000;

            chart4.Series[1].Points.Clear();

            Stopwatch sw41 = new Stopwatch();

            sw41.Start();

            Integral integ41  = new Integral(a, b, nom, SumIntegral);
            double   integ411 = integ41.CalcThreadPool(numb);

            sw41.Stop();
            long time41 = sw41.ElapsedMilliseconds;

            sw41.Reset();
            chart4.Series[1].Points.AddY(time41);
        }
Esempio n. 2
0
        private void DrawGraph()
        {
            chartNTime.Series[0].Points.Clear();
            int    nStart  = 10000000;
            int    nFinish = 100000000;
            int    nStep   = 20000000;
            double a       = Convert.ToDouble(tbA.Text);
            double b       = Convert.ToDouble(tbB.Text);

            Stopwatch sw = new Stopwatch();

            for (int n = nStart; n < nFinish; n += nStep)
            {
                sw.Start();

                Integral integ  = new Integral(a, b, n, SumIntegral);
                double   integ0 = integ.CalcRectangle(a, b, n, x => SumIntegral(x));


                //  Integral integ = new Integral.CalcRectangle(a, b, n, x => SumIntegral(x));

                sw.Stop();
                long time = sw.ElapsedMilliseconds;
                sw.Reset();
                chartNTime.Series[0].Points.AddXY(n, time);
            }

            ///////////////////////////////////////////////////////
            chartNTime.Series[1].Points.Clear();
            int nStart20  = 10000000;
            int nFinish20 = 100000000;
            int nStep20   = 20000000;
            // double a = Convert.ToDouble(tbA.Text);
            // double b = Convert.ToDouble(tbB.Text);

            Stopwatch sw20 = new Stopwatch();

            for (int n = nStart20; n < nFinish20; n += nStep20)
            {
                sw20.Start();

                Integral integ1  = new Integral(a, b, n, SumIntegral);
                double   integ20 = integ1.CalcRectanglePar(a, b, n);


                //  Integral integ = new Integral.CalcRectangle(a, b, n, x => SumIntegral(x));

                sw20.Stop();
                long time1 = sw20.ElapsedMilliseconds;
                sw20.Reset();
                chartNTime.Series[1].Points.AddXY(n, time1);
            }
            ///////////////////////////////////////////////////////////////////////////////

            ///////////////////////////////////////////////////////

            chartNTime2.Series[0].Points.Clear();

            int       nStart21  = 1;
            int       nFinish21 = 15;
            int       nStep21   = 1;
            int       nom       = 100000000;
            Stopwatch sw21      = new Stopwatch();

            for (int numb = nStart21; numb < nFinish21; numb += nStep21)
            {
                sw21.Start();

                Integral integ2  = new Integral(a, b, nom, SumIntegral);
                double   integ21 = integ2.CalcThreadPool(numb);
                sw21.Stop();
                long time2 = sw21.ElapsedMilliseconds;
                sw21.Reset();
                chartNTime2.Series[0].Points.AddXY(numb, time2);
            }
            ///////////////////////////////////////////////////////////////////////////////

            DrawGraph30(a, b);
            DrawGraph31(a, b);
            DrawGraph40(a, b);
            DrawGraph41(a, b);
        }