[SciPy-user] leastsq and Jacobian

Stephen Walton stephen.walton at csun.edu
Fri Mar 4 17:03:32 CST 2005


I find that the following script consistently core dumps (scipy latest 
CVS, Numeric 23.7, ATLAS 3.6.0) on both FC1 and FC3 when I say "python 
script.py" at the command line.  I was trying to test problems others 
have reported using the Jacobian argument to leastsq, including a 
message way back in April 2003 from John Hunter.

I'm pretty familiar with MINPACK, having used it to fit some functions a 
while back.  Where might I start looking for the problem?

from Numeric import *
import scipy as S

def ros(x):
   return array([10*(x[0] - x[1]**2), 1-x[1]])

def dros(x):
   return array([[-20*x[0], 10],[-1,0]])

def dros_trans(x):
   return array([[-20*x[0], -1],[10,0]])

x0=[-1.2,1.0]

print "No Jacobian:"
print S.optimize.leastsq(ros,x0)

print "With Jacobian, try 1:"
print S.optimize.leastsq(ros,x0,Dfun=dros)

print "With Jacobian, try 2:"
print S.optimize.leastsq(ros,x0,Dfun=dros_trans)

print "With Jacobian, try 3:"
print S.optimize.leastsq(ros,x0,Dfun=dros,col_deriv=1)

print "With Jacobian, try 4:"
print S.optimize.leastsq(ros,x0,Dfun=dros_trans,col_deriv=1)



More information about the SciPy-user mailing list