Question: Chapter 1: Scientific Computing 1.13. If an amount a is invested at interest rate compounded n times per year, then the final value f at

 Chapter 1: Scientific Computing 1.13. If an amount a is invested

Chapter 1: Scientific Computing 1.13. If an amount a is invested at interest rate compounded n times per year, then the final value f at the end of one year is given by f = a(1+r)". This is the familiar formula for compound inter- est. With simple interest, n =1. Typically, com- pounding is done quarterly, n = 4. or perhaps even daily 365. Obviously, the more frequent the compdunding, the greater the final amount, because more interest is paid on previous interest. But how much difference does this frequency ac- tually make? Write a program that implements the compound interest formula. Test your pro- gram using an initial investment of a = 100, an interest rate of 5 percent (ie.. = 0.05), and the following values for na: 1, 4, 12, 365. Also exper- iment with what happens when n becomes very large. Can you find a value such that the final amount does not grow with the frequency of com- pounding, as it should? (This will be easy if you use single precision, but much harder if you use double precision.) Implement the compound interest formula in two different ways (a) If the programming language you use does not have an operator for exponentiation (e.g.,C), then you might implement the compound interest for- mula using a loop that repeatedly multiplies a by (1 + r) for a total of n times. Even if your programming language does have an operator for exponentiation (eg.. Fortran), try implementing the compound interest formula using such a loop and print your results for the input values. (6) With the functions exp(x) and log(x), the com- pound interest formula can also be written -a exp(nu log(1 + r)). Implement this formula using the corresponding built-in functions and compare your results with those for the first Implementation using the loop for the same input values Chapter 1: Scientific Computing 1.13. If an amount a is invested at interest rate compounded n times per year, then the final value f at the end of one year is given by f = a(1+r)". This is the familiar formula for compound inter- est. With simple interest, n =1. Typically, com- pounding is done quarterly, n = 4. or perhaps even daily 365. Obviously, the more frequent the compdunding, the greater the final amount, because more interest is paid on previous interest. But how much difference does this frequency ac- tually make? Write a program that implements the compound interest formula. Test your pro- gram using an initial investment of a = 100, an interest rate of 5 percent (ie.. = 0.05), and the following values for na: 1, 4, 12, 365. Also exper- iment with what happens when n becomes very large. Can you find a value such that the final amount does not grow with the frequency of com- pounding, as it should? (This will be easy if you use single precision, but much harder if you use double precision.) Implement the compound interest formula in two different ways (a) If the programming language you use does not have an operator for exponentiation (e.g.,C), then you might implement the compound interest for- mula using a loop that repeatedly multiplies a by (1 + r) for a total of n times. Even if your programming language does have an operator for exponentiation (eg.. Fortran), try implementing the compound interest formula using such a loop and print your results for the input values. (6) With the functions exp(x) and log(x), the com- pound interest formula can also be written -a exp(nu log(1 + r)). Implement this formula using the corresponding built-in functions and compare your results with those for the first Implementation using the loop for the same input values

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!