private void integrateDoubles() { double a = double.Parse(intervalA.Text); double b = double.Parse(intervalB.Text); double c = double.Parse(intervalC.Text); double d = double.Parse(intervalD.Text); double eps = double.Parse(epsilon.Text); if (eps >= 1 || eps < 0) { throw new Exception("Epsilon must me between 0 and 1"); } DoubleIntegrals p = new DoubleIntegrals(function.Text); KeyValuePair <double, int> res; _dummyCollection.Clear(); _dummyCollection.Add(new IntegrateResult { Method = "SimpsonSmall", Value = p.IntegralSimpsonSmall(a, b, c, d) }); res = p.Calculate(a, b, c, d, p.IntegralSimpson, eps); _dummyCollection.Add(new IntegrateResult { Method = "SimsponBig", Value = res.Key, Intervals = res.Value }); res = p.Calculate(a, b, c, d, p.IntegralMonteCarlo, eps); _dummyCollection.Add(new IntegrateResult { Method = "Monte Carlo", Value = res.Key, Intervals = res.Value }); dataGrid1.ItemsSource = _dummyCollection; }
private void integrateDoubles() { double a = double.Parse(intervalA.Text); double b = double.Parse(intervalB.Text); double c = double.Parse(intervalC.Text); double d = double.Parse(intervalD.Text); double eps = double.Parse(epsilon.Text); if (eps >= 1 || eps < 0) { throw new Exception("Epsilon must me between 0 and 1"); } DoubleIntegrals p = new DoubleIntegrals(function.Text); KeyValuePair<double, int> res; _dummyCollection.Clear(); _dummyCollection.Add(new IntegrateResult {Method = "SimpsonSmall", Value = p.IntegralSimpsonSmall(a, b, c, d)}); res = p.Calculate(a, b, c, d, p.IntegralSimpson, eps); _dummyCollection.Add(new IntegrateResult {Method = "SimsponBig", Value = res.Key, Intervals = res.Value }); res = p.Calculate(a, b, c, d, p.IntegralMonteCarlo, eps); _dummyCollection.Add(new IntegrateResult {Method = "Monte Carlo", Value = res.Key, Intervals = res.Value}); dataGrid1.ItemsSource = _dummyCollection; }