On Jan 31, 3:47 am, Scott <[email protected]> wrote:
> I am currently using scipy.optimize.fsolve to solve a 15 and 420
> equation nonlinear system but I would like to try methods other than
> Powell's hybrid.  The answer to the previous become a parameter for
> the next step.  The nonlinear system is polynomial and was created in
> sympy.

As far as I know scipy has more methods to solve nonlinear systems
than mpmath, which implements only Newton's method for
multidimensional functions. This is of course nice to get roots of any
precision.

> sympy.nsolve, mpmath.findroots both provide a variety of solvers but
> the interfaces seem to be less friendly regarding passing parameters
> to the residual function and analytical jacobian.

You can pass your own norm function if you want. Why would you want to
define your own residual? nsolve() needs indeed to be improved to
accept user specified jacobians or to calculate them numerically, at
the moment it's always calculated analytically which might be
inefficient for certain real-life problems.

>    Advice on how to get from :
>         >>> def f(x1, x2):
>         ...     return x1**2 + x2, 5*x1**2 - 3*x1 + 2*x2 - 3
>         ...
>         >>> findroot(f, (0, 0))
>         matrix(
>         [['-0.618033988749895'],
>          ['-0.381966011250105']])
>
> to something like the following would be appreciated.
>         >>> def f(x1, x2,a,b):
>         ...     return a*x1**2 + x2, b*5*x1**2 - 3*x1 + 2*x2 - 3
>         ...
>         >>> findroot(f, parameters=(a,b),(0, 0))
>         matrix(
>         [['-0.618033988749895'],
>          ['-0.381966011250105']])

I think the cleanest way would be to define a new function, like

f2 = lambda x1, x2: f(x1, x2, a, b)

Not sure if I understood your problem correctly however.

Vinzent

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to