diff src/DLD-FUNCTIONS/lsode.cc @ 4115:fc2048d4cd21

[project @ 2002-10-22 21:28:42 by jwe]
author jwe
date Tue, 22 Oct 2002 21:28:42 +0000
parents f6df65db67f9
children 944b276d8856
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/lsode.cc
+++ b/src/DLD-FUNCTIONS/lsode.cc
@@ -160,32 +160,111 @@
 
 DEFUN_DLD (lsode, args, nargout,
   "-*- texinfo -*-\n\
-@deftypefn {Loadable Function} {[@var{x}, @var{istate}, @var{msg}]} lsode (@var{fcn}, @var{x0}, @var{t}, @var{t_crit})\n\
-Return a matrix of @var{x} as a function of @var{t}, given the initial\n\
-state of the system @var{x0}.  Each row in the result matrix corresponds\n\
-to one of the elements in the vector @var{t}.  The first element of\n\
-@var{t} corresponds to the initial state @var{x0}, so that the first row\n\
-of the output is @var{x0}.\n\
+@deftypefn {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\
+@ifinfo\n\
+\n\
+@example\n\
+dx\n\
+-- = f(x, t)\n\
+dt
+@end example\n\
+\n\
+with\n\
+\n\
+@example\n\
+x(t_0) = x_0\n\
+@end example\n\
+\n\
+@end ifinfo\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 that names the function to\n\
 call to compute the vector of right hand sides for the set of equations.\n\
-It must have the form\n\
+The function must have the form\n\
 \n\
 @example\n\
 @var{xdot} = f (@var{x}, @var{t})\n\
 @end example\n\
 \n\
 @noindent\n\
-where @var{xdot} and @var{x} are vectors and @var{t} is a scalar.\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, the first element names the\n\
+function @math{f} described above, and the second element names a function\n\
+to compute the Jacobian of @math{f}.  The Jacobian function must have the\n\
+form\n\
+\n\
+@example\n\
+@var{jac} = j (@var{x}, @var{t})\n\
+@end example\n\
+\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\
+@ifinfo\n\
+\n\
+@example\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 example\n\
+\n\
+@end ifinfo\n\
+\n\
+The second and third arguments specify the intial 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\
-@end deftypefn")
+@end deftypefn\n\
+@seealso{daspk, dassl, dasrt, odessa}")
 {
   octave_value_list retval;