O'Reilly logo

Actionscript Cookbook by Joey Lott

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.16. Calculating Asset Appreciation (Future Value)

Problem

You want to know how much something will be worth in the future, given its value today and an expected interest rate, i (for example, calculating the amount of money you can accumulate in a savings account given an initial deposit).

Solution

You must calculate the appreciation of an asset over time at the assumed interest rate. This is often referred to as the future value of an asset. For a given interest rate, i, an asset appreciates by a factor of (1 + i) for each period (such as a year).

Discussion

For the purposes of illustration, let’s calculate the future value of an asset using the brute-force method.

If you deposit $1 in a bank account that earns 5% interest per year, one year from now, you will have earned 5 cents in interest. The total account, including principal and interest, will be worth $1.05. The math for this is:

FV = PV * (1 + i);

where FV is the future value (the amount of money you’ll have next year, sometimes called FV1), PV is the present value (the amount of money you deposited initially, sometimes called FV0), and i is the interest rate (expressed as a decimal, such as 0.05).

So if you deposit $100 at a 5% interest rate, the future value at the end of one year is $105, which is determined as follows:

FV1 = 100 * (1 + .05);

Typically, interest is compounded over time, so at the end of the second year, the value is:

FV2 = FV1 * (1 + i);

Here is a function that calculates the future value by brute force for ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required