Mercurial > octave-nkf
comparison scripts/ode/private/runge_kutta_45_dorpri.m @ 20570:6256f6e366ac
Fix copyright text in private ode functions
* script/ode/private/*.m: Fox the copyright text.
author | Carlo de Falco <carlo.defalco@polimi.it> |
---|---|
date | Fri, 02 Oct 2015 05:50:43 +0200 |
parents | fcb792acab9b |
children | 72cd24aa5f7a |
comparison
equal
deleted
inserted
replaced
20569:b70cc4bd8109 | 20570:6256f6e366ac |
---|---|
1 ## Copyright (C) 2013, Roberto Porcu' <roberto.porcu@polimi.it> | 1 ## Copyright (C) 2013, Roberto Porcu' <roberto.porcu@polimi.it> |
2 ## OdePkg - A package for solving ordinary differential equations and more | |
3 ## | 2 ## |
4 ## This program is free software; you can redistribute it and/or modify | 3 ## This file is part of Octave. |
5 ## it under the terms of the GNU General Public License as published by | |
6 ## the Free Software Foundation; either version 2 of the License, or | |
7 ## (at your option) any later version. | |
8 ## | 4 ## |
9 ## This program is distributed in the hope that it will be useful, | 5 ## Octave is free software; you can redistribute it and/or modify it |
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of | 6 ## under the terms of the GNU General Public License as published by |
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
12 ## GNU General Public License for more details. | 8 ## your option) any later version. |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
13 ## | 14 ## |
14 ## You should have received a copy of the GNU General Public License | 15 ## You should have received a copy of the GNU General Public License |
15 ## along with this program; If not, see <http://www.gnu.org/licenses/>. | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
16 | 18 |
17 ## -*- texinfo -*- | 19 ## -*- texinfo -*- |
18 ## @deftypefn {Command} {[@var{t_next}, @var{x_next}] =} | 20 ## @deftypefn {Command} {[@var{t_next}, @var{x_next}] =} |
19 ## runge_kutta_45_dorpri (@var{@@fun}, @var{t}, @var{x}, @var{dt}, | 21 ## runge_kutta_45_dorpri (@var{@@fun}, @var{t}, @var{x}, @var{dt}, |
20 ## [@var{options}, @var{k_vals_in}]) | 22 ## [@var{options}, @var{k_vals_in}]) |
61 ## @seealso{odepkg} | 63 ## @seealso{odepkg} |
62 | 64 |
63 function varargout = runge_kutta_45_dorpri (f, t, x, dt, varargin) | 65 function varargout = runge_kutta_45_dorpri (f, t, x, dt, varargin) |
64 | 66 |
65 options = varargin{1}; | 67 options = varargin{1}; |
66 k = zeros (size (x, 1), 4); | 68 k = zeros (rows (x), 6); |
67 | 69 |
68 if (nargin == 5) # only the options are passed | 70 if (nargin == 5) # only the options are passed |
69 k(:,1) = feval (f, t , x, options.vfunarguments{:}); | 71 k(:,1) = feval (f, t , x, options.vfunarguments{:}); |
70 elseif (nargin == 6) # both the options and the k values are passed | 72 elseif (nargin == 6) # both the options and the k values are passed |
71 k(:,1) = varargin{2}(:,end); # FSAL property | 73 k(:,1) = varargin{2}(:,end); # FSAL property |
72 endif | 74 endif |
75 | |
73 k(:,1) = feval (f, t, x, options.vfunarguments{:}); | 76 k(:,1) = feval (f, t, x, options.vfunarguments{:}); |
74 k(:,2) = feval (f, t + (1/5)*dt, ... | 77 k(:,2) = feval (f, t + (1/5)*dt, ... |
75 x + dt * (1/5)*k(:,1), ... | 78 x + dt * (1/5)*k(:,1), ... |
76 options.vfunarguments{:}); | 79 options.vfunarguments{:}); |
77 k(:,3) = feval (f, t + (3/10)*dt, ... | 80 k(:,3) = feval (f, t + (3/10)*dt, ... |
110 varargout{4} = k; | 113 varargout{4} = k; |
111 endif | 114 endif |
112 | 115 |
113 endfunction | 116 endfunction |
114 | 117 |
115 ## Local Variables: *** | |
116 ## mode: octave *** | |
117 ## End: *** |