[SciPy-user] fsolve side affecting output
matt
matt at hotdispatch.com
Tue Jul 27 12:48:57 EDT 2004
Super, thanks.
-Matt
On Jul 27, 2004, at 3:48 AM, Gerard Vermeulen wrote:
> On Mon, 26 Jul 2004 16:55:38 -0400
> matt <matt at hotdispatch.com> wrote:
>
>> optimize.fsolve returns the inputs that result in a zero for the
>> function it is passed. It doesn't, however, throw an exception or
>> give a special return value when it dumps one of these warnings to
>> standard out.
>>
>> Is there a way to supress the dumps to std out? I still want my print
>> commands to be visible, so I can't just redirect everything that goes
>> to std out.
>>
>> Does anyone know if there are plans to add an exception or success
>> code
>> to the output of this function?
>>
>> -Matt
>
> If you do:
>
>>>> from scipy import *
>>>> help(optimize.fsolve)
>
> you'll see that you can set full_output = 1 to get all information
> about
> success or failure of the algorithm, which I use in Python programs. As
> a side effect it suppresses the dumps to standard out:
>
>>>> def g(x): return x*x+1
> ...
>>>> optimize.fsolve(g, 10.0, full_output=1)
> (-7.5682952661081625e-05, {'qtf': array([-1.00000001]), 'nfev': 34,
> 'fjac': array([ [-1.]]), 'r': array([-0.00108154]), 'fvec':
> array([ 1.00000001])}, 5, 'The iteration is not making good progress,
> as measured by the \n improvement from the last ten iterations.')
>>>>
>
> The dumps to standard out are perfectly fine to me when I am using the
> interpreter.
>
> Gerard
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
>
More information about the SciPy-User
mailing list