Ondrej,
I will use your global parameter suggestion in the short term and take
a look at patching the code to allow an 'args' argument like in
scipy.optimize.fsolve .
Vinzent
By residual I meant the system of nonlinear equations I am trying to
find the roots of. Such as [a*x1**2 + x2, b*5*x1**2 - 3*x1 + 2*x2 -
3]
>>> 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']])
In scipy.optimize.fsolve I did not see any flags to use a non-default
system solver.
sympy and mpmath also have the benefit of be easily built with pure
python.
I am still having issues packaging my system in a format compatible
nsolve (no evalf) or findroot (cannot create mpf from array).
I am starting with :
import numpy
import sympy
sympy.var('x1,x2,a,b')
f1=list(a*x1**2 + x2, b*5*x1**2 - 3*x1 + 2*x2 - 3)
x=list(x1,x2)
x0=numpy.array([.5,.5])
para=list(a,b)
a=3
b=2
x01=copy(x0)
nsolve(f1,x,x01)
How to best relate f1,x and para list is the question?
--
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.