[SciPy-User] possible bug in scipy 0.10.1 newton_krylon solver

Wu Degang samuelandjw@gmail....
Tue Jun 19 18:28:07 CDT 2012


Pauli Virtanen wrote:

> Based on the output, it looks like you are actually running the code as:
>
>       sol = newton_krylov(func,guess,line_search=False,verbose=1)
>
> Note the value of the `line_search` parameter.

I have just checked the document (for 0.10.1) that comes with the 
release, and I found that

"    line_search : {None, 'armijo' (default), 'wolfe'}, optional
         Which type of a line search to use to determine the step size 
in the
         direction given by the Jacobian approximation. Defaults to 
'armijo'."

So the default is 'armijo'. I tried to use line_search=None, and 
line_search = 'wolfe' (also for 0.10.1). The output was exactly the same.

bash-3.2$ python entropy_1_und_step1.py
0:  |F(x)| = 1308.14; step 1; tol 8.46824e-05
entropy_1_und_step1.py:39: RuntimeWarning: overflow encountered in exp
   new_lhs[i] = k_seq[i] - (N-1) + np.sum(1/(1+np.exp(ws[i]+ws))) - 
1/(1+np.exp(2*ws[i]))
1:  |F(x)| = 181529; step 1; tol 0.9999
2:  |F(x)| = 128432; step 1; tol 0.89982
3:  |F(x)| = 128000; step 1; tol 0.893968
4:  |F(x)| = 89085; step 1; tol 0.719261
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/linalg/isolve/lgmres.py:264: 
RuntimeWarning: invalid value encountered in divide
   outer_v.append((dx/nx, None))
Traceback (most recent call last):
   File "entropy_1_und_step1.py", line 44, in <module>
     sol = newton_krylov(func,guess,line_search=None,verbose=1)
   File "<string>", line 8, in newton_krylov
   File 
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/optimize/nonlin.py", 
line 297, in nonlin_solve
     raise ValueError("Jacobian inversion yielded zero vector. "
ValueError: Jacobian inversion yielded zero vector. This indicates a bug 
in the Jacobian approximation.


bash-3.2$ python entropy_1_und_step1.py
0:  |F(x)| = 1308.14; step 1; tol 8.46824e-05
entropy_1_und_step1.py:39: RuntimeWarning: overflow encountered in exp
   new_lhs[i] = k_seq[i] - (N-1) + np.sum(1/(1+np.exp(ws[i]+ws))) - 
1/(1+np.exp(2*ws[i]))
1:  |F(x)| = 181529; step 1; tol 0.9999
2:  |F(x)| = 128432; step 1; tol 0.89982
3:  |F(x)| = 128000; step 1; tol 0.893968
4:  |F(x)| = 89085; step 1; tol 0.719261
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/sparse/linalg/isolve/lgmres.py:264: 
RuntimeWarning: invalid value encountered in divide
   outer_v.append((dx/nx, None))
Traceback (most recent call last):
   File "entropy_1_und_step1.py", line 44, in <module>
     sol = newton_krylov(func,guess,line_search='wolfe',verbose=1)
   File "<string>", line 8, in newton_krylov
   File 
"/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/optimize/nonlin.py", 
line 297, in nonlin_solve
     raise ValueError("Jacobian inversion yielded zero vector. "
ValueError: Jacobian inversion yielded zero vector. This indicates a bug 
in the Jacobian approximation.


More information about the SciPy-User mailing list