Defines | Functions | Variables File Reference

#include <string>
#include <iomanip>
#include <iostream>
#include "LSODE.h"
#include "lo-mappers.h"
#include "defun-dld.h"
#include "error.h"
#include "gripes.h"
#include "oct-obj.h"
#include "ov-fcn.h"
#include "ov-cell.h"
#include "pager.h"
#include "pr-output.h"
#include "unwind-prot.h"
#include "utils.h"
#include "variables.h"
#include ""
Include dependency graph for

Go to the source code of this file.


#define LSODE_ABORT()   return retval
#define LSODE_ABORT1(msg)
#define LSODE_ABORT2(fmt, arg)


 DEFUN_DLD (lsode, args, nargout,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{x}, @var{istate}, @var{msg}] =} lsode (@var{fcn}, @var{x_0}, @var{t})\n\ @deftypefnx {Loadable Function} {[@var{x}, @var{istate}, @var{msg}] =} lsode (@var{fcn}, @var{x_0}, @var{t}, @var{t_crit})\n\ Solve the set of differential equations\n\ @tex\n\ $$ {dx \\over dt} = f (x, t) $$\n\ with\n\ $$ x(t_0) = x_0 $$\n\ @end tex\n\ @ifnottex\n\ \n\ @example\n\ @group\n\ dx\n\ -- = f(x, t)\n\ dt\n\ @end group\n\ @end example\n\ \n\ @noindent\n\ with\n\ \n\ @example\n\ x(t_0) = x_0\n\ @end example\n\ \n\ @end ifnottex\n\ The solution is returned in the matrix @var{x}, with each row\n\ corresponding to an element of the vector @var{t}. The first element\n\ of @var{t} should be @math{t_0} and should correspond to the initial\n\ state of the system @var{x_0}, so that the first row of the output\n\ is @var{x_0}.\n\ \n\ The first argument, @var{fcn}, is a string, inline, or function handle\n\ that names the function @math{f} to call to compute the vector of right\n\ hand sides for the set of equations. The function must have the form\n\ \n\ @example\n\ @var{xdot} = f (@var{x}, @var{t})\n\ @end example\n\ \n\ @noindent\n\ in which @var{xdot} and @var{x} are vectors and @var{t} is a scalar.\n\ \n\ If @var{fcn} is a two-element string array or a two-element cell array\n\ of strings, inline functions, or function handles, the first element names\n\ the function @math{f} described above, and the second element names a\n\ function to compute the Jacobian of @math{f}. The Jacobian function\n\ must have the form\n\ \n\ @example\n\ @var{jac} = j (@var{x}, @var{t})\n\ @end example\n\ \n\ @noindent\n\ in which @var{jac} is the matrix of partial derivatives\n\ @tex\n\ $$ J = {\\partial f_i \\over \\partial x_j} = \\left[\\matrix{\n\ {\\partial f_1 \\over \\partial x_1}\n\ & {\\partial f_1 \\over \\partial x_2}\n\ & \\cdots\n\ & {\\partial f_1 \\over \\partial x_N} \\cr\n\ {\\partial f_2 \\over \\partial x_1}\n\ & {\\partial f_2 \\over \\partial x_2}\n\ & \\cdots\n\ & {\\partial f_2 \\over \\partial x_N} \\cr\n\ \\vdots & \\vdots & \\ddots & \\vdots \\cr\n\ {\\partial f_3 \\over \\partial x_1}\n\ & {\\partial f_3 \\over \\partial x_2}\n\ & \\cdots\n\ & {\\partial f_3 \\over \\partial x_N} \\cr}\\right]$$\n\ @end tex\n\ @ifnottex\n\ \n\ @example\n\ @group\n\ | df_1 df_1 df_1 |\n\ | ---- ---- ... ---- |\n\ | dx_1 dx_2 dx_N |\n\ | |\n\ | df_2 df_2 df_2 |\n\ | ---- ---- ... ---- |\n\ df_i | dx_1 dx_2 dx_N |\n\ jac = ---- = | |\n\ dx_j | . . . . |\n\ | . . . . |\n\ | . . . . |\n\ | |\n\ | df_N df_N df_N |\n\ | ---- ---- ... ---- |\n\ | dx_1 dx_2 dx_N |\n\ @end group\n\ @end example\n\ \n\ @end ifnottex\n\ \n\ The second and third arguments specify the initial state of the system,\n\ @math{x_0}, and the initial value of the independent variable @math{t_0}.\n\ \n\ The fourth argument is optional, and may be used to specify a set of\n\ times that the ODE solver should not integrate past. It is useful for\n\ avoiding difficulties with singularities and points where there is a\n\ discontinuity in the derivative.\n\ \n\ After a successful computation, the value of @var{istate} will be 2\n\ (consistent with the Fortran version of @sc{lsode}).\n\ \n\ If the computation is not successful, @var{istate} will be something\n\ other than 2 and @var{msg} will contain additional information.\n\ \n\ You can use the function @code{lsode_options} to set optional\n\ parameters for @code{lsode}.\n\ @seealso{daspk, dassl, dasrt}\n\ @end deftypefn")
ColumnVector lsode_user_function (const ColumnVector &x, double t)
Matrix lsode_user_jacobian (const ColumnVector &x, double t)


static int call_depth = 0
static octave_functionlsode_fcn
static octave_functionlsode_jac
static bool warned_fcn_imaginary = false
static bool warned_jac_imaginary = false

Define Documentation

#define LSODE_ABORT (  )     return retval

Definition at line 140 of file

Referenced by DEFUN_DLD().

#define LSODE_ABORT1 (   msg  ) 
do \
    { \
      ::error ("lsode: " msg); \
      LSODE_ABORT (); \
    } \
  while (0)

Definition at line 143 of file

Referenced by DEFUN_DLD().

#define LSODE_ABORT2 (   fmt,
do \
    { \
      ::error ("lsode: " fmt, arg); \
      LSODE_ABORT (); \
    } \
  while (0)

Definition at line 151 of file

Function Documentation

DEFUN_DLD ( lsode  ,
args  ,
ColumnVector lsode_user_function ( const ColumnVector x,
double  t 
Matrix lsode_user_jacobian ( const ColumnVector x,
double  t 

Variable Documentation

int call_depth = 0 [static]

Definition at line 60 of file

Definition at line 50 of file

Definition at line 53 of file

bool warned_fcn_imaginary = false [static]

Definition at line 56 of file

bool warned_jac_imaginary = false [static]

Definition at line 57 of file

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines