w3resource

NumPy Financial functions: fv() function

numpy.fv() function

The fv() function is used to compute the future value.

Syntax:

numpy.fv(rate, nper, pmt, pv, when='end')[source]

Given:

  • a present value, pv
  • an interest rate compounded once per period, of which there are
  • nper total
  • a (fixed) payment, pmt, paid either
  • at the beginning (when = {'begin', 1}) or the end (when = {'end', 0}) of each period

Version: 1.15.0

Parameter:

Name Description Required /
Optional
rate Rate of interest as decimal (not per cent) per period
scalar or array_like of shape(M, )
Required
nper Number of compounding periods
scalar or array_like of shape(M, )
Required
pmt Payment
scalar or array_like of shape(M, )
Required
pv Present value
scalar or array_like of shape(M, )
Required
when When payments are due ('begin' (1) or 'end' (0)). Defaults to {'end', 0}.
{{'begin', 1}, {'end', 0}}, {string, int}
Optional

Return value: the value at the end of the nper periods

Returns: out : ndarray

Future values. If all input is scalar, returns a scalar float. If any input is array_like, returns future values for each input element.
If multiple inputs are array_like, they all must have the same shape.

Notes:

The future value is computed by solving the equation:

fv +
pv*(1+rate)**nper +
pmt*(1 + rate*when)/rate*((1 + rate)**nper - 1) == 0

or, when rate == 0:

fv + pv + pmt * nper == 0

NumPy.fv() method Example-1:

What is the future value after 10 years of saving $200 now, with an additional monthly savings of $200. Assume the interest rate is 6% (annually) compounded monthly?

>>> import numpy as np
>>> np.fv(0.06/12, 10*12, -200, -200)

Output:

33139.748708098065

NumPy.fv() method Example-2:

By convention, the negative sign represents cash flow out (i.e. money not available today). Thus, saving $200 a month at 6% annual interest leads to $33,139.75 available to spend in 10 years.

If any input is array_like, returns an array of equal shape. Let's compare different interest rates from the example above.

import numpy as np
x = np.array((0.06, 0.06, 0.07))/12
np.fv(x, 10*12, -200, -200)

Output:

array([33139.7487081 , 33139.7487081 , 35018.89376205])

Python - NumPy Code Editor:

Previous: NumPy Home
Next: pv() function



Follow us on Facebook and Twitter for latest update.