1
fsolve Scilab Group Scilab Function fsolve
3
fsolve - find a zero of a system of n nonlinear functions
6
[x [,v [,info]]]=fsolve(x0,fct [,fjac] [,tol])
8
x0 : real vector (initial value of function argument).
10
fct : external (i.e function or list or string).
12
fjac : external (i.e function or list or string).
14
tol : real scalar. precision tolerance: termination occurs when
15
the algorithm estimates that the relative error between x and
16
the solution is at most tol. (tol=1.d-10 is the default value).
18
x : real vector (final value of function argument, estimated
21
v : real vector (value of function at x).
23
info : termination indicator
25
0 : improper input parameters.
27
1 : algorithm estimates that the relative error between x
28
and the solution is at most tol.
30
2 : number of calls to fcn reached
32
3 : tol is too small. No further improvement in the
33
approximate solution x is possible.
35
4 : iteration is not making good progress.
38
find a zero of a system of n nonlinear functions in n variables by a
39
modification of the powell hybrid method. Jacobian may be provided.
42
fct is an "external". This external returns v=fct(x) given x.
44
The simplest calling sequence for fct is:
47
If fct is a character string, it refers to a C or Fortran routine which
48
must be linked to Scilab. Fortran calling sequence must be
52
double precision x(n),v(n)
53
and C Calling sequence must be
55
fct(int *n, double x[],double v[],int *iflag)
56
Incremental link is possible (help link).
58
jac is an "external". This external returns v=d(fct)/dx (x) given x.
60
The simplest calling sequence for jac is:
63
If jac is a character string, it refers to a to a C or Fortran routine
64
which must be linked to Scilab calling sequences are the same as those
65
for fct. Note however that v must be a nxn array.
68
// A simple example with fsolve
69
a=[1,7;2,8];b=[10;11];
70
deff('[y]=fsol1(x)','y=a*x+b');
71
deff('[y]=fsolj1(x)','y=a');
72
[xres]=fsolve([100;100],fsol1);
74
[xres]=fsolve([100;100],fsol1,fsolj1);
76
// See routines/default/Ex-fsolve.f
77
[xres]=fsolve([100;100],'fsol1','fsolj1',1.e-7);
80
external, quapro, linpro, optim