Example #1
0
        ///////////////////////////////////////////////////////////////////////////////

        private void DrawGraph31(double a, double b)
        {
            chart3.Series[1].Points.Clear();

            //int nStart31 = 10000000;
            //int nFinish31 = 100000000;
            //int nStep31 = 20000000;
            //double a = Convert.ToDouble(tbA.Text);
            //double b = Convert.ToDouble(tbB.Text);
            int nom31 = 100000000;

            Stopwatch sw31 = new Stopwatch();

            //for (int n = nStart31; n < nFinish31; n += nStep31)
            //{
            sw31.Start();

            Integral integ31  = new Integral(a, b, nom31, SumIntegral);
            double   integ311 = integ31.CalcRectanglePar(a, b, nom31);


            sw31.Stop();
            long time31 = sw31.ElapsedMilliseconds;

            sw31.Reset();
            chart3.Series[1].Points.AddY(time31);
        }
Example #2
0
        //}
        ///////////////////////////////////////////////////////////////////////////////


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



        private void DrawGraph40(double a, double b)
        {
            int n = 100000000;

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

            Stopwatch sw40 = new Stopwatch();

            sw40.Start();

            Integral integ40 = new Integral(a, b, n, SumIntegral);

            double integ400 = integ40.CalcRectanglePar(a, b, n);

            sw40.Stop();
            long time40 = sw40.ElapsedMilliseconds;

            sw40.Reset();
            chart4.Series[0].Points.AddY(time40);
        }
Example #3
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);
        }