[SciPy-User] fsolve with restriction on variable

Ashley DaSilva awesomeashley527 at gmail.com
Mon Aug 3 14:17:05 EDT 2009


Sorry I pressed send by accident.

Warren, thanks for your input.
>
> Do you know a way to add constraints to fsolve, or some other root finding
> technique? If there's no other option, I'll have to go with Harald's
> suggestion, even if it is slow to converge.
>
> Also, does anyone know what the input format is for these minimization
> techniques (fmin_l_bfgs_b, fmin_tnc, fmin_cobyla), I tried:

def f(x):
   return [ n-P(x), n*u-Q(x), n-N(x)]

where P(x), Q(x), N(x) are defined functions and n,u are global constants. I
get the error
TypeError: unsupported operand type(s) for -: 'list' and 'list'
which I think is referring to the numerical approximation to the gradient,
when it tries to subtract f(x)-f0


Ashley



>
>
>
> On Mon, Aug 3, 2009 at 1:55 PM, Warren Weckesser <
> warren.weckesser at enthought.com> wrote:
>
>> Harald Schilly wrote:
>> > On Mon, Aug 3, 2009 at 19:24, Ashley DaSilva<amd405 at psu.edu> wrote:
>> >
>> >> t I don't
>> >> want to find the minimum/maximum of my function, I want to find the
>> root.
>> >>
>> >
>> > Very generally speaking, you can always find the root by minimization,
>> > if you square your function (simply because no negative values are
>> > possible)!
>> >
>> > H
>> > _______________________________________________
>> > SciPy-User mailing list
>> > SciPy-User at scipy.org
>> > http://mail.scipy.org/mailman/listinfo/scipy-user
>> >
>> But this is generally a poor method for finding a root.  It kills the
>> quadratic convergence of Newton's method, which is at the heart (in some
>> form or another) of most good root-finding algorithms.
>>
>> Warren
>>
>>
>> --
>> Warren Weckesser
>> Enthought, Inc.
>> 515 Congress Avenue, Suite 2100
>> Austin, TX  78701
>> 512-536-1057
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20090803/732b62de/attachment.html>


More information about the SciPy-User mailing list