Пример #1
0
        void Calculate()
        {
            Integral_calculate integral = new Integral_calculate();
            int       n = Convert.ToInt32(this._n.Text);
            double    In;
            double    a     = 1;
            double    b     = 100000;
            Stopwatch timer = new Stopwatch();

            if (_check.IsChecked.Value == true)
            {
                timer.Start();
                In = integral.calcParr(n, a, b, x => 32 * x - Math.Log10(2 * x) - 41);
                timer.Stop();
                this._resultText.Text = Convert.ToString(In);
                this._timeText.Text   = Convert.ToString(timer.ElapsedMilliseconds);
                timer.Reset();
            }
            if (_check.IsChecked.Value == false)
            {
                timer.Start();
                In = integral.calcPosl(n, a, b, x => 32 * x - Math.Log10(2 * x) - 41);
                timer.Stop();
                this._resultText.Text = Convert.ToString(In);
                this._timeText.Text   = Convert.ToString(timer.ElapsedMilliseconds);
                timer.Reset();
            }
        }
Пример #2
0
        public void culc(double a, double b)
        {
            Stopwatch          timer = new Stopwatch();
            int                n     = 100000;
            int                nn    = n;
            double             In1   = 0;
            int                kol   = 7;
            Integral_calculate integ = new Integral_calculate();

            (graph3.Model.Series[0] as ColumnSeries).Items.Clear();
            (graph3.Model.Series[1] as ColumnSeries).Items.Clear();
            for (int k = 0; k < kol; k++)
            {
                timer.Start();
                In1 = integ.calcParr(n, a, b, x => 32 * x - Math.Log10(2 * x) - 41);
                timer.Stop();
                (graph3.Model.Series[0] as ColumnSeries).Items.Add(new ColumnItem(timer.ElapsedMilliseconds, n / nn - 1));
                timer.Reset();

                // graph3.InvalidatePlot();

                timer.Start();
                In1 = integ.calcPosl(n, a, b, x => 32 * x - Math.Log10(2 * x) - 41);
                timer.Stop();
                //  (graph3.Model.Series[0] as ColumnSeries).Background.color

                (graph3.Model.Series[1] as ColumnSeries).Items.Add(new ColumnItem(timer.ElapsedMilliseconds, n / nn - 1));
                timer.Reset();

                graph3.InvalidatePlot();
                // MessageBox.Show(Convert.ToString(k));

                n *= 2;
            }
        }
Пример #3
0
        public void culc(double a, double b)
        {
            (graph2.Model.Series[0] as LineSeries).Points.Clear();
            Stopwatch          timer = new Stopwatch();
            int                n     = 100000;
            int                nn    = n;
            double             In1   = 0;
            int                kol   = 7;
            Random             rnd   = new Random();
            Integral_calculate integ = new Integral_calculate();

            for (int k = 0; k < kol; k++)
            {
                timer.Start();
                In1 = integ.calcParr(n, a, b, x => 2 * x - Math.Log10(2 * x) + 234);
                timer.Stop();
                (graph2.Model.Series[0] as LineSeries).Points.Add(new DataPoint(timer.ElapsedMilliseconds, n / nn));
                timer.Reset();

                timer.Reset();

                graph2.InvalidatePlot();
                // MessageBox.Show(In1 + "  " + In2);
                n *= 2;
            }
            graph2.InvalidatePlot();
        }
Пример #4
0
        void Calculate()
        {
            Integral_calculate integral = new Integral_calculate();
            double             In;
            Stopwatch          timer = new Stopwatch();

            if (_check.IsChecked.Value == true)
            {
                task = Task.Run(() =>
                {
                    timer.Start();
                    In = integral.calcParr(n, a, b, x => 2 * x - Math.Log10(2 * x) + 234);
                    timer.Stop();

                    Dispatcher.Invoke(() =>
                    {
                        this._resultText.Text = Convert.ToString(In);
                        this._timeText.Text   = Convert.ToString(timer.ElapsedMilliseconds);
                        ButtonCulc.IsEnabled  = true;
                    });

                    timer.Reset();
                });
            }
            if (_check.IsChecked.Value == false)
            {
                task = Task.Run(() =>
                {
                    timer.Start();
                    In = integral.calcParr(n, a, b, x => 2 * x - Math.Log10(2 * x) + 234);
                    timer.Stop();

                    Dispatcher.Invoke(() =>
                    {
                        this._resultText.Text = Convert.ToString(In);
                        this._timeText.Text   = Convert.ToString(timer.ElapsedMilliseconds);
                        ButtonCulc.IsEnabled  = true;
                    });

                    timer.Reset();
                });
            }
        }