summaryrefslogtreecommitdiff
path: root/sample_notebooks/MukteshChaudhary/ch1.ipynb
blob: ec327a6f86caefc31efbf19ff68b94c5d0769597 (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
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
{
 "metadata": {
  "name": "",
  "signature": "sha256:d510303f7e7e2853fb2cf56867915796aa62fb3bbb679ce357903afade2bd69c"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1: Fundamentals"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.1, Page 3"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "I =.000018;    # Electric current, A\n",
      "V = 15000;    # Electric potential, V\n",
      "P = 250000000    # Electric Power, W\n",
      "\n",
      "#Calculations&Results\n",
      "# Display standard form \n",
      "print \"Standard form:\"\n",
      "print \"==============\"\n",
      "print \"%f A = %3.1e A\"%(I, I)\n",
      "print \"%5.0f V = %3.1e V\"%(V, V)\n",
      "print \"%9.0f W = %3.1e W\"%(P, P)\n",
      "# Display scientific notation \n",
      "print \"\\n\\nScientific form:\"\n",
      "print \"================\"\n",
      "print \"%f A = %2d micro-ampere\"%(I, I/1e-06)\n",
      "print \"%5.0f V = %2d kilo-volt\"%(V, V/1e+03)\n",
      "print \"%9.0f W = %3d mega-watt\"%(P, P/1e+06)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Standard form:\n",
        "==============\n",
        "0.000018 A = 1.8e-05 A\n",
        "15000 V = 1.5e+04 V\n",
        "250000000 W = 2.5e+08 W\n",
        "\n",
        "\n",
        "Scientific form:\n",
        "================\n",
        "0.000018 A = 18 micro-ampere\n",
        "15000 V = 15 kilo-volt\n",
        "250000000 W = 250 mega-watt\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.2, Page 3"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "I = 25e-05;    # Electric Current,A\n",
      "P = 3e-04;    # Electric Power, W\n",
      "W = 850000.;    # Work done, J\n",
      "V = 0.0016;    # Electric Potential, V\n",
      "\n",
      "#Calculations&Results\n",
      "print \"Scientific (Engineering) notation:\";\n",
      "print \"===================================\";\n",
      "print \"%2e A = %3d micro-ampere = %3.2f mA\"%(I, I/1e-06, I/1e-03);\n",
      "print \"%1.0e W = %.e milli-watt\"%(P, P/1e-03);\n",
      "print \"%6d J = %3d kJ = %3.2f MJ\"%(W, W/1e+03, W/1e+06);\n",
      "print \"%5.4f V = %3.1f milli-volt\"%(V, V/1e-03)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Scientific (Engineering) notation:\n",
        "===================================\n",
        "2.500000e-04 A = 250 micro-ampere = 0.25 mA\n",
        "3e-04 W = 3e-01 milli-watt\n",
        "850000 J = 850 kJ = 0.85 MJ\n",
        "0.0016 V = 1.6 milli-volt\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.3, Page 5"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "m = 750/1e+03;    # Mass of the body, kg\n",
      "F = 2;    # Force acting on the mass, N\n",
      "\n",
      "#Calculations\n",
      "# Since F = m * a, (Newton's Second Law of motion), solving for a\n",
      "a = F/m;    # Acceleration produced in the body, metre per second square\n",
      "\n",
      "# Result\n",
      "print \"The acceleration produced in the body = %5.3f metre per second square\"%a\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The acceleration produced in the body = 2.667 metre per second square\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.4, Page 9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Q = 35e-03;    # Electric charge, C\n",
      "t = 20e-03;    # Time for transference of charge between two points, s\n",
      "\n",
      "#Calculations\n",
      "# Since Q = I * t, solving for I\n",
      "I = Q/t;    # Electric current flowing between the two points, A\n",
      "\n",
      "# Result\n",
      "print \"The value of electric current flowing = %4.2f A\"%I\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of electric current flowing = 1.75 A\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.5, Page 9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "I = 120e-06;    # Electric current, A\n",
      "t = 15;    # Time for transference of charge between two points, s\n",
      "\n",
      "#Calculations\n",
      "# Since I = Q/t, solving for Q\n",
      "Q = I*t;    # Electric charge transferred, C\n",
      "\n",
      "# Result\n",
      "print \"The value of electric charge transferred = %3.1f mC\"%(Q/1e-03)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of electric charge transferred = 1.8 mC\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.6, Page 10"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Q = 80;     # Electric charge, C\n",
      "I = 0.5;     # Electric current, A\n",
      "\n",
      "#Calculations\n",
      "# Since Q = I*t, solving for t\n",
      "t = Q/I;     # Time for transference of charge between two points, s\n",
      "\n",
      "# Result\n",
      "print \"The duration of time for which the current flowed = %3d s\"%t\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The duration of time for which the current flowed = 160 s\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.7, Page 13"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "I = 5.5e-03;        # Electric current, A\n",
      "R = 33000;          # Resistance, ohms\n",
      "\n",
      "#Calculations\n",
      "# From Ohm's law, V = I*R\n",
      "V = I*R;            # Potential difference across resistor, V\n",
      "\n",
      "# Result\n",
      "print \"The potential difference developed across resistor = %5.1f V\"%V\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The potential difference developed across resistor = 181.5 V\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.8, Page 14"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "V = 24.;            # Potential difference,V\n",
      "R = 15;             # Resistance, ohms\n",
      "\n",
      "#Calculations\n",
      "# From Ohm's law, V = I*R, then solving for I\n",
      "I = V/R;             # Electric current, A\n",
      "\n",
      "# Result\n",
      "print \"The current flowing through the resistor = %3.1f A\"%I\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The current flowing through the resistor = 1.6 A\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.9, Page 16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "E = 6;           # E.m.f of battery, V\n",
      "r = 0.15;        # Internal resistance of battery, ohm\n",
      "I_1 = .5;        # Electric current, A\n",
      "I_2 = 2;          # Electric current, A\n",
      "I_3 = 10;          # Electric current, A\n",
      "\n",
      "#Calculations\n",
      "# Using relation V = E - I*R and substituting the values of I_1, I_2 and I_3 one by one in it\n",
      "V_1 = E - I_1*r;     # Terminal potential difference, V\n",
      "V_2 = E - I_2*r;      # Terminal potential difference, V\n",
      "V_3 = E - I_3*r;       # Terminal potential difference, V\n",
      "\n",
      "# Results\n",
      "print \"The terminal potential difference developed across resistor for a current of %3.1f A = %5.3f V\"%(I_1,V_1)\n",
      "print \"The terminal potential difference developed across resistor for a current of %1d A = %3.1f V\"%(I_2,V_2)\n",
      "print \"The terminal potential difference developed across resistor for a current of %2d A = %3.1f V\"%(I_3,V_3)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The terminal potential difference developed across resistor for a current of 0.5 A = 5.925 V\n",
        "The terminal potential difference developed across resistor for a current of 2 A = 5.7 V\n",
        "The terminal potential difference developed across resistor for a current of 10 A = 4.5 V\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.10, Page 16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "E = 12;        # E.m.f, V\n",
      "I = 5;         # Electric current, A\n",
      "V = 11.5;       # Terminal potential difference, V\n",
      "\n",
      "#Calculations\n",
      "# Using relation V = E - I*r, solving for r\n",
      "r = ( E - V )/I;     # Internal resistance of battery, ohm\n",
      "# From Ohm's law, V = I*R, then solving for R\n",
      "R = V/I;              # Resistance, ohms\n",
      "\n",
      "# Results\n",
      "print \"The internal resistance of battery = %3.1f ohm\"%r\n",
      "print \"The resistance of external circuit = %3.1f ohm\"%R\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The internal resistance of battery = 0.1 ohm\n",
        "The resistance of external circuit = 2.3 ohm\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.11, Page 17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "I = 200e-03;       # Electric current, A\n",
      "t = 300;            # Time for which current flows, s\n",
      "R = 750;            # Resistance, ohms\n",
      "\n",
      "#Calculations\n",
      "# Using Ohm's law, V = I*R\n",
      "V = I*R;            # Electric potential difference, V\n",
      "W = I**2*R*t;         # Energy dissipated, joule\n",
      "\n",
      "# Result\n",
      "print \"The potential difference developed across the resistor = %3d V\\nThe energy dissipated across the resistor = %4.0f J or %1d kJ\"%(V, W, W*1e-03)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The potential difference developed across the resistor = 150 V\n",
        "The energy dissipated across the resistor = 9000 J or 9 kJ\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.12, Page 18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "R = 680;          # Resistance, ohms\n",
      "P = 85e-03;           # Electric power, W\n",
      "\n",
      "#Calculations\n",
      "# Using P = V**2/R, solving for V\n",
      "V = math.sqrt( P*R );       # Potential difference, V\n",
      "# Using P = I**2*R, solving for I\n",
      "I = math.sqrt( P/R );        # Electric current, A\n",
      "\n",
      "# Result\n",
      "print \"The potential difference developed across the resistance = %3.1f V\\nThe current flowing through the resistor = %5.2f mA\"%(V, I/1e-03)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The potential difference developed across the resistance = 7.6 V\n",
        "The current flowing through the resistor = 11.18 mA\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.13, Page 19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "I = 1.4;           # Electric current, A\n",
      "t = 900;           # Time for which current flows, s\n",
      "W = 200000;        # Energy dissipated, J\n",
      "\n",
      "#Calculations\n",
      "# Using relation W = V*I*t, solving for V\n",
      "V = W/( I*t );       # Potential difference, V\n",
      "# Using relation P = V*I\n",
      "P = V*I;             # Electric power, W\n",
      "# From Ohm's law, V = I*R, solving for R\n",
      "R = V/I;              # Resistance, ohm\n",
      "\n",
      "# Result\n",
      "print \"The potential difference developed = %5.1f V\\nThe power dissipated = %5.1f W\\nThe resistance of the circuit = %5.1f ohm\"%(V, P, R)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The potential difference developed = 158.7 V\n",
        "The power dissipated = 222.2 W\n",
        "The resistance of the circuit = 113.4 ohm\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.14, Page 20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "P = 12.5;    # Power of the machine, kW\n",
      "t = 8.5;    # Time for which the machine is operated, h\n",
      "\n",
      "#Calculations\n",
      "W = P*t;         # Electric energy, kWh\n",
      "# Cost per unit = 7.902 p, therefore calculating the cost of 106.25 units\n",
      "cost = ( W*7.902 );       # Cost for operating machine, p\n",
      "\n",
      "# Result\n",
      "print \"The cost of operating the machine = %4.2f pounds\"%(cost*1e-02)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The cost of operating the machine = 8.40 pounds\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.15, Page 20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "Total_bill = 78.75;      # pounds\n",
      "Standing_charge = 15.00;     # pounds\n",
      "Units_used = 750;            # kWh\n",
      "\n",
      "#Calculations\n",
      "Cost_per_unit = ( Total_bill - Standing_charge )/Units_used;      # p\n",
      "Cost_of_energy_used = 67.50;         # pounds\n",
      "Total_bill = Cost_of_energy_used + Standing_charge;      # pounds\n",
      "\n",
      "# Result\n",
      "print \"The cost per unit = %5.3f pounds or %3.1f p\\nTotal bill = %5.2f pounds\"%(Cost_per_unit,Cost_per_unit/1e-02,Total_bill)\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The cost per unit = 0.085 pounds or 8.5 p\n",
        "Total bill = 82.50 pounds\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.16, Page 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "l = 200;          # Length of Cu wire, metre\n",
      "rho = 2e-08;       # Resistivity of Cu, ohm-metre\n",
      "A = 8e-07;          # Cross sectional area of Cu wire, metre square\n",
      "\n",
      "#Calculations\n",
      "# Using relation R = ( rho*l )/A\n",
      "R = ( rho*l )/A;          # Resistance, ohm\n",
      "\n",
      "# Result\n",
      "print \"The resistance of the coil = %1d ohm\"%R\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resistance of the coil = 5 ohm\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.17, Page 22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "l = 250;          # Length of Cu wire, metre\n",
      "d = 5e-04;         # Diameter of Cu wire, metre\n",
      "rho = 1.8e-08;       # Resistivity of Cu wire, ohm-metre\n",
      "\n",
      "#Calculations\n",
      "A = (math.pi*d**2 )/4;          # Cross sectional area of Cu wire, metre square\n",
      "# Using relation R = rho*l/A\n",
      "R = rho*l/A;          # Resistance, ohm\n",
      "\n",
      "# Result\n",
      "print \"The resistance of the coil = %5.2f ohm\"%R\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resistance of the coil = 22.92 ohm\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.18, Page 23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "R_1 = 250;           # Resistance of field coil, ohm\n",
      "Theta_1 = 15;        # Initial temperature of motor, degree celcius \n",
      "Theta_2 = 45;        # Final temperature of motor, degree celcius\n",
      "Alpha = 4.28e-03;     # Temperature coefficient of resistance, per degree celcius\n",
      "\n",
      "#Calculations\n",
      "# Using relation, R_1/R_2 = ( 1 + Alpha*Theta_1 )/( 1 + Alpha*Theta_2 ), solving for R_2\n",
      "R_2 = R_1 * (( 1 + Alpha*Theta_2 )/( 1 + Alpha*Theta_1 ));      # Resistance, ohms\n",
      "\n",
      "# Result\n",
      "print \"The resistance of field coil at %2d degree celcius = %5.1f ohm\"%(Theta_2, R_2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resistance of field coil at 45 degree celcius = 280.2 ohm\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.19, Page 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "R_0 = 350;           # Resistance, ohms\n",
      "Theta_1 = 60;        # Temperature, degree celcius \n",
      "Alpha = 4.26e-03;     # Temperature coefficient, per degree celcius\n",
      "\n",
      "#Calculations\n",
      "# Using relation R_1 = R_0 * ( 1 + Alpha*Theta_1 )\n",
      "R_1 = R_0 * ( 1 + Alpha*Theta_1 );      # Resistance, ohms\n",
      "\n",
      "# Result\n",
      "print \"The resistance of the wire at %2d degree celcius = %5.1f ohm\"%(Theta_1, R_1)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resistance of the wire at 60 degree celcius = 439.5 ohm\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1.20, Page 24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "R_1 = 120;           # Resistance, ohms\n",
      "Theta_1 = 16;        # Temperature, degree celcius \n",
      "Theta_2 = 32;        # Temperature, degree celcius\n",
      "Alpha = -4.8e-04;     # Temperature coefficient, per degree celcius\n",
      "\n",
      "#Calculations\n",
      "# Using relation, R_1/R_2 = ( 1 + Alpha*Theta_1 )/( 1 + Alpha*Theta_2 ), solving for R_2\n",
      "R_2 = R_1 * (( 1 + Alpha*Theta_2 )/( 1 + Alpha*Theta_1 ));      # Resistance, ohm\n",
      "\n",
      "# Result\n",
      "print \"The resistance of carbon resistor at %2d degree celcius = %5.1f ohm\"%(Theta_2, R_2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The resistance of carbon resistor at 32 degree celcius = 119.1 ohm\n"
       ]
      }
     ],
     "prompt_number": 20
    }
   ],
   "metadata": {}
  }
 ]
}