Present value

Dessign the function @valor_presente(I, r)@ that calculates the present value of an investment II represented as a list of monthly payments and a monthly interest rate rr.

Example: John asks Paul to rent his vehicle for 3 months for a monthly payment of 5000 euros (the first payment is today). Once this time has passed, he will buy the vehicle for 45000 euros. John’s opportunity cost is 5% monthly. ¿Which is the present value of the project?

John’s investment is: I=[5000,5000,5000,45000]I= [5000, 5000, 5000, 45000]. The opportunity cost is r=0.05r = 0.05. The @valor_presente(I, r)@ is 5000+5000/(1.05)+5000/(1.05)2+45000/(1.05)3=53169.744088111435000 + 5000/(1.05) + 5000/(1.05)^2 + 45000/(1.05)^3 = 53169.74408811143

In general, if the investment is given by I=[I0,I1,,In]I = [I_0, I_1, \ldots, I_{n}], the present value is I[0]+i=1nI[i](1+r)iI[0] + \sum_{i=1}^{n}\dfrac{I[i]}{(1+r)^i}

Sample session

Problem information

Author: InfBesos

Generation: 2026-01-25T19:23:14.698Z

© Jutge.org, 2006–2026.
https://jutge.org