annotate scripts/ode/private/runge_kutta_45_dorpri.m @ 30893:e1788b1a315f

maint: Use "fcn" as preferred abbreviation for "function" in m-files. * accumarray.m, accumdim.m, quadl.m, quadv.m, randi.m, structfun.m, __is_function__.m, uigetfile.m, uimenu.m, uiputfile.m, doc_cache_create.m, colorspace_conversion_input_check.m, imageIO.m, argnames.m, vectorize.m, vectorize.m, normest1.m, inputname.m, nthargout.m, display_info_file.m, decic.m, ode15i.m, ode15s.m, ode23.m, ode23s.m, ode45.m, odeset.m, check_default_input.m, integrate_adaptive.m, ode_event_handler.m, runge_kutta_23.m, runge_kutta_23s.m, runge_kutta_45_dorpri.m, runge_kutta_interpolate.m, starting_stepsize.m, __all_opts__.m, fminbnd.m, fminsearch.m, fminunc.m, fsolve.m, fzero.m, sqp.m, fplot.m, plotyy.m, __bar__.m, __ezplot__.m, flat_entry.html, profexport.m, movfun.m, bicg.m, bicgstab.m, cgs.m, eigs.m, gmres.m, pcg.m, __alltohandles__.m, __sprand__.m, qmr.m, tfqmr.m, dump_demos.m: Replace "func", "fun", "fn" in documentation and variable names with "fcn".
author Rik <rik@octave.org>
date Mon, 04 Apr 2022 18:14:56 -0700
parents 796f54d4ddbf
children 597f3ee61a48
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
1 ########################################################################
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
2 ##
30564
796f54d4ddbf update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents: 29358
diff changeset
3 ## Copyright (C) 2013-2022 The Octave Project Developers
27918
b442ec6dda5c use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents: 26376
diff changeset
4 ##
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
5 ## See the file COPYRIGHT.md in the top-level directory of this
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
6 ## distribution or <https://octave.org/copyright/>.
20536
6256f6e366ac Fix copyright text in private ode functions
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20533
diff changeset
7 ##
6256f6e366ac Fix copyright text in private ode functions
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20533
diff changeset
8 ## This file is part of Octave.
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
9 ##
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23565
diff changeset
10 ## Octave is free software: you can redistribute it and/or modify it
20536
6256f6e366ac Fix copyright text in private ode functions
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20533
diff changeset
11 ## under the terms of the GNU General Public License as published by
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23565
diff changeset
12 ## the Free Software Foundation, either version 3 of the License, or
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22661
diff changeset
13 ## (at your option) any later version.
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
14 ##
20536
6256f6e366ac Fix copyright text in private ode functions
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20533
diff changeset
15 ## Octave is distributed in the hope that it will be useful, but
6256f6e366ac Fix copyright text in private ode functions
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20533
diff changeset
16 ## WITHOUT ANY WARRANTY; without even the implied warranty of
22755
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22661
diff changeset
17 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3a2b891d0b33 maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents: 22661
diff changeset
18 ## GNU General Public License for more details.
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
19 ##
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
20 ## You should have received a copy of the GNU General Public License
20536
6256f6e366ac Fix copyright text in private ode functions
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20533
diff changeset
21 ## along with Octave; see the file COPYING. If not, see
24534
194eb4bd202b maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents: 23565
diff changeset
22 ## <https://www.gnu.org/licenses/>.
27923
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
23 ##
bd51beb6205e update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents: 27919
diff changeset
24 ########################################################################
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
25
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
26 ## -*- texinfo -*-
30893
e1788b1a315f maint: Use "fcn" as preferred abbreviation for "function" in m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
27 ## @deftypefn {} {[@var{t_next}, @var{x_next}] =} runge_kutta_45_dorpri (@var{@@fcn}, @var{t}, @var{x}, @var{dt})
e1788b1a315f maint: Use "fcn" as preferred abbreviation for "function" in m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
28 ## @deftypefnx {} {[@var{t_next}, @var{x_next}] =} runge_kutta_45_dorpri (@var{@@fcn}, @var{t}, @var{x}, @var{dt}, @var{options})
e1788b1a315f maint: Use "fcn" as preferred abbreviation for "function" in m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
29 ## @deftypefnx {} {[@var{t_next}, @var{x_next}] =} runge_kutta_45_dorpri (@var{@@fcn}, @var{t}, @var{x}, @var{dt}, @var{options}, @var{k_vals})
e1788b1a315f maint: Use "fcn" as preferred abbreviation for "function" in m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
30 ## @deftypefnx {} {[@var{t_next}, @var{x_next}] =} runge_kutta_45_dorpri (@var{@@fcn}, @var{t}, @var{x}, @var{dt}, @var{options}, @var{k_vals}, @var{t_next})
22768
a75a0900e216 maint: Match documentation names and variable names in more m-files.
Rik <rik@octave.org>
parents: 22755
diff changeset
31 ## @deftypefnx {} {[@var{t_next}, @var{x_next}, @var{x_est}] =} runge_kutta_45_dorpri (@dots{})
a75a0900e216 maint: Match documentation names and variable names in more m-files.
Rik <rik@octave.org>
parents: 22755
diff changeset
32 ## @deftypefnx {} {[@var{t_next}, @var{x_next}, @var{x_est}, @var{k_vals_out}] =} runge_kutta_45_dorpri (@dots{})
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
33 ##
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
34 ## This function can be used to integrate a system of ODEs with a given initial
20621
b92f8e148936 maint: Continued clean-up of functions in ode/private dir.
Rik <rik@octave.org>
parents: 20600
diff changeset
35 ## condition @var{x} from @var{t} to @var{t+dt} with the Dormand-Prince method.
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
36 ## For the definition of this method see
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
37 ## @url{http://en.wikipedia.org/wiki/Dormand%E2%80%93Prince_method}.
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
38 ##
20548
25623ef2ff4f doc: Rewrite docstrings for ode* family of functions.
Rik <rik@octave.org>
parents: 20543
diff changeset
39 ## First input argument is the function describing the system of ODEs to be
25623ef2ff4f doc: Rewrite docstrings for ode* family of functions.
Rik <rik@octave.org>
parents: 20543
diff changeset
40 ## integrated.
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
41 ##
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
42 ## Second input parameter is the first extreme of integration interval.
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
43 ##
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
44 ## Third input argument is the initial condition of the system.
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
45 ##
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
46 ## Fourth input argument is the timestep, that is the length of the
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
47 ## integration interval.
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
48 ##
20548
25623ef2ff4f doc: Rewrite docstrings for ode* family of functions.
Rik <rik@octave.org>
parents: 20543
diff changeset
49 ## Fifth input parameter is optional and describes a set of options useful to
25623ef2ff4f doc: Rewrite docstrings for ode* family of functions.
Rik <rik@octave.org>
parents: 20543
diff changeset
50 ## adapt the computation to what is needed.
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
51 ##
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
52 ## Sixth input parameter is optional and describes the Runge-Kutta evaluations
20621
b92f8e148936 maint: Continued clean-up of functions in ode/private dir.
Rik <rik@octave.org>
parents: 20600
diff changeset
53 ## of the previous step to use in an FSAL scheme.
22626
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
54 ##
22768
a75a0900e216 maint: Match documentation names and variable names in more m-files.
Rik <rik@octave.org>
parents: 22755
diff changeset
55 ## Seventh input parameter is optional and is the time (@var{t_next}) to
a75a0900e216 maint: Match documentation names and variable names in more m-files.
Rik <rik@octave.org>
parents: 22755
diff changeset
56 ## integrate to. The default is @code{@var{t} + @var{dt}}.
a75a0900e216 maint: Match documentation names and variable names in more m-files.
Rik <rik@octave.org>
parents: 22755
diff changeset
57 ##
22626
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
58 ## First output argument is the final integration time value.
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
59 ##
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
60 ## Second output parameter is the higher order computed solution at time
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
61 ## @var{t_next} (local extrapolation).
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
62 ##
22626
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
63 ## Third output parameter is a lower order solution for the estimation of the
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
64 ## error.
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
65 ##
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
66 ## Fourth output parameter is matrix containing the Runge-Kutta evaluations
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
67 ## to use in an FSAL scheme or for dense output.
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
68 ## @end deftypefn
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
69
30893
e1788b1a315f maint: Use "fcn" as preferred abbreviation for "function" in m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
70 function [t_next, x_next, x_est, k] = runge_kutta_45_dorpri (fcn, t, x, dt,
20621
b92f8e148936 maint: Continued clean-up of functions in ode/private dir.
Rik <rik@octave.org>
parents: 20600
diff changeset
71 options = [],
b92f8e148936 maint: Continued clean-up of functions in ode/private dir.
Rik <rik@octave.org>
parents: 20600
diff changeset
72 k_vals = [],
b92f8e148936 maint: Continued clean-up of functions in ode/private dir.
Rik <rik@octave.org>
parents: 20600
diff changeset
73 t_next = t + dt)
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
74
22661
c00578ac8dda Resolve FIXME notes in ode code base.
Rik <rik@octave.org>
parents: 22626
diff changeset
75 ## Reference: Hairer, Ernst; Nørsett, Syvert Paul; Wanner, Gerhard (2008),
c00578ac8dda Resolve FIXME notes in ode code base.
Rik <rik@octave.org>
parents: 22626
diff changeset
76 ## Solving ordinary differential equations I: Nonstiff problems,
c00578ac8dda Resolve FIXME notes in ode code base.
Rik <rik@octave.org>
parents: 22626
diff changeset
77 ## Berlin, New York: Springer-Verlag, ISBN 978-3-540-56670-0
20540
72cd24aa5f7a Clean up and vetorize Dormant&Prince RK timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20536
diff changeset
78 persistent a = [0 0 0 0 0 0;
72cd24aa5f7a Clean up and vetorize Dormant&Prince RK timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20536
diff changeset
79 1/5 0 0 0 0 0;
72cd24aa5f7a Clean up and vetorize Dormant&Prince RK timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20536
diff changeset
80 3/40 9/40 0 0 0 0;
72cd24aa5f7a Clean up and vetorize Dormant&Prince RK timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20536
diff changeset
81 44/45 -56/15 32/9 0 0 0;
72cd24aa5f7a Clean up and vetorize Dormant&Prince RK timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20536
diff changeset
82 19372/6561 -25360/2187 64448/6561 -212/729 0 0;
20903
3d3da166dac5 2015 Code Sprint: finish import of ode23 into core
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20852
diff changeset
83 9017/3168 -355/33 46732/5247 49/176 -5103/18656 0];
22626
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
84 persistent b = [0, 1/5, 3/10, 4/5, 8/9, 1, 1];
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
85 persistent c = [35/384, 0, 500/1113, 125/192, -2187/6784, 11/84];
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
86 persistent c_prime = [5179/57600, 0, 7571/16695, 393/640, ...
869c02fde46c Further clean-up of ode functions.
Rik <rik@octave.org>
parents: 22323
diff changeset
87 -92097/339200, 187/2100, 1/40];
20540
72cd24aa5f7a Clean up and vetorize Dormant&Prince RK timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20536
diff changeset
88
72cd24aa5f7a Clean up and vetorize Dormant&Prince RK timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20536
diff changeset
89 s = t + dt * b;
72cd24aa5f7a Clean up and vetorize Dormant&Prince RK timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20536
diff changeset
90 cc = dt * c;
72cd24aa5f7a Clean up and vetorize Dormant&Prince RK timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20536
diff changeset
91 aa = dt * a;
72cd24aa5f7a Clean up and vetorize Dormant&Prince RK timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20536
diff changeset
92 k = zeros (rows (x), 7);
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
93
22661
c00578ac8dda Resolve FIXME notes in ode code base.
Rik <rik@octave.org>
parents: 22626
diff changeset
94 if (! isempty (options)) # extra arguments for function evaluator
20634
80e630b37ba1 maint: Remove unnecessary 'v' prefix before variables in ODE m-files.
Rik <rik@octave.org>
parents: 20621
diff changeset
95 args = options.funarguments;
20543
3339c9bdfe6a Activate FSAL property in dorpri timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20540
diff changeset
96 else
3339c9bdfe6a Activate FSAL property in dorpri timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20540
diff changeset
97 args = {};
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
98 endif
20543
3339c9bdfe6a Activate FSAL property in dorpri timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20540
diff changeset
99
20621
b92f8e148936 maint: Continued clean-up of functions in ode/private dir.
Rik <rik@octave.org>
parents: 20600
diff changeset
100 if (! isempty (k_vals)) # k values from previous step are passed
20600
a22d8a2eb0e5 fix adaptive strategy in ode solvers.
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20554
diff changeset
101 k(:,1) = k_vals(:,end); # FSAL property
20634
80e630b37ba1 maint: Remove unnecessary 'v' prefix before variables in ODE m-files.
Rik <rik@octave.org>
parents: 20621
diff changeset
102 else
30893
e1788b1a315f maint: Use "fcn" as preferred abbreviation for "function" in m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
103 k(:,1) = feval (fcn, t, x, args{:});
20600
a22d8a2eb0e5 fix adaptive strategy in ode solvers.
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20554
diff changeset
104 endif
20634
80e630b37ba1 maint: Remove unnecessary 'v' prefix before variables in ODE m-files.
Rik <rik@octave.org>
parents: 20621
diff changeset
105
30893
e1788b1a315f maint: Use "fcn" as preferred abbreviation for "function" in m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
106 k(:,2) = feval (fcn, s(2), x + k(:,1) * aa(2, 1).' , args{:});
e1788b1a315f maint: Use "fcn" as preferred abbreviation for "function" in m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
107 k(:,3) = feval (fcn, s(3), x + k(:,1:2) * aa(3, 1:2).', args{:});
e1788b1a315f maint: Use "fcn" as preferred abbreviation for "function" in m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
108 k(:,4) = feval (fcn, s(4), x + k(:,1:3) * aa(4, 1:3).', args{:});
e1788b1a315f maint: Use "fcn" as preferred abbreviation for "function" in m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
109 k(:,5) = feval (fcn, s(5), x + k(:,1:4) * aa(5, 1:4).', args{:});
e1788b1a315f maint: Use "fcn" as preferred abbreviation for "function" in m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
110 k(:,6) = feval (fcn, s(6), x + k(:,1:5) * aa(6, 1:5).', args{:});
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
111
20552
eb9e2d187ed2 maint: Use Octave coding conventions in scripts/ode/private dir.
Rik <rik@octave.org>
parents: 20548
diff changeset
112 ## compute new time and new values for the unknowns
20621
b92f8e148936 maint: Continued clean-up of functions in ode/private dir.
Rik <rik@octave.org>
parents: 20600
diff changeset
113 ## t_next = t + dt;
b92f8e148936 maint: Continued clean-up of functions in ode/private dir.
Rik <rik@octave.org>
parents: 20600
diff changeset
114 x_next = x + k(:,1:6) * cc(:); # 5th order approximation
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
115
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
116 ## if the estimation of the error is required
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
117 if (nargout >= 3)
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
118 ## new solution to be compared with the previous one
30893
e1788b1a315f maint: Use "fcn" as preferred abbreviation for "function" in m-files.
Rik <rik@octave.org>
parents: 30564
diff changeset
119 k(:,7) = feval (fcn, t_next, x_next, args{:});
20540
72cd24aa5f7a Clean up and vetorize Dormant&Prince RK timestepper
Carlo de Falco <carlo.defalco@polimi.it>
parents: 20536
diff changeset
120 cc_prime = dt * c_prime;
20552
eb9e2d187ed2 maint: Use Octave coding conventions in scripts/ode/private dir.
Rik <rik@octave.org>
parents: 20548
diff changeset
121 x_est = x + k * cc_prime(:);
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
122 endif
20634
80e630b37ba1 maint: Remove unnecessary 'v' prefix before variables in ODE m-files.
Rik <rik@octave.org>
parents: 20621
diff changeset
123
20533
fcb792acab9b Moving ode45, odeset, odeget, and levenshtein from odepkg to core.
jcorno <jacopo.corno@gmail.com>
parents:
diff changeset
124 endfunction