fsolve — find a zero of a system of n nonlinear functions
[x [,v [,info]]]=fsolve(x0,fct [,fjac] [,tol])
real vector (initial value of function argument).
external (i.e function or list or string).
external (i.e function or list or string).
real scalar. precision tolerance: termination occurs when the
algorithm estimates that the relative error between x and the
solution is at most tol. (tol=1.d-10
is the
default value).
real vector (final value of function argument, estimated zero).
real vector (value of function at x).
termination indicator
improper input parameters.
algorithm estimates that the relative error between x and the solution is at most tol.
number of calls to fcn reached
tol is too small. No further improvement in the approximate solution x is possible.
iteration is not making good progress.
find a zero of a system of n nonlinear functions in n variables by a modification of the powell hybrid method. Jacobian may be provided.
0 = fct(x) w.r.t x.
fct
is an "external". This external returns
v=fct(x)
given x
.
The simplest calling sequence for fct
is:
[v]=fct(x).
If fct
is a character string, it refers to a C or
Fortran routine which must be linked to Scilab. Fortran calling sequence
must be
fct(n,x,v,iflag) integer n,iflag double precision x(n),v(n)
and C Calling sequence must be
fct(int *n, double x[],double v[],int *iflag)
Incremental link is possible (help link
).
jac
is an "external". This external returns
v=d(fct)/dx (x)
given x
.
The simplest calling sequence for jac
is:
[v]=jac(x).
If jac
is a character string, it refers to a to a
C or Fortran routine which must be linked to Scilab calling sequences are
the same as those for fct. Note however that v must be a nxn array.
// A simple example with fsolve a=[1,7;2,8];b=[10;11]; deff('[y]=fsol1(x)','y=a*x+b'); deff('[y]=fsolj1(x)','y=a'); [xres]=fsolve([100;100],fsol1); a*xres+b [xres]=fsolve([100;100],fsol1,fsolj1); a*xres+b // See routines/default/Ex-fsolve.f [xres]=fsolve([100;100],'fsol1','fsolj1',1.e-7); a*xres+b