[SciPy-user] how can I get fsolve() work?!

Nils Wagner nwagner at iam.uni-stuttgart.de
Fri Mar 30 10:25:29 EDT 2007


Ri Hai wrote:
>
> Hell folks,
>
> When I use fsolve, python crashes! Now I am testing fsolve with the code from the mailing list:
>  
> #-----------
> from scipy.optimize import fsolve
>  
>  
> def func2(x):
>         out = [x[0]+2.*x[1]+2.*x[2]-1.]
>         out.append(x[0]+x[2] - 2.*x[1])
>         out.append(x[3]+x[4]-1.)
>         out.append(1./5-2./5*x[2]+2./5*x[0]*x[3]-x[0])
>         out.append(1./5-x[1]/5.-x[2]/5.+2/5.*x[1]*x[4]+x[1]/5.-x[1])
>         #out.append(1/5-2/5*x[1]+2*x[2]/5+x[2]*x[3]/5)
>         return out
>  
> x02 = fsolve(func2, [0.25,0.25,0.5,0.5,0.5])
>  
> #----------------
> / /
> The code is taken form the mail from john in July 2006 and he said it did work. However my python crashed again! I really don’t know how to solve this problem.  
>  
> I use python 2.5, scipy 0.5.2, numpy 1.01 and windows XP.
>  
> Has someone the same problem? Can somebody help me? Please…
>  
> Hai 
>     
>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>   

No problem here.
>>> numpy.__version__
'1.0.2.dev3617'
>>> scipy.__version__
'0.5.3.dev2892'

>>> x02
array([ 0.125 , 0.1875, 0.25 , 0.5 , 0.5 ])
>>> func2(x02)
[0.0, 0.0, 0.0, 3.4924590996965321e-11, -1.7462309376270468e-11]

What do you mean by crash ?


Nils




More information about the SciPy-User mailing list