private double SimpleIterativeMethodRun() { var method = new SimpleIterativeMethod(function1, derivative, a1, b1, eps); double root = method.Calculate(); Plots.DrawSimpleMethodFunction(method.Roots); return(root); }
public void QuadraticTest() { double func(double x) => 2 * x * x - 4; double deriv(double x) => 4 * x; double a = 0; double b = 5; double eps = 0.00001; var simpleIterMethod = new SimpleIterativeMethod(func, deriv, a, b, eps); double root = simpleIterMethod.Calculate(); Assert.AreEqual(1.4142, Math.Round(root, 4)); }
public void LinearTest() { double func(double x) => 3 * x - 2; double deriv(double x) => 3; double a = 1; double b = 10; double eps = 0.00001; var simpleIterMethod = new SimpleIterativeMethod(func, deriv, a, b, eps); double root = simpleIterMethod.Calculate(); Assert.AreEqual(0.6667, Math.Round(root, 4)); }