Correct numerical errors in Newton-Raphson

This correct two different problems with the N-R implementation.

1) Floating point precision

We had

    z = np.array([1.65685650e-179,   1.98728692e-179])
    denom = 2.01875531e-179

and wanted to calculate a2

    a2 = np.dot(z.T, z) / denom**2
    # Result: 0/0 = NaN

This meant squaring a number with 179 zero decimal points, which
resulted in a number with 358 zero decimal points, which exceeds
the maximum possible 324. Changing the order in the arithmetic solves
this particular problem though:

     a2 = np.dot(z.T / denom, z / denom)
     # Result: 1.64266749603

2) Exploding convergence in N-R

In case of noise-less data, the function managed to converge "too
well". This resulted in a overflowed result from the linear solver,
meaning delta went to a huge positive number and the numerics
exploded.

I have implemented a maximum allowed step size (10 seemed appropriate)
and a maximum number of iteration steps (50 is enough). If the delta is
too large, step size is divided by 2 and the algorithm tries again. A
lower limit of the step size is set at 0.001.

Signed-off-by: Jonas Kalderstam <jonas@kalderstam.se>