private void Sims()
        {
            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();

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

                    t1.Stop();

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

                    hints.Text = "работаем...";
                }
                else
                {
                    hints.Text = "Проверьте корректность введенных данных";
                }
            }
            else
            {
                hints.Text = "Введите параметры интегрирования";
            }
        }
예제 #2
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 = "Введите параметры интегрирования";
            }
        }