3191
|
1 ## Copyright (C) 1995, 1996, 1997 Kurt Hornik |
3426
|
2 ## |
3922
|
3 ## This file is part of Octave. |
|
4 ## |
|
5 ## Octave is free software; you can redistribute it and/or modify it |
|
6 ## under the terms of the GNU General Public License as published by |
7016
|
7 ## the Free Software Foundation; either version 3 of the License, or (at |
|
8 ## your option) any later version. |
3426
|
9 ## |
3922
|
10 ## Octave is distributed in the hope that it will be useful, but |
3191
|
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3426
|
13 ## General Public License for more details. |
|
14 ## |
3191
|
15 ## You should have received a copy of the GNU General Public License |
7016
|
16 ## along with Octave; see the file COPYING. If not, see |
|
17 ## <http://www.gnu.org/licenses/>. |
3191
|
18 |
3439
|
19 ## -*- texinfo -*- |
|
20 ## @deftypefn {Function File} {} fvl (@var{r}, @var{n}, @var{l}) |
|
21 ## Return the future value at the end of @var{n} periods of an initial |
|
22 ## lump sum investment @var{l}, given a per-period interest rate |
|
23 ## @var{r}. |
3191
|
24 ## |
3439
|
25 ## Note that the rate @var{r} is specified as a fraction (i.e., 0.05, |
|
26 ## not 5 percent). |
|
27 ## @end deftypefn |
3191
|
28 |
5428
|
29 ## Author: KH <Kurt.Hornik@wu-wien.ac.at> |
3458
|
30 ## Description: Future value of an initial lump sum investment |
3426
|
31 |
3191
|
32 function v = fvl (r, n, l) |
3426
|
33 |
3191
|
34 if (nargin != 3) |
6046
|
35 print_usage (); |
3191
|
36 endif |
3426
|
37 |
6497
|
38 if (! (isscalar (r) && r > -1)) |
3458
|
39 error ("fvl: r has to be a scalar > -1"); |
6497
|
40 elseif (! (isscalar (n) && n > 0)) |
3458
|
41 error ("fvl: n has to be a positive scalar"); |
4030
|
42 elseif (! isscalar (l)) |
3458
|
43 error ("fvl: l has to be a scalar"); |
3191
|
44 endif |
3426
|
45 |
3191
|
46 v = l * (1 + r)^n; |
3426
|
47 |
3191
|
48 endfunction |