public static void Main(string[] args) { MyFunction MyF = new MyFunction(); int iterations = 10000; double tolerance = 0.001; double root = Bisection(MyF, -100.0, 100.0, tolerance, iterations); if (root != double.NaN) { Console.WriteLine( "An approximate root of f(x) = x^3 - 3x^2 - 3x + 1 is {0}", root); } else { Console.WriteLine("Could not find the root"); } }
public static void Main(string[] args) { MyFunction MyF = new MyFunction(); int iterations = 10000; double tolerance = 0.001; double root = Bisection (MyF, -100.0, 100.0, tolerance, iterations); if (root != double.NaN) Console.WriteLine ( "An approximate root of f(x) = x^3 - 3x^2 - 3x + 1 is {0}", root); else Console.WriteLine ("Could not find the root"); }