bgoli at sun.ac.za
Thu Aug 18 08:47:13 CDT 2005
This is a simple example but perhaps it will help:
x0 = 10.0
x2 = 0.0
init_val = [10,20]
sdot = scipy.zeros((2),'d')
sdot = (10.0*x0 - s)-(5.0*s - s)
sdot = (5.0*s - s)-(s - x2)
sres = scipy.optimize.fsolve(DE_explicit_ss, init_val)
"fsolve" is a wrapper around MINPACK's hybrd and hybrj algorithms.
c the purpose of hybrd is to find a zero of a system of
c n nonlinear functions in n variables by a modification
c of the powell hybrid method. the user must provide a
c subroutine which calculates the functions. the jacobian is
c then calculated by a forward-difference approximation.
On Thursday 18 August 2005 15:14, Ryan Krauss wrote:
> Yes, I think it is doing exactly what Matlab would do. You can have a
> vector input, you just need to have a scalar output that you are trying
> to drive to zero.
> Howey, David A wrote:
> > Thanks for this... interesting.
> > What I'm trying to do eventually use fsolve to solve for two unknowns
> > (call them p and v) in two non-linear equations (call them F1, F2). In
> > matlab, one would define a vector function say myfunc returning a vector
> > F with F(1) (first element in the vector) evaluating to the first
> > equation and F(2) to the second. The function would accept a vector
> > input, say x, which is = [ p ; v]. ie a vector of the two unknowns.
> > Do you think scipy's fsolve can work on vectors (arrays) like this in the
> > same way?
> > Dave
> > ------------------------------------------------------------------------
> > _______________________________________________
> > SciPy-user mailing list
> > SciPy-user at scipy.net
> > http://www.scipy.net/mailman/listinfo/scipy-user
> SciPy-user mailing list
> SciPy-user at scipy.net
Brett G. Olivier Ph.D.
Triple-J Group for Molecular Cell Physiology
bgoli at sun dot ac dot za http://glue.jjj.sun.ac.za/~bgoli
Tel +27-21-8082704 Fax +27-21-8085863 Mobile +27-82-7329306
I wouldn't be so paranoid if you weren't all out to get me!!
More information about the SciPy-user