changeset 22661:c00578ac8dda stable

Resolve FIXME notes in ode code base. * ode23.m: Remove FIXME about constant mass matrices comment. * odeset.m: Add notes to documentation for BDF, MvPattern, and Refine that they are not yet implemented. * runge_kutta_45_dorpri.m: Add correct reference for constants used in calculation. * runge_kutta_interpolate.m: Remove 4th order method which is never used.
author Rik <rik@octave.org>
date Mon, 24 Oct 2016 08:56:15 -0700
parents 7eb3f8ec1aed
children 655157b34a9f
files scripts/ode/ode23.m scripts/ode/odeset.m scripts/ode/private/runge_kutta_45_dorpri.m scripts/ode/private/runge_kutta_interpolate.m
diffstat 4 files changed, 8 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ode/ode23.m	Mon Oct 24 12:17:30 2016 +0200
+++ b/scripts/ode/ode23.m	Mon Oct 24 08:56:15 2016 -0700
@@ -210,8 +210,7 @@
 
   if (havemasshandle)   # Handle only the dynamic mass matrix,
     if (! strcmp (odeopts.MStateDependence, "none"))
-      ## FIXME: How is this comment supposed to end?
-      ## constant mass matrices have already
+      ## constant mass matrices have already been handled
       mass = @(t,x) odeopts.Mass (t, x, odeopts.funarguments{:});
       fun = @(t,x) mass (t, x, odeopts.funarguments{:}) ...
                    \ fun (t, x, odeopts.funarguments{:});
--- a/scripts/ode/odeset.m	Mon Oct 24 12:17:30 2016 +0200
+++ b/scripts/ode/odeset.m	Mon Oct 24 08:56:15 2016 -0700
@@ -60,6 +60,7 @@
 ##
 ## @item BDF
 ## Use BDF formulas in implicit multistep methods.
+## @strong{Note:} This option is not yet implemented.
 ##
 ## @item Events
 ## Event function. An event function must have the form
@@ -103,6 +104,7 @@
 ## @item MvPattern
 ## If the mass matrix is sparse and non-constant but maintains a
 ## constant sparsity pattern, specify the sparsity pattern.
+## @strong{Note:} This option is not yet implemented.
 ##
 ## @item NonNegative
 ## Specify elements of the state vector that are expected to remain
@@ -125,6 +127,7 @@
 ## time step or also at intermediate time instances. The value should be
 ## a scalar indicating the number of equally spaced time points to use
 ## within each timestep at which to return output.
+## @strong{Note:} This option is not yet implemented.
 ##
 ## @item RelTol
 ## Relative error tolerance.
--- a/scripts/ode/private/runge_kutta_45_dorpri.m	Mon Oct 24 12:17:30 2016 +0200
+++ b/scripts/ode/private/runge_kutta_45_dorpri.m	Mon Oct 24 08:56:15 2016 -0700
@@ -60,6 +60,9 @@
                                                              k_vals = [],
                                                              t_next = t + dt)
 
+  ## Reference: Hairer, Ernst; Nørsett, Syvert Paul; Wanner, Gerhard (2008),
+  ## Solving ordinary differential equations I: Nonstiff problems,
+  ## Berlin, New York: Springer-Verlag, ISBN 978-3-540-56670-0
   persistent a = [0           0          0           0        0          0;
                   1/5         0          0           0        0          0;
                   3/40        9/40       0           0        0          0;
@@ -70,18 +73,13 @@
   persistent c = [35/384, 0, 500/1113, 125/192, -2187/6784, 11/84];
   persistent c_prime = [5179/57600, 0, 7571/16695, 393/640, ...
                         -92097/339200, 187/2100, 1/40];
-  ## FIXME: Which source is c_prime derived from?
-  ##        Can't the Shampine clause be deleted if it will never be used?
-  ## According to Shampine 1986:
-  ## persistent c_prime = [(1951/21600) 0 (22642/50085) (451/720), ...
-  ##                       (-12231/42400) (649/6300) (1/60)];
 
   s = t + dt * b;
   cc = dt * c;
   aa = dt * a;
   k = zeros (rows (x), 7);
 
-  if (! isempty (options))  # extra arguments for function evaluator
+  if (! isempty (options))   # extra arguments for function evaluator
     args = options.funarguments;
   else
     args = {};
--- a/scripts/ode/private/runge_kutta_interpolate.m	Mon Oct 24 12:17:30 2016 +0200
+++ b/scripts/ode/private/runge_kutta_interpolate.m	Mon Oct 24 08:56:15 2016 -0700
@@ -35,15 +35,6 @@
     case 3
       u_interp = hermite_cubic_interpolation (z, u, k_vals, t);
 
-    ## FIXME: Do we need an algorithm for order = 4?
-    #{
-    case 4
-      ## if ode45 is used without local extrapolation this function
-      ## doesn't require a new function evaluation.
-      u_interp = dorpri_interpolation ([z(i-1) z(i)],
-                                       [u(:,i-1) u(:,i)],
-                                       k_vals, tspan(counter));
-    #}
     case 5
       ## ode45 with Dormand-Prince scheme:
       u_interp = hermite_quartic_interpolation (z, u, k_vals, t);