Ordinary differential equation solver with root finding (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.
See the recommended documentation of this function
Scilab help >> Differential Equations, Integration > ode_root
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])
Arguments
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 vectors of the same size asy.
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 equationdy/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 calling sequence or a list.
If g is a function the syntax should be as follows:
where t is a real scalar (time) andy a real vector (state). It returns a vector of sizeng 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) whereng is the number of constraints andgout is the value of g (output of the program). If g is a list the same conventions as for f apply (see ode help).
Ouput 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 forode, see the ode help.
Examples
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)
deff("[z]=g(t,y)","z=y-[2;2;33]") [y,rd]=ode("roots",1,0,2,f,3,g)