One of the simplest and most useful arithmetical operations to be performed by means of loops are the sums and products of terms. A sum, mathematically defined as
is performed by accumulating each term in the sum via a loop running over all the terms. The sum is first defined to be 0. The following illustrates the sum of the square of integers.
The product, mathematically defined as
is performed likewise via loops. Note that the product is first defined as 1.
An application of these concepts is the calculation of the compound interest for a long term deposit. The problem is specified by the interest rate quoted to the customer, the number of payments made per year, the number of years in the plan, and the initial amount of money. At the end of each payment period the bank adds the interest ( principal x interest rate per period ) to the principal at that time.
This Maple worksheet produces the following table:
Section 7.2
Chapter 7
Section 7.4
TOC
Any questions or suggestions should be directed to |