2.9
金利をr(=5%)とおき、新しい屋根にかかる1年毎の費用をxとおくと、次式が成り立つ。
x(1 / (1 + r) + ... + 1 / (1 + r)20) = 20,000($)
この式をxについて解くと、x=1,604($)である。
現在の屋根の価値vは、キャッシュフロー流列(0, x, x, x, x, x)の現在価値に等しいから、
v = x(1 / (1 + r) + ... + 1 / (1 + r)5) = 6,948($)
となる。
Python
added on 2015-03-29.
code
# 2.9.py
# 19:10 2015-03-29
r=0.05
pv=20e3
n1=20
n2=5
i1=list(range(1,n1+1))
i2=list(range(1,n2+1))
sumdf1=sum(map(lambda x: 1/(1+r)**x,i1))
sumdf2=sum(map(lambda x: 1/(1+r)**x,i2))
x=pv/sumdf1
v=x*sumdf2
print("r= ",r)
print("pv($)= ",pv)
print("n1= ",n1)
print("n2= ",n2)
print("i1= ",i1)
print("i2= ",i2)
print("total of discount factors= ", round(sumdf1,1))
print("each year's cost($)= ", round(x,1))
print("present value of the roof($)= ",round(v,1))
output
r= 0.05 pv($)= 20000.0 n1= 20 n2= 5 i1= [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] i2= [1, 2, 3, 4, 5] total of discount factors= 12.5 each year's cost($)= 1604.9 present value of the roof($)= 6948.2
Fortran code
Gauche code
2.9.scm(2025-02-01 open revised 2.9.scm)
JavaScript code
added on 2016-02-07.
Julia code
added on 2024-10-27.
history
revised on 2005-7-2, 2007-04-28, 2009-11-01, 2011-11-02, 2014-02-12,
2015-03-29, 2016-02-07, 2016-09-28.
2016-09-28 Fortran, Gauche, Javascript codes moved to linked files.
2018-01-04 XHTML1.0 changed to HTML5.
2018-06-03 charset shift-jis to utf-8.
2021-02-14 move history.
2024-10-27 add 2.9.jl
2025-02-01 open revised 2.9.scm.