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

Steve Schmerler elcorto@gmx....
Fri Mar 30 10:25:14 CDT 2007


Nils Wagner wrote:
> Ri Hai wrote:
>> -----Ursprüngliche Nachricht-----
>> Von: scipy-user-bounces@scipy.org [mailto:scipy-user-bounces@scipy.org] Im Auftrag von Nils Wagner
>> Gesendet: Freitag, 30. März 2007 16:25
>> An: SciPy Users List
>> Betreff: Re: [SciPy-user] how can I get fsolve() work?!
>>
>> 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@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
>>
>> ---------------------------------
>> Hello Nils,
>>
>>
>> Using fsolve, I get the following error message (in German and I have translated it): 
>>
>> "pythonw.exe ascertained a problem and python will be closed now."
>>
>> So I could not even know what is wrong. 
>>
>> I have tried with your commands. You can see the information below.    
>>
>>   
>>>>> numpy.__version__
>>>>>         
>> '1.0.1'
>>   
>>>>> scipy.__version__
>>>>>         
>> '0.5.2'
>>
>> Is there anything wrong with the version I have taken?
>>
>>   
> I don't think so. It seems to be a Windows specific problem.
> 
> Nils
> 

This may be the case.

Some days ago I had to convert some code to work also under Windows 
(Python 2.5, scipy 0.5.2, numpy 1.0.1).

The code "crashed" with a message box saying the same thing as on Ri's 
machine (although it was "python.exe", not "pythonw.exe" I think). Part 
of the code uses scipy's odeint. Clicking on "Details" I found that the 
crash occured when Python tried to load _odepack.pyd (same as 
_odepack.so on *nix). Just for the record, with Python 2.4.4 under Win 
it gave me some DLL load error.

Testing it on other Win boxes (also XP running) the code executed 
without error. So I blamed a crappy Win installation and didn't 
investigate it further (I didn't try using functions that call other 
*.pyd libs like _zeros.pyd called by the brentq, brenth, bisect, for 
example).

hth
-- 
cheers,
steve

Random number generation is the art of producing pure gibberish as 
quickly as possible.


More information about the SciPy-user mailing list