Exercise

Anywhere, anytime?

Reflecting upon her spending pattern, Cynthia wonders how much money she would collect if she puts her money on a bank account instead of spending it on downloads and concert tickets. To this end, you will calculate the value of the cash flows at a future point in time, using an appropriate discount function.

Cynthia's spending pattern is shown above. The cash_flows vector, which you defined in the first exercise, has been preloaded into your workspace. The interest rate is still 2%.

Instructions

100 XP
  • Define the function discount() which computes the value at time \(s\) of 1 EUR paid at time \(t\).
  • Use discount() to compute the present value of the cash_flows at times 0 to 5. This should match your earlier result, namely 444.93 EUR.
  • Print the value of the cash flow vector when Cynthia turns 18 in 6 years from now.
  • Compute the accumulated value of the cash flow vector at time 6 in a different way. This time convert the present_value at time 0 to the value at time 6.