Implementation newton-method

implement root function