Overview
Present value calculation allow you to determine what the value of a series of cash flows is at different dates, present or future. The following demonstrate some simple examples.
Future Value Calculations
Supposing we have an amount of money {% P_0 %} today, the amount of money we will have after {% n %} periods, given that we can invest the money at an interest rate of r, is
{% P_n = P_0(1+r)^n %}
The above equation can be implemented simply using standard javascript utilities.
let futureValue = 100 * Math.pow(1.1, 10);
Try it!
The calculations can also be done using the present-value library. Given that present value calculations are so simple, the only advantage to using the library is poosibly for readibility.
let pv = await import('/lib/finance/fixed-income/present-value/v1.0.0/present-value.mjs');
let futureValue = pv.value(100, 10, 0.03);
//alternate computation
let futureValue2 = pv.value({
value:100,
periods:10,
rate:0.03
});
Present Value Calculations
The present value is the opposite of future value. Instead of asking how much money will I have in the future, the question now becomes, how much do I need to invest today to get the specified future value. An alternate way to think about it would be, suppose you will receive a specified amount of money in future. How much can you borrow from the bank today such that when the future amount is received, you can pay off the loan from the bank. This is the origin of the terms "present" value and "future" value. If the bank is available, you can "transform" an amount of money at any point in time to an amount of money at some other point.
{% P_0 = P_n(1+r)^{-n} %}
let presentValue = 100 * Math.pow(1.1, -10);
Try it!
let pv = await import('/lib/finance/fixed-income/present-value/v1.0.0/present-value.mjs');
let presentValue = pv.value(100, -10, 0.03);
//alternate computation
let presentValue2 = pv.value({
value:100,
periods:-10,
rate:0.03
});
Try it!
Present Value of a Sum
When given a series of future cash flows, the present value of all the cash flows is just the sum of the present value of each individual cash flow. That is
{% PV = \sum_{i=1}^n \frac{P_i}{(1+r)^i} %}
let presentValue = 0;
let rate = 0.1;
let cashFlows = [{ time:1.0, value:100 }, {time:1.5, value}];
for(let cashFlow of cashFlows) {
presentValue += cashFlow.value * Math.exp(-1*rate*cashFlow.time);
}
Annualized Rates
When the interest rate {% r %} is quoted as an Annualized figure, but the payments occur more frequently (say, {% n %} periods per year) , the prsent value formula becomes
{% PV = \sum_i \frac{P_i}{(1 + r/n )^i} %}
(see
quotation conventions
)