www.delorie.com/gnu/docs/calc/calc_211.html   search  
 
Buy the book!


GNU Emacs Calc 2.02 Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.6.6 Definitions

For your reference, here are the actual formulas used to compute Calc's financial functions.

Calc will not evaluate a financial function unless the rate or n argument is known. However, payment or amount can be a variable. Calc expands these functions according to the formulas below for symbolic arguments only when you use the a " (calc-expand-formula) command, or when taking derivatives or integrals or solving equations involving the functions.

These formulas are shown using the conventions of "Big" display mode (d B); for example, the formula for fv written linearly is `pmt * ((1 + rate)^n) - 1) / rate'.

 
                                        n
                              (1 + rate)  - 1
fv(rate, n, pmt) =      pmt * ---------------
                                   rate

                                         n
                              ((1 + rate)  - 1) (1 + rate)
fvb(rate, n, pmt) =     pmt * ----------------------------
                                         rate

                                        n
fvl(rate, n, pmt) =     pmt * (1 + rate)

                                            -n
                              1 - (1 + rate)  
pv(rate, n, pmt) =      pmt * ----------------
                                    rate

                                             -n
                              (1 - (1 + rate)  ) (1 + rate)
pvb(rate, n, pmt) =     pmt * -----------------------------
                                         rate

                                        -n
pvl(rate, n, pmt) =     pmt * (1 + rate)

                                    -1               -2               -3
npv(rate, [a, b, c]) =  a*(1 + rate)   + b*(1 + rate)   + c*(1 + rate)

                                        -1               -2
npvb(rate, [a, b, c]) = a + b*(1 + rate)   + c*(1 + rate)

                                             -n
                        (amt - x * (1 + rate)  ) * rate
pmt(rate, n, amt, x) =  -------------------------------
                                             -n
                               1 - (1 + rate)

                                             -n
                        (amt - x * (1 + rate)  ) * rate
pmtb(rate, n, amt, x) = -------------------------------
                                        -n
                         (1 - (1 + rate)  ) (1 + rate)

                                   amt * rate
nper(rate, pmt, amt) =  - log(1 - ------------, 1 + rate)
                                      pmt

                                    amt * rate
nperb(rate, pmt, amt) = - log(1 - ---------------, 1 + rate)
                                  pmt * (1 + rate)

                              amt
nperl(rate, pmt, amt) = - log(---, 1 + rate)
                              pmt

                           1/n
                        pmt
ratel(n, pmt, amt) =    ------ - 1
                           1/n
                        amt

                        cost - salv
sln(cost, salv, life) = -----------
                           life

                             (cost - salv) * (life - per + 1)
syd(cost, salv, life, per) = --------------------------------
                                  life * (life + 1) / 2

                             book * 2
ddb(cost, salv, life, per) = --------,  book = cost - depreciation so far
                               life

In pmt and pmtb, x=0 if omitted.

These functions accept any numeric objects, including error forms, intervals, and even (though not very usefully) complex numbers. The above formulas specify exactly the behavior of these functions with all sorts of inputs.

Note that if the first argument to the log in nper is negative, nper leaves itself in symbolic form rather than returning a (financially meaningless) complex number.

`rate(num, pmt, amt)' solves the equation `pv(rate, num, pmt) = amt' for `rate' using H a R (calc-find-root), with the interval `[.01% .. 100%]' for an initial guess. The rateb function is the same except that it uses pvb. Note that ratel can be solved directly; its formula is shown in the above list.

Similarly, `irr(pmts)' solves the equation `npv(rate, pmts) = 0' for `rate'.

If you give a fourth argument to nper or nperb, Calc will also use H a R to solve the equation using an initial guess interval of `[0 .. 100]'.

A fourth argument to fv simply sums the two components calculated from the above formulas for fv and fvl. The same is true of fvb, pv, and pvb.

The ddb function is computed iteratively; the "book" value starts out equal to cost, and decreases according to the above formula for the specified number of periods. If the book value would decrease below salvage, it only decreases to salvage and the depreciation is zero for all subsequent periods. The ddb function returns the amount the book value decreased in the specified period.

The Calc financial function names were borrowed mostly from Microsoft Excel and Borland's Quattro. The ratel function corresponds to `@CGR' in Borland's Reflex. The nper and nperl functions correspond to `@TERM' and `@CTERM' in Quattro, respectively. Beware that the Calc functions may take their arguments in a different order than the corresponding functions in your favorite spreadsheet.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003