class NR { NewtonRaphson eqn; final static double EPSILON = 1e-10; public NR(NewtonRaphson eqn) { this.eqn = eqn; } // End NR() double solve(double start) { double x = start; while(Math.abs(eqn.f(x)) >= EPSILON) { x = x - eqn.f(x)/eqn.fdash(x); } return x; } // End solve() } // End class NR