Compound Interest

Now that we've shown you some of the symbolic computing capabilities of Mathematica,
we're going to consider a series of problems from economics involving compound
interest. We have several goals in doing this.

First, we want to use some of what you're just learned about Mathematica and at the
same time show you some more of its capabilities. You should also pick up on
the fact that there's no way we can show you all that Mathematica has to offer.
Mathematica (your textbook) will give you an idea of the breadth of
Mathematica. As you already know, there is also substantial online help available.
Most any new concept that you are likely to learn in an undergraduate math class is
supported in some form by Mathematica.

Second, we want to you to come to appreciate that Mathematica will not do your math
homework for you. Mathematica is not magic---you have to understand a lot about the
underlying mathematics in order to make progress with Mathematica. If you are doing
a physics word problem, for example, you have to understand how to transform
the problem into a purely mathematical form. At that point, if you choose,
Mathematica can help you arrive at a solution. Think of Mathematica as something that will
help you with the uninteresting details of a problem, in much the same way that
a calculator does.

Fixed-Rate Interest

User-Defined Functions

Exponential Growth

Doubling an Investment

Approximate Doubling

Compounding Intervals

So far, both our interest rates and our compounding interval have been annual.
In the real world, interest rates are indeed generally expressed as annual
rates, but interest is usually compounded more frequently. A checking account,
for example, may earn interest that is compounded daily, while on a mortgage
interest is typically compounded monthly.

Let's see what would happen if interest were compounded bi-annually. For
example, if instead of getting 6% interest at the end of the year, what would
happen if we got 3% interest in the middle of the year and then another 3%
at the end of the year?

Let's repeat the analysis that we did when we first considered compound
interest. If we invest an amount P at an annual rate of R, then after six
months we would have (1+R/2)P. At the end of year, then, we would have
(1+R/2)(1+R/2)P. Try to come up with a formula for the amount of money in
the account after n full years. Once you have it, define a function
compoundtwice, along the lines of compound.


Click here for the answer


Now that we have an expression for bi-annual compound interest, let's see if
we can express it as a power of E. As we did before, let's start by
solving an equation:


answer = Solve[E^x == (1+R/2)^(2*n), x]

As before, this gives us the power to which we should raise E. Let's see if
we can obtain a simpler formula, as we did last time:


Simplify[answer]


What we get via simplification doesn't look very simple. What went wrong?


Click here for an answer


Of course, given that you probably know something about simplifying logarithms
of powers, you could have done this by hand. The flexible simplification
capabilities of Mathematica come in hand when the expression in question is too
complicated to deal with easily by hand.

We can now redefine compoundtwice in the new form:


compoundtwice[P_,R_,n_) := P*E^(2*n*Log[1+R/2];

What is the growth rate for an investment that is compounded bi-annually? How
does this compare with the growth rate for an investment that is compounded
annually?

We now have the functions compound and compoundtwice. Let's take
a look at them in Mathematica:


compound[P,R,n]
              n
P (1 + R)

compoundtwice[P,R,n]
            R 2 n
P (1 + -)
2


Compare them, and see if you can guess what the function for doing quarterly
compounding would look like. What about monthly compounding?


Click here for the answer

Based upon this observation, see if you can come up with a function that gives
the amount of interest earned on an initial investment of P, at an interest
rate of R, over a period of n years, with interest compounded m times per
year. This is just our original compound interest problem with the extra
variable m added. Call your function intervals.


Click here for the answer

intervals[P_,R_,n_,m_]:= P*E^(m*n*Log[1+R/m])


Back in the early 1970s, the interest rates that banks could pay on regular
savings accounts were strictly regulated. Typically, a bank could pay no more
than 5% on such accounts. After a time, banking deregulation and double-digit
inflation led to this limit being revoked and interest rates rose higher, at
least until the 1990s.

Since the amount of interest that they could pay depositors was regulated by
the government, one way that banks competed in the 1970s was by offering
favorable compounding intervals. If one bank compounded monthly while another
compounded daily, the second bank would enjoy a competitive advantage even
though both were paying 5% annual interest.

Of course, there was no reason to stop at daily compounding. A bank could, if
it chose, compound every hour or every minute or every second. And in fact,
many banks took it to the limit and began compounding continuously.

But what is continuous compounding? Just as monthly compounding means
paying out interest 12 times per year at one-twelfth of the annual rate,
continuous compounding (at least conceptually) means paying out interest an
infinite number of times per year at an infinitesimal faction of the annual
rate.

Here's the key idea: we can derive an expression for the growth of a
continuously compounded investment by finding the limit of the compounding
expression P*E^(m*n*ln(1+R/m)) as the number of compounding intervals
m goes to infinity.

It is probably not immediately obvious to you what the limit at infinity of
this expression is, and you may not even know how to go about calculating it.
But as long as you know that you need to calculate the limit, Mathematica can help
you with the calculation.

Let's warm up by using Mathematica to calculate a few interesting limits. For
example, how about the limit of 1/x^2 as x goes to zero:


Limit[1/x^2, x->0]


Or the limit of 1/x as x goes to infinity:


Limit[1/x, x-> Infinity]


Or the limit of 1/ x as x goes to zero:


Limit[1/x, x-> 0]



Now let's return to our original problem: coming up with an expression for
continuously compounded interest. To interpret the answer, you need to know
that Exp[x] is another way of writing E^x. This notation is
common in both Mathematica and in mathematics at large.


Limit[P*E^(m*n*Log[1+R/m]), m -> Infinity]


Here's a simpler way to compute the same limit. Notice that we use the
function intervals that we previously defined, but we give it
variables as arguments.


Limit[intervals[P,R,n,m], m -> Infinity]


What is the growth rate of a continuously-compounded investment? What is
interesting about it?


Click here for the answer


Define a function continuous, along the same lines as compound and
compoundtwice, that calculates continuously compounded interest.