Line search methods for optimization and root-finding