Add newton method implementation