public class MyFunctions { /** * There are lots of functions here, and one must edit this code to select which * function is to be used. One must also make sure that the function and the * derivative are selected together. **/ public static double f(double x) { double f1,f2,f3,f4,f5; f1 = x*x*x + 3.0*x + 1.0; f2 = x*x - 101.0; // simple square root f3 = x*x + 2.0*x + 1; // (x+1)^2 f4 = x*x + 1; // no real root exists f5 = x*x*x*x - 10.0*x*x*x + 35.0*x*x - 50.0* x + 24.0; // roots 1, 2, 3, 4 return f5; } public static double fprime(double x) { double fp1,fp2,fp3,fp4,fp5; fp1 = 3.0*x*x + 3.0; fp2 = 2.0*x; fp3 = 2.0*x + 2.0; fp4 = 2.0*x; fp5 = 4.0*x*x*x - 30.0*x*x + 70.0*x - 50.0; return fp5; } }