DAE solver with zero crossing (original) (raw)
Scilab 5.3.3
- Scilab help
- Differential Equations, Integration
- bvode
- dae
- daeoptions
- dasrt
- dassl
- feval
- impl
- int2d
- int3d
- intc
- integrate
- intg
- intl
- ode
- ode_discrete
- ode_optional_output
- ode_root
- odedc
- odeoptions
Please note that the recommended version of Scilab is 2026.0.1. This page might be outdated.
However, this page did not exist in the previous stable version.
Scilab help >> Differential Equations, Integration > dasrt
dasrt
DAE solver with zero crossing
Calling Sequence
[r,nn,[,hd]]=dasrt(x0,t0,t [,atol,[rtol]],res [,jac],ng, surf [,info] [,hd])
Arguments
x0
is either y0 (ydot0 is estimated by dassl with 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 ydot0 setinfo(7)=1
y0
real column vector of initial conditions.
ydot0
real column vector of the time derivative ofy at t0 (may be an estimate).
t0
real number is the initial instant.
t
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] times is the value of the time at which the surface is crossed, num is the number of the crossed surface
atol,rtol
real scalars or column vectors of same size asy. atol,rtol give respectively absolute and relative error tolerances of solution. If vectors the tolerances are specified for each component ofy.
res
external (function or list or string). Computes the value ofg(t,y,ydot).It may be :
- A Scilab function.
Its calling sequence must be[r,ires]=res(t,y,ydot)andresmust return the residuer=g(t,y,ydot)and error flagires.ires = 0ifressucceeds to computer,=-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:
where the calling sequence of the functionresis now
r=res(t,y,ydot,x1,x2,...)resstill returnsr=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 tothe function. - A string.
it must refer to the name of a C or fortran subroutine linked with Scilab.
In C The calling sequence must be:
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 rpar and ipar arrays must be present but cannot be used.
jac
external (function or list or string). Computes the value ofdg/dy+cj*dg/dydot for a given value of parametercj
- A Scilab function.
Its calling sequence must ber=jac(t,y,ydot,cj)and thejacfunction must returnr=dg(t,y,ydot)/dy+cj*dg(t,y,ydot)/dydotwherecjis a real scalar - A list.
it must be as follows
where the calling sequence of the functionjacis now
r=jac(t,y,ydot,cj,x1,x2,...)jacstill returnsdg/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 calling sequence must be:
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) withng components. Each component defines a surface. It may be defined by:
- A Scilab function.
Its calling sequence must besurf(t,y) - A list.
it must be as follows
where the calling sequence of the functionsurfis now - A character string.
it must refer to the name of a fortran subroutine linked with scilab
In C The calling sequence must be:
In Fortran it must be:
subroutine surf(ny,t,y,ng,gout)
double precision t, y(),gout()
integer ny,ng
info
list which contains 7 elements, default value is list([],0,[],[],[],0,0)
info(1)
real scalar which gives the maximum time for whichg is allowed to be evaluated or an empty matrix [] if no limits imposed for time.
info(2)
flag which indicates if dassl returns its intermediate computed values (flag=1) or only the user specified time point values (flag=0).
info(3)
2 components 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)". Ifjac returns a full matrix setinfo(3)=[].
info(4)
real scalar which gives the maximum step size. Setinfo(4)=[] if no limitation.
info(5)
real scalar which gives the initial step size. Setinfo(4)=[] if not specified.
info(6)
set info(6)=1 if the solution is known to be non negative, else setinfo(6)=0.
info(7)
set info(7)=1 ifydot0 is just an estimation,info(7)=0 ifg(t0,y0,ydot0)=0.
hd
real vector which allows to store the dassl context and to resume integration
r
real matrix . Each column is the vector [t;x(t);xdot(t)] where t is 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/dassldasrt.tst
Examples
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=[((2log(y)+8)/t-5)*y;log(y)-2.2491]')
[yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,res1,ng,gr1);
See Also
- ode — ordinary differential equation solver
- dassl — differential algebraic equation
- impl — differential algebraic equation
- fort — Fortran or C user routines call
- link — dynamic linker
- external — Scilab Object, external function or routine