Exemplo n.º 1
0
        private void Components(object sender, EventArgs e)
        {
            // Передаємо змінні
            a = (double)numeric1.Value;
            b = (double)numeric2.Value;
            h = (double)numeric3.Value;

            rectanglesMethod.Integrate(a, b, h);
            trapezoidMethod.Integrate(a, b, h);
            simpsonMethod.Integrate(a, b, h);
        }
Exemplo n.º 2
0
 void IBiasingBehavior.Load()
 {
     if (_time.UseDc || _method.Time.Equals(0.0))
     {
         return;
     }
     _integral.Derivative = _biasing.Solution[1];
     _integral.Integrate();
 }
Exemplo n.º 3
0
        private void buttonIntegrate_Click(object sender, EventArgs e)
        {
            a = (double)numericA.Value;
            b = (double)numericB.Value;
            h = (double)numericH.Value;

            if (radioButtonRectangles.Checked)
            {
                integral = new IntegralRectangles();
            }
            else if (radioButtonTrapezoid.Checked)
            {
                integral = new IntegralTrapezoid();
            }
            else if (radioButtonSimpson.Checked)
            {
                integral = new IntegralSimpson();
            }

            label4.Text = "" + integral.Integrate(a, b, h);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Calculates integral with given inputs.
        /// </summary>
        private async void ExecuteCalculateCommand(object parameter)
        {
            _isCalculating = true;
            CalculateCommand.RaiseCanExecuteChanged();

            // Compiles formula expression and gets function pointer on formula.
            var cr = await _compiler.Compile(Formula).ConfigureAwait(false);

            if (cr.Errors.Count == 0)
            {
                // f is function pointer.
                var f = _compiler.GetLambda(cr);
                Result = await _calculator.Integrate(f, From, To, N);
            }

            Application.Current.Dispatcher.Invoke(() =>
            {
                // Enables "Calculate" button.
                _isCalculating = false;
                CalculateCommand.RaiseCanExecuteChanged();
            });
        }