1
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
2
<!DOCTYPE MAN SYSTEM "../../manrev.dtd">
4
<LANGUAGE>eng</LANGUAGE>
6
<TYPE>Scilab Function</TYPE>
8
<SHORT_DESCRIPTION name="dasrt"> DAE solver with zero crossing</SHORT_DESCRIPTION>
10
<CALLING_SEQUENCE_ITEM>[r,nn,[,hd]]=dasrt(x0,t0,t [,atol,[rtol]],res [,jac],ng, surf [,info] [,hd]) </CALLING_SEQUENCE_ITEM>
15
<PARAM_NAME>x0</PARAM_NAME>
17
<SP>: is either <VERB>y0</VERB> (<VERB>ydot0</VERB> is estimated by
18
<VERB>dassl</VERB> with zero as first estimate) or the matrix
19
<VERB>[y0 ydot0]</VERB>. <VERB>g(t,y0,ydot0)</VERB> must be equal
20
to zero. If you only know an estimate of <VERB>ydot0</VERB> set
21
<VERB>info(7)=1</VERB></SP>
24
<PARAM_NAME>y0</PARAM_NAME>
26
<SP>: real column vector of initial conditions.</SP>
30
<PARAM_NAME>ydot0</PARAM_NAME>
32
<SP>: real column vector of the time derivative of <VERB>y</VERB> at <VERB>t0</VERB> (may be an estimate).</SP>
39
<PARAM_NAME>t0</PARAM_NAME>
41
<SP>: real number is the initial instant.</SP>
45
<PARAM_NAME>t</PARAM_NAME>
47
<SP>: real scalar or vector. Gives instants for which you want the
48
solution. Note that you can get solution at each dassl's step
49
point by setting <VERB>info(2)=1</VERB>.</SP>
53
<PARAM_NAME>nn</PARAM_NAME>
55
<SP>: a vector with two entries <VERB>[times num]</VERB>
56
<VERB>times</VERB> is the value of the time at which the surface is
57
crossed, <VERB>num</VERB> is the number of the crossed surface</SP>
61
<PARAM_NAME>atol,rtol</PARAM_NAME>
63
<SP>: real scalars or column vectors of same size as
64
<VERB>y</VERB>. <VERB>atol,rtol</VERB> give respectively absolute
65
and relative error tolerances of solution. If vectors the
66
tolerances are specified for each component of <VERB>y</VERB>.</SP>
70
<PARAM_NAME>res</PARAM_NAME>
72
<SP>: external (function or list or string). Computes the value of <VERB>g(t,y,ydot)</VERB>.</SP>
75
<PARAM_NAME>function</PARAM_NAME>
78
: Its calling sequence must be <VERB>[r,ires]=res(t,y,ydot)</VERB>
79
and <VERB>res</VERB> must return the residue
80
<VERB>r=g(t,y,ydot)</VERB> and error flag
81
<VERB>ires</VERB>. <VERB>ires = 0</VERB> if <VERB>res</VERB>
82
succeeds to compute <VERB>r</VERB>, <VERB>=-1</VERB> if residue is
83
locally not defined for <VERB>(t,y,ydot)</VERB>, <VERB>=-2</VERB> if
84
parameters are out of admissible range. </P>
88
<PARAM_NAME>list</PARAM_NAME>
90
<SP>: it must be as follows:</SP>
97
where the calling sequence of the function <VERB>res</VERB> is now
101
r=res(t,y,ydot,x1,x2,...)
104
<P><VERB>res</VERB> still returns <VERB>r=g(t,y,ydot)</VERB> as a function of <VERB>(t,y,ydot,x1,x2,...)</VERB>.
109
<PARAM_NAME>string</PARAM_NAME>
111
<SP>: it must refer to the name of a fortran subroutine (see source code of <VERB>fresd.f</VERB>).</SP>
118
<PARAM_NAME>jac</PARAM_NAME>
120
<SP>: external (function or list or string). Computes the value of <VERB>dg/dy+cj*dg/dydot</VERB> for a given value of parameter <VERB>cj</VERB></SP>
123
<PARAM_NAME>function</PARAM_NAME>
125
<SP>: Its calling sequence must be <VERB>r=jac(t,y,ydot,cj)</VERB> and the <VERB>jac</VERB> function must return <VERB>r=dg(t,y,ydot)/dy+cj*dg(t,y,ydot)/dydot</VERB> where <VERB>cj</VERB> is a real scalar</SP>
129
<PARAM_NAME>list</PARAM_NAME>
131
<SP>: it must be as follows</SP>
138
where the calling sequence of the function <VERB>jac</VERB> is now
142
r=jac(t,y,ydot,x1,x2,...)
145
<P><VERB>jac</VERB> still returns <VERB>dg/dy+cj*dg/dydot</VERB> as a function of <VERB>(t,y,ydot,cj,x1,x2,...)</VERB>.
150
<PARAM_NAME>character string</PARAM_NAME>
152
<SP>: it must refer to the name of a fortran subroutine (see source code of <VERB>jacdd.f</VERB>).</SP>
159
<PARAM_NAME>surf</PARAM_NAME>
161
<SP>: external (function or list or string). Computes the value of the column vector <VERB>surf(t,y)</VERB> with ng components. Each component defines a surface.</SP>
164
<PARAM_NAME>function</PARAM_NAME>
166
<SP>: Its calling sequence must be <VERB>surf(t,y)</VERB></SP>
170
<PARAM_NAME>list</PARAM_NAME>
172
<SP>: it must be as follows</SP>
179
where the calling sequence of the function <VERB>surf</VERB> is now
183
r=surf(t,y,x1,x2,...)
189
<PARAM_NAME>character string</PARAM_NAME>
191
<SP>: it must refer to the name of a fortran subroutine (see source code of <VERB>fsurfd.f</VERB>) in directory <VERB>SCDIR/default</VERB></SP>
198
<PARAM_NAME>info</PARAM_NAME>
200
<SP>: list which contains <VERB>7</VERB> elements, default value is list([],0,[],[],[],0,0)</SP>
203
<PARAM_NAME>info(1) </PARAM_NAME>
205
<SP>: real scalar which gives the maximum time for which <VERB>g</VERB> is allowed to be evaluated or an empty matrix <VERB>[]</VERB> if no limits imposed for time.</SP>
209
<PARAM_NAME>info(2) </PARAM_NAME>
211
<SP>: flag which indicates if <VERB>dassl</VERB> returns its intermediate computed values (<VERB>flag=1</VERB>) or only the user specified time point values (<VERB>flag=0</VERB>).</SP>
215
<PARAM_NAME>info(3) </PARAM_NAME>
217
<SP>: <VERB>2</VERB> components vector which give the definition <VERB>[ml,mu]</VERB> of band matrix computed by <VERB>jac</VERB>; <VERB>r(i - j + ml + mu + 1,j) = "dg(i)/dy(j)+cj*dg(i)/dydot(j)"</VERB>. If <VERB>jac</VERB> returns a full matrix set <VERB>info(3)=[]</VERB>.</SP>
221
<PARAM_NAME>info(4) </PARAM_NAME>
223
<SP>: real scalar which gives the maximum step size. Set <VERB>info(4)=[]</VERB> if no limitation.</SP>
227
<PARAM_NAME>info(5) </PARAM_NAME>
229
<SP>: real scalar which gives the initial step size. Set <VERB>info(4)=[]</VERB> if not specified.</SP>
233
<PARAM_NAME>info(6) </PARAM_NAME>
235
<SP>: set <VERB>info(6)=1</VERB> if the solution is known to be non negative, else set <VERB>info(6)=0</VERB>.</SP>
239
<PARAM_NAME>info(7) </PARAM_NAME>
241
<SP>: set <VERB>info(7)=1</VERB> if <VERB>ydot0</VERB> is just an estimation, <VERB>info(7)=0</VERB> if <VERB>g(t0,y0,ydot0)=0</VERB>.</SP>
248
<PARAM_NAME>hd</PARAM_NAME>
250
<SP>: real vector which allows to store the <VERB>dassl</VERB> context and to resume integration</SP>
254
<PARAM_NAME>r</PARAM_NAME>
256
<SP>: real matrix . Each column is the vector [t;x(t);xdot(t)] where t is time index for which the solution had been computed</SP>
263
Solution of the implicit differential equation</P>
267
y(t0)=y0 and ydot(t0)=ydot0
271
Returns the surface crossing instants and the number of the
272
surface reached in <VERB>nn</VERB>.</P>
274
Detailed examples can be found in SCIDIR/tests/dassldasrt.tst</P>
278
//dy/dt = ((2*log(y)+8)/t -5)*y, y(1) = 1, 1<=t<=6
279
//g1 = ((2*log(y)+8)/t - 5)*y
280
//g2 = log(y) - 2.2491
281
y0=1;t=2:6;t0=1;y0d=3;
282
atol=1.d-6;rtol=0;ng=2;
284
deff('[delta,ires]=res1(t,y,ydot)','ires=0;delta=ydot-((2*log(y)+8)/t-5)*y')
285
deff('[rts]=gr1(t,y)','rts=[((2*log(y)+8)/t-5)*y;log(y)-2.2491]')
287
[yy,nn]=dasrt([y0,y0d],t0,t,atol,rtol,res1,ng,gr1);
288
//(Should return nn=[2.4698972 2])
308
<LINK>external</LINK>