w3resource

NumPy Financial functions: rate() function

numpy.rate() function

The rate() function is used to compute the rate of interest per period.

Syntax:

numpy.rate(nper, pmt, pv, fv, when='end', guess=0.1, tol=1e-06, maxiter=100)

Version: 1.15.0

Parameter:

Name Description Required /
Optional
nper Number of compounding periods
array_like
Required
pmt Payment
array_like
Required
pv Present value
array_like
Required
fv Future value
array_like
Required
when When payments are due ('begin' (1) or 'end' (0))
{{'begin', 1}, {'end', 0}}, {string, int}
Optional
guess Starting guess for solving the rate of interest, default 0.1
Number
Optional
tol Required tolerance for the solution, default 1e-6
Number
Optional
maxiter Maximum iterations in finding the solution
int
Optional

Notes:

The rate of interest is computed by iteratively solving the (non-linear) equation:

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

NumPy.rate() method Example-1:

>>> import numpy as np
>>> np.rate(8, 10000, 500, 200) 

Output:

-2.0184122884653117

Rate is 2.018 per period.

Python - NumPy Code Editor:

Previous: nper() function
Next: NumPy Home



Follow us on Facebook and Twitter for latest update.