# Group 7: Emily Dinan, Meg Donohue, Ashley Vega
# Problem 1A
# r(n) will be the interest rate for each month n
def r(n):
if n==1:
return (0.10)
else:
return (0.10 + .01*(n-1))
# d(n) will be the deposit made at the end of each month n
def d(n):
return RDF(100)
# P(n) will refer to the total balance at the end of each month n
def P(n):
if n==0:
return RDF(2000)
else:
return RDF((1+(r(n)/12))*(P(n-1))+ d(n))
print " n P";
for n in range(0,36): print "%2s "%(n),; print "%16s "%(P(n))
# It is clear that the balance surpasses $10,000 when n=35.
Q = [[n, P(n)] for n in range(36)]
pplot= scatter_plot(Q);
pplot.show()
|
|
n P
0 2000.0
1 2116.66666667
2 2236.06944444
3 2358.43013889
4 2483.97979873
5 2612.95956305
6 2745.62155758
7 2882.22984502
8 3023.06143449
9 3168.40735601
10 3318.57380581
11 3473.88336924
12 3634.6763282
13 3801.31206089
14 3974.17054205
15 4153.65395289
16 4340.18841025
17 4534.2258258
18 4736.24590688
19 4946.75831137
20 5166.30497057
21 5395.46259483
22 5634.84537853
23 5885.10792196
24 6146.94838981
25 6421.11192752
26 6708.39435874
27 7009.6461895
28 7325.77694701
29 7657.75988367
30 8006.63707989
31 8373.52498255
32 8759.62041946
33 9166.20713414
34 9594.66288978
35 10046.4671957

n P
0 2000.0
1 2116.66666667
2 2236.06944444
3 2358.43013889
4 2483.97979873
5 2612.95956305
6 2745.62155758
7 2882.22984502
8 3023.06143449
9 3168.40735601
10 3318.57380581
11 3473.88336924
12 3634.6763282
13 3801.31206089
14 3974.17054205
15 4153.65395289
16 4340.18841025
17 4534.2258258
18 4736.24590688
19 4946.75831137
20 5166.30497057
21 5395.46259483
22 5634.84537853
23 5885.10792196
24 6146.94838981
25 6421.11192752
26 6708.39435874
27 7009.6461895
28 7325.77694701
29 7657.75988367
30 8006.63707989
31 8373.52498255
32 8759.62041946
33 9166.20713414
34 9594.66288978
35 10046.4671957

|