summaryrefslogtreecommitdiff
path: root/Engineering_Economics/Chapter8.ipynb
blob: de307e62a00000c1ba5b99c519f6776a1067c8a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
{
 "metadata": {
  "name": "",
  "signature": "sha256:44663c03d7c23760034bea6db3765d8b79a48144d6b54769443d3f295fd0b9f3"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Replacement and Maintenance Analysis"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.1 Page 103"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initiation of variable\n",
      "FC=4000.0;#in Rs.\n",
      "i=0.0;#in % per annum\n",
      "MC1=0;#in Rs.\n",
      "print \"Tabulation to determine economic life : \";\n",
      "print\"End of     Maintenance     Summation of     Avg cost of     Avg FC if     Avg total\";\n",
      "print\" year      cost at end     maintenance      maintenance    replaced at    cost through\";\n",
      "print\"             of year         costs          through year    year given    year given\";\n",
      "print\"  A           B(Rs.)        C(Rs.)             D(Rs.)        E(Rs.)        F(Rs.)\";\n",
      "print\"  1            0                0                 0          4000          4000\";\n",
      "print\"  2          200              200               100          2000          2100\";\n",
      "print\"  3          400              600               200       1333.33       1533.33\";\n",
      "print\"  4          600             1200               300          1000          1300\";\n",
      "print\"  5          800             2000               400           800          1200\";\n",
      "print\"  6         1000             3000               500        666.67       1166.67\";\n",
      "print\"  7         1200             4200               600        571.43       1171.43\";\n",
      "print\"Economic life of the machine : 6 years\";\n",
      "print\"Column C summarizes the summation of maintenance costs for each replacement period. The value corresponding to any end of year in this column represents the total maintenance costs of using the equipment till the end of that year. It gives the Economic life of the machine : 6 years\";\n",
      "\n",
      "#When i=12%\n",
      "i=12.0;#in % per annum\n",
      "FC=4000.0;#in Rs.\n",
      "print\"Tabulation to determine economic life : \";\n",
      "print\"End of     Maintenance         P/F       PW as of begin   Summation of    PW of        A/P     Annual equi\";\n",
      "print\" year      cost at end        12%         of year of         PW of      cumulative     12%     total cost\";\n",
      "print\"             of year           n          maintenance     maintenance   maintenance     n       of year\";\n",
      "print\"  A           B(Rs.)        C(Rs.)             D(Rs.)        E(Rs.)        F(Rs.)    G(rs.)      H(rs.)\";\n",
      "print\"  1            0           0.8929              0.00          0.00       4000.00     1.1200     4480.00\";\n",
      "print\"  2          200           0.7972            159.44        159.44       4159.44     0.5917     2461.14\";\n",
      "print\"  3          400           0.7118            284.72        444.16       4444.16     0.4163     1850.10\";\n",
      "print\"  4          600           0.6355            381.30        825.46       4825.46     0.3292     1588.54\";\n",
      "print\"  5          800           0.5674            453.92       1279.38       5279.38     0.2774     1464.50\";\n",
      "print\"  6         1000           0.5066            506.60       1785.98       5785.98     0.2432     1407.15\";\n",
      "print\"  7         1200           0.4524            542.88       2328.86       6328.86     0.2191     1386.65\";\n",
      "print\"  8         1400           0.4039            565.46       2894.32       6894.32     0.2013     1387.83\";\n",
      "print\"  9         1600           0.3606            576.96       3471.28       7471.28     0.1877     1402.36\";\n",
      "print\" 10         1800           0.3220            579.60       4050.88       8050.88     0.1770     1425.00\";\n",
      "print\"Economic life of the machine : 7 years\";\n",
      "print\"For this problem, the annual equivalent total cost is minimum at the end of year 7. Therefore, the economic life of the equipment is 7 year.\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Tabulation to determine economic life : \n",
        "End of     Maintenance     Summation of     Avg cost of     Avg FC if     Avg total\n",
        " year      cost at end     maintenance      maintenance    replaced at    cost through\n",
        "             of year         costs          through year    year given    year given\n",
        "  A           B(Rs.)        C(Rs.)             D(Rs.)        E(Rs.)        F(Rs.)\n",
        "  1            0                0                 0          4000          4000\n",
        "  2          200              200               100          2000          2100\n",
        "  3          400              600               200       1333.33       1533.33\n",
        "  4          600             1200               300          1000          1300\n",
        "  5          800             2000               400           800          1200\n",
        "  6         1000             3000               500        666.67       1166.67\n",
        "  7         1200             4200               600        571.43       1171.43\n",
        "Economic life of the machine : 6 years\n",
        "Column C summarizes the summation of maintenance costs for each replacement period. The value corresponding to any end of year in this column represents the total maintenance costs of using the equipment till the end of that year. It gives the Economic life of the machine : 6 years\n",
        "Tabulation to determine economic life : \n",
        "End of     Maintenance         P/F       PW as of begin   Summation of    PW of        A/P     Annual equi\n",
        " year      cost at end        12%         of year of         PW of      cumulative     12%     total cost\n",
        "             of year           n          maintenance     maintenance   maintenance     n       of year\n",
        "  A           B(Rs.)        C(Rs.)             D(Rs.)        E(Rs.)        F(Rs.)    G(rs.)      H(rs.)\n",
        "  1            0           0.8929              0.00          0.00       4000.00     1.1200     4480.00\n",
        "  2          200           0.7972            159.44        159.44       4159.44     0.5917     2461.14\n",
        "  3          400           0.7118            284.72        444.16       4444.16     0.4163     1850.10\n",
        "  4          600           0.6355            381.30        825.46       4825.46     0.3292     1588.54\n",
        "  5          800           0.5674            453.92       1279.38       5279.38     0.2774     1464.50\n",
        "  6         1000           0.5066            506.60       1785.98       5785.98     0.2432     1407.15\n",
        "  7         1200           0.4524            542.88       2328.86       6328.86     0.2191     1386.65\n",
        "  8         1400           0.4039            565.46       2894.32       6894.32     0.2013     1387.83\n",
        "  9         1600           0.3606            576.96       3471.28       7471.28     0.1877     1402.36\n",
        " 10         1800           0.3220            579.60       4050.88       8050.88     0.1770     1425.00\n",
        "Economic life of the machine : 7 years\n",
        "For this problem, the annual equivalent total cost is minimum at the end of year 7. Therefore, the economic life of the equipment is 7 year.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.2 Page 105"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initiation of variable\n",
      "FC=20000.0;#in Rs.\n",
      "i=15.0;#in % per annum\n",
      "\n",
      "#result\n",
      "print \"The other details are summarized in Table 8.3. It can be seen from the book.\";\n",
      "print \"Total annual equivalent cost = [cumulative sum of PW as of beginning of year 1 of operation & maintenance cost + FC - PW as of beginning of year 1 of salvage]*(A/P,15,n)\";\n",
      "print \"In column L, the annual equivalent cost is minimum for n=5. Therefore, the economic life of the machine is 5 years. \";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The other details are summarized in Table 8.3. It can be seen from the book.\n",
        "Total annual equivalent cost = [cumulative sum of PW as of beginning of year 1 of operation & maintenance cost + FC - PW as of beginning of year 1 of salvage]*(A/P,15,n)\n",
        "In column L, the annual equivalent cost is minimum for n=5. Therefore, the economic life of the machine is 5 years. \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.3 Page 107"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initiation of variable\n",
      "FC=20000.0;#in Rs.\n",
      "i=15.0;#in % per annum\n",
      "\n",
      "#result\n",
      "print \"The details are summarized in Table 8.4. It can be seen from the book.\";\n",
      "print\"Total annual equivalent cost = [summation of PW of maintenance cost + FC]]*(A/P,15,n)\";\n",
      "print\"(column E + Rs. 6000)* Column G\";\n",
      "print \"Column F * Column G\";\n",
      "print \"In column H, the minimum annual equivalent cost occurs when n=8. Therefore, the economic life of the machine B is 8 years. \";\n",
      "print \"RESULT : Min annual equivalent cost for machine A : Rs. 2780\";\n",
      "print \"Min annual equivalent cost for machine B : Rs. 3672.30\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The details are summarized in Table 8.4. It can be seen from the book.\n",
        "Total annual equivalent cost = [summation of PW of maintenance cost + FC]]*(A/P,15,n)\n",
        "(column E + Rs. 6000)* Column G\n",
        "Column F * Column G\n",
        "In column H, the minimum annual equivalent cost occurs when n=8. Therefore, the economic life of the machine B is 8 years. \n",
        "RESULT : Min annual equivalent cost for machine A : Rs. 2780\n",
        "Min annual equivalent cost for machine B : Rs. 3672.30\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.4 Page 109"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initiation of variable\n",
      "#alternative 1\n",
      "Pprice=200000.0;#in Rs\n",
      "P=120000.0;#in Rs\n",
      "F=25000.0;#in Rs\n",
      "A=25000.0;#in Rs\n",
      "i=12.0;#in % per annum\n",
      "n=6.0;#in years\n",
      "\n",
      "#calculation\n",
      "AE1=(P-F)*((i/100)*(1+i/100)**n)/(((1+i/100)**n)-1)+F*i/100+A;#in RS\n",
      "\n",
      "#result\n",
      "print \"The annual equivalent cost(AE(12%)) of this alternative in RS.  \",round(AE1,3);\n",
      "\n",
      "#Alternative 2\n",
      "P=150000.0;#in Rs\n",
      "F=20000.0;#in Rs\n",
      "A=14000.0;#in Rs\n",
      "i=12.0;#in % per annum\n",
      "n=6.0;#in years\n",
      "\n",
      "#calcualion\n",
      "AE2=(P-F)*((i/100)*(1+i/100)**n)/(((1+i/100)**n)-1)+F*i/100+A;#in RS\n",
      "\n",
      "#result\n",
      "print \"The annual equivalent cost(AE(12%)) of this alternative in RS.  \",round(AE2,3);\n",
      "print \"Since, The equivalent cost of new machine is less than that of present machine, it is suggested that the present machine be replaced with the new machine.\";\n",
      "print \"answer is bit different due to approximation error\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The annual equivalent cost(AE(12%)) of this alternative in RS.   51106.443\n",
        "The annual equivalent cost(AE(12%)) of this alternative in RS.   48019.343\n",
        "Since, The equivalent cost of new machine is less than that of present machine, it is suggested that the present machine be replaced with the new machine.\n",
        "answer is bit different due to approximation error\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.5 Page 111"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initation of variable\n",
      "#alternative 1\n",
      "Pprice=50000.0;#in Rs\n",
      "P=15000.0;#in Rs\n",
      "F=8000.0;#in Rs\n",
      "A=14000.0;#in Rs\n",
      "i=15.0;#in % per annum\n",
      "n=5.0;#in years\n",
      "\n",
      "#calcualtion\n",
      "AE1=(P-F)*((i/100)*(1+i/100)**n)/(((1+i/100)**n)-1)+F*i/100+A;#in RS\n",
      "\n",
      "#result\n",
      "print \"The annual equivalent cost(AE(15%)) of this alternative in RS.  \",round(AE1,3);\n",
      "\n",
      "#Alternative 2\n",
      "P=65000.0;#in Rs\n",
      "F=13000.0;#in Rs\n",
      "A=9000.0;#in Rs\n",
      "i=15.0;#in % per annum\n",
      "n=20.0;#in years\n",
      "\n",
      "#calculation\n",
      "AE2=(P-F)*((i/100)*(1+i/100)**n)/(((1+i/100)**n)-1)+F*i/100+A;#in RS\n",
      "\n",
      "#result\n",
      "print \"The annual equivalent cost(AE(15%)) of this alternative in RS. : \",round(AE2,3);\n",
      "print \"Since, The equivalent cost of Old deisel Engine is less than that of New deisel Engine, it is suggested to keep the Old deisel Engine.\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The annual equivalent cost(AE(15%)) of this alternative in RS.   17288.209\n",
        "The annual equivalent cost(AE(15%)) of this alternative in RS. :  19257.596\n",
        "Since, The equivalent cost of Old deisel Engine is less than that of New deisel Engine, it is suggested to keep the Old deisel Engine.\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.6 Page 113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#intiation of variable\n",
      "P=660000.0;#in Rs\n",
      "F=400000.0;#in Rs\n",
      "A=96000.0;#in Rs\n",
      "i=10.0;#in % per annum\n",
      "n=5.0;#in years\n",
      "\n",
      "#caculation\n",
      "AE1=(P-F)*((i/100)*(1+i/100)**n)/(((1+i/100)**n)-1)+F*i/100+A;#in RS\n",
      "\n",
      "#result\n",
      "print \"The annual equivalent cost(AE(10%)) of this alternative in RS. : \",round(AE1,3);\n",
      "\n",
      "#Alternative 2\n",
      "P=150000.0;#in Rs\n",
      "X=420000.0;#in Rs\n",
      "i=10.0;#in % per annum\n",
      "n=40.0;#in years\n",
      "\n",
      "#calcualtion\n",
      "AE2=(P-X)*((i/100)*(1+i/100)**n)/(((1+i/100)**n)-1)+F*i/100+A;#in RS\n",
      "\n",
      "#result\n",
      "print \"The annual equivalent cost(AE(10%)) of this alternative in RS. : \",round(AE2,3);\n",
      "print \"Since, The equivalent cost of alternative 2 is less than that of alternative 1, it is suggested that alternative 2 should be selected.\";\n",
      "print \" calculations in the book is not accurate.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The annual equivalent cost(AE(10%)) of this alternative in RS. :  204587.345\n",
        "The annual equivalent cost(AE(10%)) of this alternative in RS. :  108389.958\n",
        "Since, The equivalent cost of alternative 2 is less than that of alternative 1, it is suggested that alternative 2 should be selected.\n",
        " calculations in the book is not accurate.\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.7 Page 113"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initiation of variable\n",
      "#alternative 1\n",
      "P=10000.0;#in Rs\n",
      "F=1500.0;#in Rs\n",
      "A=1600.0;#in Rs\n",
      "i=15.0;#in % per annum\n",
      "n=7.0;#in years\n",
      "\n",
      "#calcualtion\n",
      "AE1=(P-F)*((i/100)*(1+i/100)**n)/(((1+i/100)**n)-1)+F*i/100+A;#in RS\n",
      "\n",
      "#result\n",
      "print \"The annual equivalent cost(AE(10%)) of 10 hp motor  in RS. : \",round(AE1,3);\n",
      "\n",
      "#alternative 1 part 2\n",
      "P=10000;#in Rs\n",
      "F=800.0;#in Rs\n",
      "A=1000.0;#in Rs\n",
      "i=15.0;#in % per annum\n",
      "n=7.0;#in years\n",
      "\n",
      "#calcualtion\n",
      "AE2=(P-F)*((i/100)*(1+i/100)**n)/(((1+i/100)**n)-1)+F*i/100+A;#in RS\n",
      "\n",
      "#result\n",
      "print \"The annual equivalent cost(AE(10%)) of 10 hp motor  in RS.  \",round(AE2,3);\n",
      "print \"Total annual equivalent cost of alternative in Rs. : \",round(AE1+AE2,3);\n",
      "\n",
      "\n",
      "#Alternative 2\n",
      "P=35000.0;#in Rs\n",
      "F=4000.0;#in Rs\n",
      "A=500.0;#in Rs\n",
      "i=15.0;#in % per annum\n",
      "n=7.0;#in years\n",
      "\n",
      "#calcualtion\n",
      "AE=(P-F)*((i/100)*(1+i/100)**n)/(((1+i/100)**n)-1)+F*i/100+A;#in RS\n",
      "\n",
      "print \"The annual equivalent cost of alternative 2 in RS.\",round(AE,3);\n",
      "print\"Since, The equivalent cost of alternative 1 is less than that of alternative 2, it is suggested that the present 10 hp motor be augmented with an additional 5 hp motor.\";\n",
      "print \" calculations in the book is not accurate\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The annual equivalent cost(AE(10%)) of 10 hp motor  in RS. :  3868.063\n",
        "The annual equivalent cost(AE(10%)) of 10 hp motor  in RS.   3331.315\n",
        "Total annual equivalent cost of alternative in Rs. :  7199.378\n",
        "The annual equivalent cost of alternative 2 in RS. 8551.171\n",
        "Since, The equivalent cost of alternative 1 is less than that of alternative 2, it is suggested that the present 10 hp motor be augmented with an additional 5 hp motor.\n",
        " calculations in the book is not accurate\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.8 Page 115"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initiation of variable\n",
      "P=10000.0;#in Rs\n",
      "F=4000.0;#in Rs\n",
      "A=500.0;#in Rs\n",
      "i=12.0;#in % per annum\n",
      "n=4.0;#in years\n",
      "\n",
      "#calcualtion\n",
      "AE=(P-F)*((i/100)*(1+i/100)**n)/(((1+i/100)**n)-1)+F*i/100+A;#in RS\n",
      "X= (AE-1000*i/100-750)/0.3292+1000;\n",
      "#result\n",
      "print \"The annual equivalent cost(AE(15%)) of n in RSew machine : \",round(AE,3);\n",
      "print \"The comparative use value of old machine is Rs.\", round(X,3), \"which is less than the price(Rs. 8000) offered by the company which is supplying the new machine in the event of replacing the old machine by nw machine. \";\n",
      "print\"Therefore, it is advisable to replace the old machine with the new one.\";"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The annual equivalent cost(AE(15%)) of n in RSew machine :  2955.407\n",
        "The comparative use value of old machine is Rs. 7334.771 which is less than the price(Rs. 8000) offered by the company which is supplying the new machine in the event of replacing the old machine by nw machine. \n",
        "Therefore, it is advisable to replace the old machine with the new one.\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.9 Page 117"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Intiation of Variable\n",
      "p1=0.07;#unitless\n",
      "p2=0.11;#unitless\n",
      "p3=0.12;#unitless\n",
      "p4=0.18;#unitless\n",
      "p5=0.21;#unitless\n",
      "p6=0.20;#unitless\n",
      "p7=0.11;#unitless\n",
      "N0=100.0;#no. of transistors\n",
      "\n",
      "#calcualtion\n",
      "N1=N0*p1;#no. of transistors\n",
      "N2=N0*p2;#no. of transistors\n",
      "N3=N0*p3;#no. of transistors\n",
      "N4=N0*p4;#no. of transistors\n",
      "N5=N0*p5;#no. of transistors\n",
      "N6=N0*p6;#no. of transistors\n",
      "N7=N0*p7;#no. of transistors\n",
      "Life=0;#in weeks\n",
      "p=[p1, p2, p3, p4, p5, p6, p7];#Unitless\n",
      "for i in range (7): \n",
      "    Life=Life+(i+1)*p[i];\n",
      "\n",
      "#result\n",
      "print \"Expected life of each transistor in weeks : \",round(Life,3)\n",
      "print \"Average No. of failures/week :  \",round(100/Life);\n",
      "\n",
      "#result of group replacement cost \n",
      "print \"Cost of transistor when replaced simultaneously = Rs. 3\";\n",
      "print \"Cost of transistor when replaced individually = Rs. 9\";\n",
      "print \"The cost of group replacement policy for seeral replacement periods are summarized in Table 8.6. This table can be seen from the book.\";\n",
      "print \"From table it is clear that the avg cost/week is minimum for the 4th week. Hence, the group replacement period is 4 weeks.\";\n",
      "print \"Individual replacement cost/week = Rs. 207\";\n",
      "print \"Minimum group replacement ost/week = Rs. 196.50\";\n",
      "print \"Since the min group replacement cost/week is less than the individual replacement cost/week, the group replacement policy is the best, and hence all the transistors should be replaced in 4 weeks.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Expected life of each transistor in weeks :  4.39\n",
        "Average No. of failures/week :   23.0\n",
        "Cost of transistor when replaced simultaneously = Rs. 3\n",
        "Cost of transistor when replaced individually = Rs. 9\n",
        "The cost of group replacement policy for seeral replacement periods are summarized in Table 8.6. This table can be seen from the book.\n",
        "From table it is clear that the avg cost/week is minimum for the 4th week. Hence, the group replacement period is 4 weeks.\n",
        "Individual replacement cost/week = Rs. 207\n",
        "Minimum group replacement ost/week = Rs. 196.50\n",
        "Since the min group replacement cost/week is less than the individual replacement cost/week, the group replacement policy is the best, and hence all the transistors should be replaced in 4 weeks.\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8.10 Page 119"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initiation of variable\n",
      "p1=(100.0-96)/100;#unitless\n",
      "p2=(96.0-89)/100;#unitless\n",
      "p3=(89.0-68)/100;#unitless\n",
      "p4=(68.0-37)/100;#unitless\n",
      "p5=(37.0-13)/100;#unitless\n",
      "p6=(13.0-0)/100;#unitless\n",
      "N0=1000.0;#no. of resistors\n",
      "\n",
      "#calculation\n",
      "N1=N0*p1;#no. of resistors\n",
      "N2=N0*p2+N1*p1;#no. of resistors\n",
      "N3=N0*p3+N1*p2+N2*p1;#no. of resistors\n",
      "N4=N0*p4+N1*p3+N2*p2+N3*p1;#no. of resistors\n",
      "N5=N0*p5+N1*p4+N2*p3+N3*p2+N4*p1;#no. of resistors\n",
      "N6=N0*p6+N1*p5+N2*p4+N3*p3+N4*p2+N5*p1    ;#no. of resistors\n",
      "\n",
      "Life=0;#in months\n",
      "p=[p1, p2, p3, p4, p5, p6];#Unitless\n",
      "for i in range (6): \n",
      "    Life=Life+(i+1)*p[i];\n",
      "\n",
      "#result\n",
      "print \"Expected life of each transistor in weeks : \",round(Life,3)\n",
      "print \"Average No. of failures/week :  \",round(1000/Life);\n",
      "\n",
      "#result of group replacement cost\n",
      "print \"Cost/transistor when replaced simultaneously = Rs. 4\";\n",
      "print \"Cost/transistor when replaced individually = Rs. 10\";\n",
      "print \"The cost of group replacement policy for several replacement periods are summarized in Table 8.7. This table can be seen from the book.\";\n",
      "print \"From table it is clear that the avg cost/month is minimum for the 3rd month. Hence, the group replacement period is 3 months.\";\n",
      "print \"Individual replacement cost/month = Rs. 2480\";\n",
      "print \"Minimum group replacement ost/month = Rs. 2426.67\";\n",
      "print \"Since the min group replacement cost/month is less than the individual replacement cost/month, the group replacement policy is the best, and hence all the transistors should be replaced in 3 months.\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Expected life of each transistor in weeks :  4.03\n",
        "Average No. of failures/week :   248.0\n",
        "Cost/transistor when replaced simultaneously = Rs. 4\n",
        "Cost/transistor when replaced individually = Rs. 10\n",
        "The cost of group replacement policy for several replacement periods are summarized in Table 8.7. This table can be seen from the book.\n",
        "From table it is clear that the avg cost/month is minimum for the 3rd month. Hence, the group replacement period is 3 months.\n",
        "Individual replacement cost/month = Rs. 2480\n",
        "Minimum group replacement ost/month = Rs. 2426.67\n",
        "Since the min group replacement cost/month is less than the individual replacement cost/month, the group replacement policy is the best, and hence all the transistors should be replaced in 3 months.\n"
       ]
      }
     ],
     "prompt_number": 10
    }
   ],
   "metadata": {}
  }
 ]
}