[SciPy-user] python crash in leastsq

Stefan van der Walt stefan at sun.ac.za
Thu Sep 28 13:09:21 CDT 2006


On Thu, Sep 28, 2006 at 10:37:32AM -0700, djf at pdx.edu wrote:
> 
> I receive a segmentation fault from the following code:
> 
>    from scipy.optimize import *
>    from scipy import *
>    # Fit Mean of A*x to Mean of B----------
>    #--------------------------------------
>    def fit(x):
> 	d=mean(x*A)-mean(B)
>    	return d
>    #--------------------------------------
>    A=[1,2]
>    B=[3,4]
>    x0=[1]
>    (x,msg)=leastsq(fit,x0)
>    print x
> 
> Any advice?

I don't see any memory errors running your code with

numpy 1.0.dev3230
scipy 0.5.2.dev2235

It produces the correct answer, 2.3333333.

Which versions of numpy and scipy are you running, and on which
platform?

Regards
Stéfan


More information about the SciPy-user mailing list