Syntax
[r,nn,[,hd]] = dasrt(x0,t0,t [,atol,[rtol]],res [,jac],ng, surf [,info] [,hd])
Arguments
- x0
- is either - y0(- ydot0is estimated by- dasslwith zero as first estimate) or the matrix- [y0 ydot0].- g(t,y0,ydot0)must be equal to zero. If you only know an estimate of- ydot0set- info(7)=1.- y0
- a real column vector of initial conditions. 
- ydot0
- a real column vector of the time derivative of - yat- t0(may be an estimate).
 
- t0
- a real number, it is the initial instant. 
- t
- a real scalar or vector. Gives instants for which you want the solution. Note that you can get solution at each dassl's step point by setting - info(2)=1.
- nn
- a vector with two entries - [times num]- timesis the value of the time at which the surface is crossed,- numis the number of the crossed surface.
- atol, rtol
- real scalars or column vectors of same size as - yor both of size 1.- atol, rtolgive respectively absolute and relative error tolerances of solution. If vectors, the tolerances are specified for each component of- y.
- res
- external (function or list or string). Computes the value of - g(t,y,ydot). It may be :- A Scilab function. - Its syntax must be - [r,ires]=res(t,y,ydot)and- resmust return the residue- r=g(t,y,ydot)and error flag- ires.- ires = 0if- ressucceeds to compute- r,- =-1if residue is locally not defined for- (t,y,ydot),- =-2if parameters are out of admissible range.
- A list. - This form allows to pass parameters other than t,y,ydot to the function. It must be as follows: - list(res,x1,x2,...) - where the syntax of the function - resis now- r = res(t,y,ydot,x1,x2,...) - resstill returns- r=g(t,y,ydot)as a function of- (t,y,ydot,x1,x2,...). Warning: this form must not be used if there is no extra argument to pass to the function. Warning: this form must not be used if there is no extra argument to pass to the function.
- A string. - It must refer to the name of a C or Fortran subroutine linked with Scilab. - In C The syntax must be: - void res(double *t, double y[], double yd[], double r[], int *ires, double rpar[], int ipar[])- In Fortran it must be: - subroutine res(t,y,yd,r,ires,rpar,ipar) double precision t, y(*),yd(*),r(*),rpar(*) integer ires,ipar(*) - The - rparand- ipararrays must be present but cannot be used.
 
- jac
- external (function or list or string). Computes the value of - dg/dy + cj*dg/dydotfor a given value of parameter- cj.- A Scilab function. - Its syntax must be - r=jac(t,y,ydot,cj)and the- jacfunction must return- r=dg(t,y,ydot)/dy+cj*dg(t,y,ydot)/dydotwhere- cjis a real scalar.
- A list. - It must be as follows - list(jac,x1,x2,...) - where the syntax of the function - jacis now- r = jac(t,y,ydot,cj,x1,x2,...) - jacstill returns- dg/dy + cj*dg/dydotas a function of- (t,y,ydot,cj,x1,x2,...).
- A character string. - It must refer to the name of a Fortran subroutine linked with scilab - In C The syntax must be: - void jac(double *t, double y[], double yd[], double pd[], double *cj, double rpar[], int ipar[])- In Fortran it must be: - subroutine jac(t,y,yd,pd,cj,rpar,ipar) double precision t, y(*),yd(*),pd(*),cj,rpar(*) integer ipar(*) 
 
- surf
- external (function or list or string). Computes the value of the column vector - surf(t,y)with- ngcomponents. Each component defines a surface. It may be defined by:- A Scilab function. - Its syntax must be - surf(t,y)
- A list. - It must be as follows - list(surf,x1,x2,...) - where the syntax of the function - surfis now- r = surf(t,y,x1,x2,...) 
- A character string. - It must refer to the name of a Fortran subroutine linked with scilab. - In C the syntax must be: - void surf(int *ny, double *t, double y[], int *ng, double gout[]) - In Fortran it must be: - subroutine surf(ny,t,y,ng,gout) double precision t, y(*),gout(*) integer ny,ng 
 
- info
- list which contains - 7elements. Default value is- list([],0,[],[],[],0,0).- info(1)
- real scalar which gives the maximum time for which - gis allowed to be evaluated or an empty matrix- []if no limits imposed for time.
- info(2)
- flag which indicates if - dasslreturns its intermediate computed values (- flag=1) or only the user specified time point values (- flag=0).
- info(3)
- 2components vector which give the definition- [ml,mu]of band matrix computed by- jac;- r(i - j + ml + mu + 1,j) = "dg(i)/dy(j)+cj*dg(i)/dydot(j)".If- jacreturns a full matrix set- info(3)=[].
- info(4)
- real scalar which gives the maximum step size. Set - info(4)=[]if no limitation.
- info(5)
- real scalar which gives the initial step size. Set - info(5)=[]if not specified.
- info(6)
- set - info(6)=1if the solution is known to be non negative, else set- info(6)=0.
- info(7)
- set - info(7)=1if- ydot0is just an estimation,- info(7)=0if- g(t0,y0,ydot0)=0.
 
- hd
- real vector which allows to store the - dasslcontext and to resume integration.
- r
- real matrix . Each column is the vector - [t;x(t);xdot(t)]where- tis time index for which the solution had been computed.
Description
Solution of the implicit differential equation.
g(t,y,ydot) = 0 y(t0) = y0 and ydot(t0) = ydot0
Returns the surface crossing instants and the number of the surface
            reached in nn.
Detailed examples can be found in SCIDIR/tests/unit_tests/dassldasrt.tst
Examples
// dy/dt = ((2*log(y)+8)/t -5)*y, y(1) = 1, 1<=t<=6 // g1 = ((2*log(y)+8)/t - 5)*y // g2 = log(y) - 2.2491 y0 = 1; t = 2:6; t0 = 1; y0d = 3; atol = 1.d-6; rtol = 0; ng = 2; deff('[delta,ires] = res1(t,y,ydot)', 'ires=0; delta=ydot-((2*log(y)+8)/t-5)*y') deff('rts = gr1(t,y)', 'rts=[((2*log(y)+8)/t-5)*y;log(y)-2.2491]') [yy,nn] = dasrt([y0,y0d],t0,t,atol,rtol,res1,ng,gr1); //(Should return nn=[2.4698972 2])
See also
- ode — программа решения обыкновенных дифференциальных уравнений
- dassl — differential algebraic equation
- daskr — DAE solver with zero crossing
- dae — Differential algebraic equations solver
- call — Fortran or C user routines call
- link — dynamic linker
- external — объект Scilab'а, внешняя функция или подпрограмма
History
| Версия | Описание | 
| 2024.1.0 | Tagged obsolete and will be removed in Scilab 2026.0.0. | 
| Report an issue | ||
| << daskr | Дифференциальные уравнения | dassl >> |