File: ode_root.cat

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (64 lines) | stat: -rw-r--r-- 2,264 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

ode_root(G)                    Scilab Function                    ode_root(G)
NAME
  ode_root - ordinary differential equation solver with root finding

CALLING SEQUENCE
  [y,rd,w,iw]=ode('root',y0,t0,t [,rtol  [,atol]],f  [,jac],ng,g [,w,iw])

PARAMETERS

  y0        : real vector or matrix (initial conditions).

  t0,       : real scalar (initial time).

  t         : real vector (times at which the solution is computed).

  f         : external i.e. function or character string or list.

  rtol,atol : real constants or real vector of the same size as y.  as y.

  jac       : external i.e. function or character string or list.

  w,iw      : real vectors.

  ng        : integer.

  g         : external i.e. function or character string or list.

DESCRIPTION
  With this syntax (first argument equal to 'root') ode computes the solution
  of the differential equation dy/dt=f(t,y) until the state y(t) crosses the
  surface g(t,y)=0.

  g should give the equation of the surface.  It is an external i.e. a func-
  tion with specified syntax, or the name a Fortran subroutine or a C func-
  tion (character string) with specified calling sequence or a list.

  If g is function the syntax should be as follows:
  z=g(t,y)
  where t is a real scalar (time)  and y a real vector (state).  It returns a
  vector of size ng which corresponds to the ng constraints. If g is a char-
  acter string it refers to the name of a Fortran subroutine or a C function,
  with the following calling sequence: g(n,t,y,ng,gout).  where ng is the
  number of constraints and gout is the value of  g (output of the program).
  If  is a list the same conventions as for f apply (see ode help).

  Ouput rd is a 1xk vector. The first entry contains the stopping time. Other
  entries indicate which components of g have changed sign. k larger than two
  indicates that more than one surface (k-1) has been simultaneously
  traversed.

  Other arguments and other options are the same as for ode, see the ode
  help.

EXAMPLE
  // Integration of the differential equation
  // dy/dt=y , y(0)=1, and finds the minimum time t such that y(t)=2
  deff('[ydot]=f(t,y)','ydot=y')
  deff('[z]=g(t,y)','z=y-2')
  y0=1;ng=1;
  [y,rd]=ode('roots',y0,0,2,f,ng,g)

SEE ALSO
  dasrt, ode