iconEuler Reference

Interest Rates

Content

Computes interest rates for investments.

Load these functions with "load interest".

Interest Rates

function rate (x:vector, n:vector=none)
  Compute the interest rate in % for an investment with returns.
  
  x : Vector of payments (negative) or income (positive) at evenly
  spaced periods or at times in the vector n.
  n : times of payments (default is yearly).
  
  >load interest;
  >rate([1000,-50,-50,-50,-50,-1050])+"%" // savings
  5%
  >rate([-1000,0,0,0,0,1200])+"%" // accumulated interest
  3.71372893366%
  >rate(100000|(-10150*ones(1,20))) // 20 year loan
  7.95349754169
  >rate([-1200,0,0,0,2100]), rate([-1200,2100],[0,4])
  15.0163316896
  15.0163316895
  
  See: 
simrate (Interest Rates)
function simrate (v:vector, P:positive real, digits=none)
  Simulates payments in vector v at rate P in %
  
  >v=simrate(100000|(-10150*ones(1,20)),7.96,2)
  [ 100000  97810  95445.68  92893.16  90137.46  87162.4  83950.53
  80482.99  76739.44  72697.9  68334.65  63624.09  58538.57  53048.24
  47120.88  40721.7  33813.15  26354.68  18302.51  9609.39  224.3 ]
  >columnsplot(v);
  
function map investment (start, instalment, final, n; i0=1, i1=1)
  Computes the interest rate of a loan and other investments.
  
  Note that payments are negative!
  
  start: start investment at period 0
  instalment: rate payed at the start of periods i0 to n-i1 (by
  default n-1 rates)
  final: that is the final dept after n periods
  
  >print(investment(1000,-50,-1050,10),2,unit="%")
  5.00%
  >print(investment(1000,0,-1200,5),2,unit="%")
  3.71%
  >print(investment(100000,-10150,0,21),2,unit="%")
  7.95%
  
  The result is the interest rate in %.
  
  See: 
rate (Interest Rates)
function finaldebt (loan,periods,rate,payment,start=1)
  Compute the final dept of a loan after periods of payments.
  
  See: 
rate (Interest Rates)

Documentation Homepage