@@ -0,0 +1,916 @@
+package newton;%0A%0A%0A/** Represents the Newton method.%0A * @author Alan Ponte.*/%0Apublic class NewtonSolver %7B%0A%09%0A%09/** Creates a new solver with the Polynoomial P, the %0A%09 * derivative of the Polynomial, DF, and an initial guess of GUESS.%0A%09 * The solver will run until the TOLERANCE is reached.*/%0A%0A%09public NewtonSolver(Polynomial p, Polynomial df, double guess, double tolerance) %7B%0A%09%09_poly = p;%0A%09%09_guess = guess;%0A%09%09_df = df;%0A%09%09_tol = tolerance;%0A%09%7D%0A%09%0A%09/** Returns the tolerance of THIS solver.*/%0A%09public double getTolerance() %7B%0A%09%09return _tol;%0A%09%7D%0A%09/**Returns the result of applying newton's method.*/%0A%09public double solve() %7B%0A%09%09int i = 0;%0A%09%09double p = 0.0;%0A%09%09while (true) %7B%0A%09%09%09p = _poly.valueAt(_guess)/_df.valueAt(_guess);%0A%09%09%09if (Math.abs(p - _guess) %3C _tol) %7B%0A%09%09%09%09break;%0A%09%09%09%7D%0A%09%09%09p = _guess;%0A%09%09%09i += 1;%0A%09%09%7D%0A%09%09return p;%0A%09%7D%0A%09%0A%09private Polynomial _poly;%0A%09private Polynomial _df;%0A%09private double _guess;%0A%09private double _tol;%0A%0A%7D%0A

Create NewtonSolver.java