Algorithm For Newton Raphson Method Problems