pub fn net_present_value_solution<C, I>(
rate: f64,
periods: u32,
initial_investment: I,
cashflow: C,
) -> NpvSolutionExpand description
Returns the net present value of a future series of constant cashflows and constant rate, subtracting the initial investment cost. Returns a solution struct with additional features..
Related functions:
- To calculate a net present value with a varying rate or varying cashflow or both, use
net_present_value_schedule.
The net present value annuity formula is:
npv = initial_investment + sum( cashflow / (1 + rate)period )
or
npv = initial_investment + cashflow * ((1. - (1. / (1. + rate)).powf(periods)) / rate)
ยงArguments
rate- The rate at which the investment grows or shrinks per period, expressed as a floating point number. For instance 0.05 would mean 5%. Often appears asroriin formulas.periods- The number of periods such as quarters or years. Often appears asnort.cashflow- The value of the constant cashflow (aka payment).initial investment- The value of the initial investment (should be negative, or 0).