MathModProject1

482 days ago by acarmusciano

# Number 1 Part A # P is the Principal Amount # i = interest factor # j = compound interest factor # n is an index # k is also an index but used for plotting # a is used in the for loop to print out the table of values P = 2000; i = 1.0010; j = 0; n = 1; k=1; a = 0; m = vector(RDF,100) # This is used to store the bank account values based on index m[0] = P; while P<=10000: P = (P*i) + 100; j=.0001; i = i+j; m[n] = P; Q = [n,m[n]]; if P>=9999: if P<=10001: print "Number of months until bank account reaches $10000 is:"; print "%26s"%(n); l=n; # l is used to store the value where the bank account reaches 10,000 print "Account value at 63 months is:"; print "%20s"%(m[n]); n=n+1; Q = [[k, m[k]] for k in range(l+1)] pplot= scatter_plot(Q); pplot.show() print "Index Amount" for a in range (0,64): print "%2s "%(a),; print "%16s"%(m[a]) 
       
Number of months until bank account reaches $10000 is:
                        63
Account value at 63 months is:
       10000.3687295

Index         Amount
 0            2000.0
 1            2102.0
 2         2204.3122
 3     2306.95737464
 4     2409.95641923
 5     2513.33035821
 6     2617.10035375
 7     2721.28771432
 8     2825.91390343
 9     2931.00054846
10      3036.5694495
11      3142.6425884
12     3249.24213783
13     3356.39047054
14     3464.11016862
15     3572.42403302
16     3681.35509311
17     3790.92661635
18     3901.16211821
19     4012.08537214
20     4123.72041972
21     4236.09158098
22     4349.22346488
23     4463.14097997
24     4577.86934521
25     4693.43410098
26     4809.86112033
27     4927.17662037
28     5045.40717386
29     5164.57972112
30     5284.72158203
31     5405.86046836
32     5528.02449628
33     5651.24219917
34     5775.54254062
35      5900.9549278
36     6027.50922498
37     6155.23576741
38     6284.16537552
39     6414.32936932
40     6545.75958323
41     6678.48838115
42     6812.54867189
43     6947.97392498
44     7084.79818679
45       7223.056097
46     7362.78290553
47      7504.0144898
48     7646.78737239
49     7791.13873915
50     7937.10645771
51     8084.72909646
52     8234.04594395
53      8385.0970288
54     8537.92314008
55     8692.56584818
56     8849.06752619
57     9007.47137186
58     9167.82143006
59     9330.16261578
60     9494.54073783
61     9661.00252299
62     9829.59564091
63     10000.3687295
Number of months until bank account reaches $10000 is:
                        63
Account value at 63 months is:
       10000.3687295

Index         Amount
 0            2000.0
 1            2102.0
 2         2204.3122
 3     2306.95737464
 4     2409.95641923
 5     2513.33035821
 6     2617.10035375
 7     2721.28771432
 8     2825.91390343
 9     2931.00054846
10      3036.5694495
11      3142.6425884
12     3249.24213783
13     3356.39047054
14     3464.11016862
15     3572.42403302
16     3681.35509311
17     3790.92661635
18     3901.16211821
19     4012.08537214
20     4123.72041972
21     4236.09158098
22     4349.22346488
23     4463.14097997
24     4577.86934521
25     4693.43410098
26     4809.86112033
27     4927.17662037
28     5045.40717386
29     5164.57972112
30     5284.72158203
31     5405.86046836
32     5528.02449628
33     5651.24219917
34     5775.54254062
35      5900.9549278
36     6027.50922498
37     6155.23576741
38     6284.16537552
39     6414.32936932
40     6545.75958323
41     6678.48838115
42     6812.54867189
43     6947.97392498
44     7084.79818679
45       7223.056097
46     7362.78290553
47      7504.0144898
48     7646.78737239
49     7791.13873915
50     7937.10645771
51     8084.72909646
52     8234.04594395
53      8385.0970288
54     8537.92314008
55     8692.56584818
56     8849.06752619
57     9007.47137186
58     9167.82143006
59     9330.16261578
60     9494.54073783
61     9661.00252299
62     9829.59564091
63     10000.3687295
# Number 1 Part B # P is the Principal Amount # i = interest factor # j = compound interest factor # z is an index # k is also an index but used for plotting # a is used in the for loop to print out the table of values # D is used as the deposits per month based on the requirements for part B P = 2000; i = 1.0010; j = 0; z = 1; k=1; a = 0; D = 100; m = vector(RDF,800) m[0] = P; while P<=10000: P = (P*i) + D; j=.0001; i = i+j; D = D/2; m[z] = P; Q = [z,m[z]]; if P>=9999: if P<=10200: print "Number of months until bank account reaches $10000 is:"; print "%26s"%(z); c = z; # c is used to store the value where the bank account reaches 10,000 print "Account value at 166 months is:"; print "%20s"%(m[z]); z=z+1; Q = [[k, m[k]] for k in range(c+1)] pplot= scatter_plot(Q); pplot.show() print "Index Amount" for a in range (0,c+1): print "%2s "%(a),; print "%16s"%(m[a]) 
       
WARNING: Output truncated!  
full_output.txt



Number of months until bank account reaches $10000 is:
                       166
Account value at 166 months is:
       10123.1864537

Index         Amount
 0            2000.0
 1            2102.0
 2         2154.3122
 3     2181.89737464
 4     2197.23384123
 5      2206.5599686
 6     2212.99480856
 7     2218.09810025
 8     2222.65011702
 9     2227.04151223
10     2231.46820361
11     2236.02879626
12     2240.77328486
13     2245.72740015
14      2250.9047802
15     2256.31305519
16     2261.95688958
17     2267.83950338
18     2273.96343298
19     2280.33091206
20     2286.94406244
21     2293.80498999
22     2300.91583314
23     2308.27878765
24     2315.89611957
25     2323.77017234
26     2331.90337092
27     2340.29822455
28     2348.95732872
29     2357.88336695
30     2367.07911226
31     2376.54742881
32     2386.29127331
33     2396.31369668
34     2406.61784559
35     2417.20696412
36     2428.08439546
37     2439.25358368
38     2450.71807552
39     2462.48152228
40     2474.54768174
41     2486.92042015
42     2499.60371429
43     2512.60165361
44     2525.91844237
45     2539.55840196
46     2553.52597317
47     2567.82571862
48     2582.46232522
49     2597.44060671
50     2612.76550628
51     2628.44209932
52     2644.47559613

...

107     4304.83695692
108     4355.20354931
109      4406.5949512
110     4459.03343112
111     4512.54183229
112     4567.14358846
113     4622.86274024
114     4679.72395194
115     4737.75252895
116     4796.97443556
117     4857.41631345
118     4919.10550063
119     4982.07005104
120     5046.33875469
121     5111.94115851
122     5178.90758768
123     5247.26916784
124     5317.05784777
125     5388.30642293
126     5461.04855964
127     5535.31882005
128     5611.15268789
129     5688.58659498
130     5767.65794865
131     5848.40515993
132     5930.86767269
133     6015.08599364
134     6101.10172335
135     6188.95758816
136     6278.69747319
137      6370.3664563
138     6464.01084321
139     6559.67820369
140     6657.41740892
141     6757.27867006
142     6859.31357797
143     6963.57514436
144     7070.11784407
145     7178.99765887
146     7290.27212258
147     7404.00036769
148     7520.24317346
149      7639.0630156
150     7760.52411755
151     7884.69250343
152     8011.63605274
153     8141.42455679
154     8274.12977707
155     8409.82550541
156     8548.58762625
157     8690.49418085
158     8835.62543367
159     8984.06394095
160     9135.89462156
161     9291.20483012
162     9450.08443272
163     9612.62588496
164     9778.92431277
165     9949.07759581
166     10123.1864537
WARNING: Output truncated!  
full_output.txt



Number of months until bank account reaches $10000 is:
                       166
Account value at 166 months is:
       10123.1864537

Index         Amount
 0            2000.0
 1            2102.0
 2         2154.3122
 3     2181.89737464
 4     2197.23384123
 5      2206.5599686
 6     2212.99480856
 7     2218.09810025
 8     2222.65011702
 9     2227.04151223
10     2231.46820361
11     2236.02879626
12     2240.77328486
13     2245.72740015
14      2250.9047802
15     2256.31305519
16     2261.95688958
17     2267.83950338
18     2273.96343298
19     2280.33091206
20     2286.94406244
21     2293.80498999
22     2300.91583314
23     2308.27878765
24     2315.89611957
25     2323.77017234
26     2331.90337092
27     2340.29822455
28     2348.95732872
29     2357.88336695
30     2367.07911226
31     2376.54742881
32     2386.29127331
33     2396.31369668
34     2406.61784559
35     2417.20696412
36     2428.08439546
37     2439.25358368
38     2450.71807552
39     2462.48152228
40     2474.54768174
41     2486.92042015
42     2499.60371429
43     2512.60165361
44     2525.91844237
45     2539.55840196
46     2553.52597317
47     2567.82571862
48     2582.46232522
49     2597.44060671
50     2612.76550628
51     2628.44209932
52     2644.47559613

...

107     4304.83695692
108     4355.20354931
109      4406.5949512
110     4459.03343112
111     4512.54183229
112     4567.14358846
113     4622.86274024
114     4679.72395194
115     4737.75252895
116     4796.97443556
117     4857.41631345
118     4919.10550063
119     4982.07005104
120     5046.33875469
121     5111.94115851
122     5178.90758768
123     5247.26916784
124     5317.05784777
125     5388.30642293
126     5461.04855964
127     5535.31882005
128     5611.15268789
129     5688.58659498
130     5767.65794865
131     5848.40515993
132     5930.86767269
133     6015.08599364
134     6101.10172335
135     6188.95758816
136     6278.69747319
137      6370.3664563
138     6464.01084321
139     6559.67820369
140     6657.41740892
141     6757.27867006
142     6859.31357797
143     6963.57514436
144     7070.11784407
145     7178.99765887
146     7290.27212258
147     7404.00036769
148     7520.24317346
149      7639.0630156
150     7760.52411755
151     7884.69250343
152     8011.63605274
153     8141.42455679
154     8274.12977707
155     8409.82550541
156     8548.58762625
157     8690.49418085
158     8835.62543367
159     8984.06394095
160     9135.89462156
161     9291.20483012
162     9450.08443272
163     9612.62588496
164     9778.92431277
165     9949.07759581
166     10123.1864537
# Number 1 Part C # P is the Principal Amount # i = interest factor # j = compound interest factor # x is an index # k is also an index but used for plotting # a is used in the for loop to print out the table of values # D is used as the deposits per month based on the requirements for part C # R is used as a factor affecting D based on the requirements for part C P = 2000; i = 1.0010; j = 0; x = 1; k=1; a = 0; D = 100; R = 100; m = vector(RDF,800) m[0] = P; while P<=10000: P = (P*(i)) + D; j=.0001; i = i+j; R = R/2; D=D+R; m[x] = P; Q = [x,m[x]]; if P>=9999: if P<=10200: print "Number of months until bank account reaches $10000 is:"; print "%26s"%(x); v = x; # v is used to store the value where the bank account reaches 10,000 print "Account value at 38 months is:"; print "%20s"%(m[x]); x=x+1; Q = [[k, m[k]] for k in range(v+1)] pplot= scatter_plot(Q); pplot.show() print "Index Amount" for a in range (0,v+1): print "%2s "%(a),; print "%16s"%(m[a]) 
       
Number of months until bank account reaches $10000 is:
                        38
Account value at 38 months is:
       10117.6126755

Index         Amount
 0            2000.0
 1            2102.0
 2         2254.3122
 3     2432.01737464
 4     2622.67899723
 5     2820.10074782
 6     3021.20589894
 7     3224.47732838
 8     3429.17768984
 9     3634.95958468
10     3841.67069539
11     4049.25638053
12     4257.71099081
13     4467.05354093
14     4677.31555704
15     4888.53501086
16     5100.75329663
17     5314.01372932
18     5528.36080345
19     5743.83983223
20     5960.49677701
21     6178.37817197
22     6397.53109662
23     6618.00317229
24     6839.84257084
25     7063.09802962
26     7287.81886974
27     7514.05501618
28       7741.857019
29      7971.2760753
30      8202.3640518
31     8435.17350792
32     8669.75771925
33     8906.17070165
34     9144.46723566
35     9384.70289149
36      9626.9340545
37     9871.21795115
38     10117.6126755
Number of months until bank account reaches $10000 is:
                        38
Account value at 38 months is:
       10117.6126755

Index         Amount
 0            2000.0
 1            2102.0
 2         2254.3122
 3     2432.01737464
 4     2622.67899723
 5     2820.10074782
 6     3021.20589894
 7     3224.47732838
 8     3429.17768984
 9     3634.95958468
10     3841.67069539
11     4049.25638053
12     4257.71099081
13     4467.05354093
14     4677.31555704
15     4888.53501086
16     5100.75329663
17     5314.01372932
18     5528.36080345
19     5743.83983223
20     5960.49677701
21     6178.37817197
22     6397.53109662
23     6618.00317229
24     6839.84257084
25     7063.09802962
26     7287.81886974
27     7514.05501618
28       7741.857019
29      7971.2760753
30      8202.3640518
31     8435.17350792
32     8669.75771925
33     8906.17070165
34     9144.46723566
35     9384.70289149
36      9626.9340545
37     9871.21795115
38     10117.6126755
# Number 2 part 1 # P is defined to store all of the values of P n = 0; P = vector(RDF, 19); P[0] = 25.7; P[1] = 18.5; P[2] = 14.3; P[3] = 12.2; P[4] = 11.1; P[5] = 9.5; P[6] = 9.1; P[7] = 8.5; P[8] = 8.1; P[9] = 7.5; P[10] = 7.4; print "First Plot"; Q = [ [ P[n],P[n+1] ] for n in range(0,10) ] pplot= scatter_plot(Q); pplot.show() 
       
First Plot
First Plot
# Number 2 part 2 # r and k are estimates to make the second graph look like the first print "Plot with empirical values r and k"; r = (.68); k = 1; W = [ [ P[n],r*P[n]+k ] for n in range(0,10) ] pplot= scatter_plot(W); pplot.show() 
       
Plot with empirical values r and k
Plot with empirical values r and k
#This project was done by Alyssa Carmusciano, Rui Zhang, and Hassan Jalalluddin. It was a collaborative effort, as all three of us members worked together on each problem.