Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: Français - Português - 日本語 - Русский

Please note that the recommended version of Scilab is 6.1.1. This page might be outdated.
However, this page did not exist in the previous stable version.

Scilab Help >> Differential calculus, Integration > ode_roots


ordinary differential equation solver with roots finding


[y, rd, w, iw] = ode("roots", y0, t0, t [,rtol [,atol]], f [,jac], ng, g [,w,iw])



a real vector or matrix (initial conditions).


a real scalar (initial time).


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


an external i.e. function or character string or list.

rtol, atol

a real constants or real vectors of the same size as y.


an external i.e. function or character string or list.


an integer.


an external i.e. function or character string or list.


a real vector or matrix. The solution.


a real vector.

w, iw

vectors of real numbers. See ode() optional output


With this syntax (first argument equal to "roots") 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 function with specified syntax, or the name of a Fortran subroutine or a C function (character string) with specified syntax or a list.

If g is a 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 character 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 g is a list the same conventions as for f apply (see ode help).

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

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


// Integration of the differential equation
// dy/dt=y , y(0)=1, and finds the minimum time t such that y(t)=2


See also

  • ode — ordinary differential equation solver
  • ode_optional_output — ode solvers optional outputs description
  • ode_discrete — ordinary differential equation solver, discrete time simulation
  • dasrt — DAE solver with zero crossing
  • daskr — DAE solver with zero crossing
Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Tue Feb 14 15:02:42 CET 2017