[ See also Net Present Value @ Wikipedia ]
NPV = \sum_{i=0}^n \frac{R_{ti}}{(1+r)^{t_i}} = R_0 + \sum_{i=1}^n \frac{R_{ti}}{(1+r)^{t_i}} |
where
n – total number of time steps
t_i – time passed since the first investment ( assuming that t_0 = 0),
r = \rm \frac{Cash_{out} - Cash_{in}}{Cash_{in}} – the discount rate, i.e. the return that could be earned per unit of time on an investment with similar risk
R_{ti} = \rm Cash_{in}(t_i) - \rm Cash_{out}(t_i) – the net cash flow at time step t.
R_0 = - \rm Cash_{out}(t=0) – the volume of cash investment at initial time moment t_0 = 0.