private void pSims()
        {
            if ((border__a.Text != "") && (border__b.Text != "") && (step_in.Text != ""))
            {
                IntegralMath q = new IntegralMath();
                double       num1, num2, num3;

                string a = border__a.Text;
                string b = border__b.Text;
                string h = step_in.Text;

                bool AisNum = double.TryParse(a, out num1);
                bool BisNum = double.TryParse(b, out num2);
                bool MisNum = double.TryParse(h, out num3);

                if ((AisNum) && (BisNum) && (MisNum) && (num1 <= num2) && (num3 > 0) && (num1 > 0.0))
                {
                    Stopwatch t1 = Stopwatch.StartNew();

                    pSims_out.Text = Convert.ToString(Math.Round(q.pSims(num1, num2, num3, x => 2.0 * x - Math.Log(2.0 * x) + 234.0), 3));

                    t1.Stop();

                    epSims.Text = Convert.ToString(t1.Elapsed);

                    hints.Text = "работаем...";
                }
                else
                {
                    hints.Text = "Проверьте корректность введенных данных";
                }
            }
        }
        private void Trap()
        {
            if ((border__a.Text != "") && (border__b.Text != "") && (step_in.Text != ""))
            {
                IntegralMath p = new IntegralMath();
                double       num1, num2, num3;

                string a = border__a.Text;
                string b = border__b.Text;
                string h = step_in.Text;

                bool AisNum = double.TryParse(a, out num1);
                bool BisNum = double.TryParse(b, out num2);
                bool HisNum = double.TryParse(h, out num3);

                if ((AisNum) && (BisNum) && (HisNum) && (num1 <= num2) && (num3 >= 0.0) && (num1 > 0.0))
                {
                    Stopwatch t1 = Stopwatch.StartNew();

                    Trap_out.Text = Convert.ToString(Math.Round(p.Trap(num1, num2, num3, x => 2.0 * x - Math.Log(2.0 * x) + 234.0), 3));

                    t1.Stop();

                    eTrap.Text = Convert.ToString(t1.Elapsed);

                    hints.Text = "работаем...";
                }
                else
                {
                    hints.Text = "Проверьте корректность введенных данных";
                }
            }
            else
            {
                hints.Text = "Введите параметры интегрирования";
            }
        }
Exemplo n.º 3
0
        private void Sims()
        {
            if ((border__a.Text != "") && (border__b.Text != "") && (iter.Text != ""))
            {
                IntegralMath q = new IntegralMath();
                double       num1, num2; int num3;

                string a = border__a.Text;
                string b = border__b.Text;
                string m = iter.Text;

                bool AisNum = double.TryParse(a, out num1);
                bool BisNum = double.TryParse(b, out num2);
                bool MisNum = int.TryParse(m, out num3);

                if ((AisNum) && (BisNum) && (MisNum) && (num1 <= num2) && (num3 > 0) && (num1 > 0.0))
                {
                    DateTime t1 = DateTime.Now;

                    Sims_out.Text = Convert.ToString(Math.Round(q.Sims(num1, num2, num3, x => 2.0 * x - Math.Log(2.0 * x) + 234.0), 3));

                    TimeSpan time = DateTime.Now - t1;
                    eSims.Text = Convert.ToString(time.TotalSeconds) + " сек";

                    hints.Text = "котик доволен ;)";
                }
                else
                {
                    hints.Text = "Проверьте корректность введенных данных";
                }
            }
            else
            {
                hints.Text = "Введите параметры интегрирования";
            }
        }