BUG: optimize: if line search fails, don't update position

Fix bugs in routines updating the current function value by what was
returned by a failed line search.
BUG: optimize: make _minimize_newtoncg use wolfe criterion line search

The Wolfe condition should guarantee better properties vs. stagnation.
Note that TNC (almost the same as newtoncg) also uses Wolfe conditions.

Fixes Trac #1778
BUG: optimize: do not use magic numbers in line search initialization

Set the old_old_fval to None, so that the initial step size is 1.0.
(Initialization with the magic number also leads to the same condition,
but it's better to be explicit.)
BUG: optimize/linesearch: _zoom() should indicate a failure if maxiter is reached, rather than returning a step size that doesn't satisfy the conditions
TST: optimize: add test for what happens when line searches fail