Ejemplo n.º 1
0
        private void DrawGraph30(double a, double b)
        {
            chart3.Series[0].Points.Clear();

            //  int nStart30 = 10000000;
            //int nFinish30 = 100000000;
            // int nStep30 = 20000000;
            //double a = Convert.ToDouble(tbA.Text);
            //double b = Convert.ToDouble(tbB.Text);

            Stopwatch sw30 = new Stopwatch();

            //   for (int n = nStart30; n < nFinish30; n += nStep30)
            //  {
            int nom30 = 100000000;

            sw30.Start();

            Integral integ30  = new Integral(a, b, nom30, SumIntegral);
            double   integ300 = integ30.CalcRectangle(a, b, nom30, x => SumIntegral(x));

            sw30.Stop();
            long time30 = sw30.ElapsedMilliseconds;

            sw30.Reset();
            chart3.Series[0].Points.AddY(time30);
            //   }
        }
Ejemplo 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);
        }