Question: For a yearly interest rate 0 < r < 1 compounded over n intervals, an amount of money C grows to be f(C,r,n) =
For a yearly interest rate 0 < r < 1 compounded over n intervals, an amount of money C grows to be f(C,r,n) = C (1 + 7)" after one year. Let C = 1 and r = 0.025. If n is large, there may be loss of digits when evaluating this using finite-precision arithmetic. (a) If n is extremely large, say n = 106, in IEEE double precision arithmetic (try it in Matlab), f (1.0, 0.025, 106) = 1.0, when in fact, f(1.0, 0.025, 106) ~ lim 848 0.025 1.025315... = n 0.025)* 1+ What happened? (b) To compute f(C, r, n) without roundoff problems in Matlab, compute first In f using the built-in Matlab function log1p which computes In (1+x) without losing digits even for very small x, and then compute f from its logarithm. Write down the formulas used. Try this for n = 106. Then repeat the calculation for n = 108.
Step by Step Solution
3.46 Rating (156 Votes )
There are 3 Steps involved in it
a What happened is that the computer rounded off the number too early resulting in an incorrect answ... View full answer
Get step-by-step solutions from verified subject matter experts
