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
|
{
"metadata": {
"name": "",
"signature": "sha256:e72fe3ba0215215547973defaa93d1e04f3f859c30d61d6e8cd806a66ccb1f3d"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 2: D.C. Circuits"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.1, Page 32"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"E = 24.; # E.m.f of battery,V\n",
"R1 = 330; # Resistance, ohms\n",
"R2 = 1500; # Resistance, ohms\n",
"R3 = 470; # Resistance, ohms\n",
"\n",
"#Calculations\n",
"# As resistances R1, R2 & R3 are joined end-to-end hence, they are in series & in series connection, circuit resistance is the sum of individual resistances present in the circuit\n",
"R = R1 + R2 + R3; # Resistance of circuit, ohms\n",
"I = E/R; # Circuit current, A\n",
"# As the resistances are in series so same current flows through each resistor & potential drop across each resistor is equal to the product of circuit current & its respective resistance( from Ohm's law, V = I*R )\n",
"V1 = I*R1; # Potential difference developed across resistance R1, V\n",
"V2 = I*R2; # Potential difference developed across resistance R2, V\n",
"V3 = I*R3; # Potential difference developed across resistance R3, V\n",
"P = E*I; # Electric power dissipated by the complete circuit, W\n",
"\n",
"# Results\n",
"print \"The circuit resistance = %4d ohms or %3.1f kilo-ohms\"%(R, R*1e-03);\n",
"print \"The circuit current = %5.2f milli-ampere\"%(I/1e-03);\n",
"print \"The potential drop across resisatnce R1 = %4.2f volts\\nThe potential drop across resistance R2 = %5.2f volts\\nThe potential drop across resistance R3 = %4.2f volts\"%(V1, V2, V3);\n",
"print \"The power dissipated by the complete circuit = %4.2f watt or %3d milli-watt\"%(P,P/1e-03)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The circuit resistance = 2300 ohms or 2.3 kilo-ohms\n",
"The circuit current = 10.43 milli-ampere\n",
"The potential drop across resisatnce R1 = 3.44 volts\n",
"The potential drop across resistance R2 = 15.65 volts\n",
"The potential drop across resistance R3 = 4.90 volts\n",
"The power dissipated by the complete circuit = 0.25 watt or 250 milli-watt\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.2, Page 34"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"\n",
"#Variable declaration\n",
"E = 12.; # E.m.f of battery, V\n",
"R_BC = 16.; # Resistance across branch BC, ohms\n",
"P_BC = 4; # Electric power dissipated by resistance R_BC, W\n",
"\n",
"#Calculations\n",
"# using relation P = I^2/R, solving for I\n",
"I = math.sqrt( P_BC/R_BC); # Electric current,A\n",
"R = E/I; # Total circuit resistance, ohms\n",
"R_AB = R - R_BC; # Resistance across branch AB, ohms\n",
"\n",
"# Result\n",
"print \"The circuit current = %3.1f A\\nThe value of other resistor = %1d ohms\"%(I, R_AB)\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The circuit current = 0.5 A\n",
"The value of other resistor = 8 ohms\n"
]
}
],
"prompt_number": 16
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.3, Page 37"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"E = 24.; # E.m.f of battery, V\n",
"R_1 = 330.; # Resistance, ohms\n",
"R_2 = 1500.; #Resistance, ohms\n",
"R_3 = 470.; #Resistance, ohms\n",
"\n",
"#Calculations\n",
"# Since one end of each resistor is connected to positive terminal of battery and the other end to the negative terminal, therefore, the resistors are in parallel & in parallel connection the equivalent resistance of the circuit is equal to the reciprocal of the sum of conductances of individual resistances present in the circuit i.e 1/R = 1/R_1 + 1/R_2 + 1/R_3, solving for R \n",
"R = (R_1*R_2*R_3)/( R_1*R_2 + R_2*R_3 + R_3*R_1); # Equivalent resisance of circuit, ohms\n",
"# Since the resistances are in parallel so potetial difference across each resistor is same & in our case is equal to e.m.f of battery & from Ohm's law, V = I*R, solving for I\n",
"I_1 = E/R_1; # Current through resistor R_1, A\n",
"I_2 = E/R_2; # Current through resistor R_2, A\n",
"I_3 = E/R_3; # Current through resistance R_3, A\n",
"# Current drawn from battery is equal to the sum of branch currents\n",
"I = I_1 + I_2 + I_3; # Current drawn from battery, A\n",
"\n",
"# Results\n",
"print \"The total resistance of the circuit = %6.2f ohms\"%(R);\n",
"print \"The branch current I1 = %5.2f mA\\nThe branch current I2 = %2d mA\\nThe branch current I3 = %5.2f mA\"%(I_1/1e-03, I_2/1e-03, I_3/1e-03);\n",
"print \"The current drawn from the battery = %5.1f mA\"%(I/1e-03)\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The total resistance of the circuit = 171.68 ohms\n",
"The branch current I1 = 72.73 mA\n",
"The branch current I2 = 16 mA\n",
"The branch current I3 = 51.06 mA\n",
"The current drawn from the battery = 139.8 mA\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.4, Page 38"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"E = 12; # E.m.f of battery, V\n",
"R1 = 6; # Resistance, ohms\n",
"R2 = 3; # Resistance, ohms\n",
"\n",
"#Calculations\n",
"# Since the two resistances are in parallel, therefore effective resistance of the circuit is equal to the reciprocal \n",
"#of the sum of conductances ( 1/Ressistance) of individual resistances present in the circuit i.e 1/R = 1/R1 + 1/R2, \n",
"#simplifying for R \n",
"R = ( R1*R2)/(R1 + R2); # Effective resistance of the circuit, ohms\n",
"# Fron Ohm's law, V = I*R, solving for I\n",
"I = E/R; # Circuit current, A\n",
"I1 = E/R1; # Current through resistance R1, A\n",
"I2 = E/R2; # Current thrugh resistance R2, A\n",
"\n",
"# Results\n",
"print \"Effective resistance of the circuit = %1d ohms\"%R\n",
"print \"The current drawn from the battery = %1d A\"%I\n",
"print \"The current through resistor R1 = %1d A\"%I1\n",
"print \"The current through R2 resistor = %1d A\"%I2\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Effective resistance of the circuit = 2 ohms\n",
"The current drawn from the battery = 6 A\n",
"The current through resistor R1 = 2 A\n",
"The current through R2 resistor = 4 A\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.5, Page 39"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"R1 = 10.; # Resistance, ohm\n",
"R2 = 20.; # Resistance, ohm\n",
"R3 = 30.; # Resistance, ohm\n",
"\n",
"#Calculations\n",
"# Part (a)\n",
"# Since in series combination, the equivalent resistance of the circuit is the sum of the individual resistances \n",
"#present in the circuit i.e R = R1 + R2 + R3\n",
"R_s = R1 + R2 + R3; # Equivalent series resistance of the circuit, ohms\n",
"# Part (b)\n",
"# Since in parallel combination, the equivalent resistance of the circuit is the reciprocal of the sum of the \n",
"#conductances of the individual resistances present in the circuit i.e 1/R = 1/R1 + 1/R2 + 1/R3, solving for R;\n",
"R_p = ( R1*R2*R3 )/( R1*R2 + R2*R3 + R3*R1 ); # Equivalent parallel resistance of the circuit, ohms\n",
"\n",
"# Results\n",
"print \"Equivalent series resistance of the circuit = %2d ohm\"%R_s\n",
"print \"Equivalent parallel resistance of the circuit = %4.2f ohm\"%R_p\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Equivalent series resistance of the circuit = 60 ohm\n",
"Equivalent parallel resistance of the circuit = 5.45 ohm\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.6, Page 44"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"E = 64.; # E.m.f of battery, V\n",
"R1 = 6.; # Resistance, ohm\n",
"R2 = 4.; # Resistance, ohm\n",
"\n",
"#Calculations\n",
"# Part (a)\n",
"# Since R1 & R2 are parallel to one another hence, their equivalent resistance is equal to the sum of reciprocal of \n",
"#their individual resistances\n",
"R_BC = ( R1*R2)/( R1 + R2 ); # Equivalent resistance across branch BC, ohm\n",
"R_AB = 5.6; # Resistance across branch AB, ohm\n",
"# Since R_AB & R_BC are in series, therefore, their equivalent resistance is equal to the sum of their individual \n",
"#resistances\n",
"R_AC = R_AB + R_BC; # Total circuit resistance, ohm\n",
"# From Ohm's law, V = I*R, solving for I\n",
"I = E/R_AC; # Total circuit current, A\n",
"# Part (b)\n",
"V_BC = I*R_BC; # Potential difference across branch BC, V\n",
"I1 = V_BC/R1; # Electric current through resistor R1, A\n",
"# Part (c)\n",
"# Since P = I^2*R\n",
"P_AB = I**2*R_AB; # Power dissipated by 5.6 ohm resistance, W\n",
"\n",
"# Results\n",
"print \"The current drawn from the supply = %1d A \"%I;\n",
"print \"The current through %1d ohm resistor = %3.1f A\"%(R1, I1);\n",
"print \"The power dissipated by %3.1f ohm resistor = %5.1f W\"%(R_AB, P_AB);\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The current drawn from the supply = 8 A \n",
"The current through 6 ohm resistor = 3.2 A\n",
"The power dissipated by 5.6 ohm resistor = 358.4 W\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.7, Page 46"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"E = 18.; # E.m.f of battery, V\n",
"R1 = 4.; # Resistance, ohm\n",
"R2 = 6.; # Resistance, ohm\n",
"R3 = 5.; # Resistance, ohm\n",
"R4 = 3.; # Resistance, ohm\n",
"R5 = 6.; # Resistance, ohm\n",
"R6 = 8.; # Resistance, ohm\n",
"\n",
"#Calculations\n",
"# Part (a)\n",
"# Since resistance R1 & R2 are in parallel, therefore, equivalent resistance across branch AB will be equal to the \n",
"#reciprocal of the sum of conductances ( 1/Ressistance) of individual resistances present in the circuit \n",
"#i.e 1/R_AB = 1/R1 + 1/R2, simplifying for R_AB \n",
"R_AB = ( R1*R2 )/( R1 + R2); # Resistance, ohm\n",
"R_BC = R3; # Resistance across branch BC, ohm\n",
"# Since resistance R4, R5 & R6 are in parallel, therefore, equivalent resistance across branch CD will be equal to \n",
"#the reciprocal of the sum of conductances ( 1/Ressistance) of individual resistances present in the circuit \n",
"#i.e 1/R_CD = 1/R4 + 1/R5 + 1/R6, simplifying for R _CD\n",
"R_CD = ( R4*R5*R6 )/( R4*R5 + R5*R6 + R6*R4 ); # Resistance, ohm\n",
"# Since R_AB, R_BC & R_CD forms series combination, therefore circuit resistance will be their series sum\n",
"R = R_AB + R_BC + R_CD; # Circuit resistance, ohm\n",
"I = E/R; # Supply current, A\n",
"# Part (b)\n",
"# AS resistances R1 & R2 are parallel, therefore tere will be same potential difference across them, denoted by V_AB\n",
"V_AB = I*R_AB; # Potential difference, V\n",
"# AS resistances R4, R5 & R6 are parallel, therefore tere will be same potential difference across them, denoted by V_CD\n",
"V_CD = I*R_CD; # Potential difference, V\n",
"V_BC = I*R_BC; # Potential difference, V\n",
"# Part (c)\n",
"I1 = V_AB/R1; # Current through R1 resistor, A\n",
"I2 = V_AB/R2; # Current through R2 resistor, A\n",
"I4 = V_CD/R4; # Current through R4 resistor, A\n",
"I5 = V_CD/R5; # Current through R5 resistor, A\n",
"I6 = V_CD/R6; # Current through R6 resistor, A\n",
"# Part (d)\n",
"P3= I**2*R3; # Power dissipated, W\n",
"\n",
"# Results\n",
"print \"The current drawn from the source = %1d A\"%I\n",
"print \"The p.d. across resistor %1d ohm & %1d ohm = %3.1f V\"%(R1, R2, V_AB);\n",
"print \"The p.d. across resistor %1d ohm, %1d ohm & %1d ohm = %3.1f V\"%(R4, R5, R6, V_CD);\n",
"print \"The p.d. across resistor %1d ohm = %2d V\"%(R3, V_BC);\n",
"print \"The current through resistor %1d ohm = %3.1f A\"%(R1, I1);\n",
"print \"The current through resistor %1d ohm = %3.1f A\"%(R2, I2);\n",
"print \"The current through resistor %1d ohm = %1d A\"%(R3, I);\n",
"print \"The current through resistor %1d ohm = %5.3f A\"%(R4, I4);\n",
"print \"The current through resistor %1d ohm = %5.3f A\"%(R5,I5);\n",
"print \"The current through resistor %1d ohm = %3.1f A\"%(R6, I6);\n",
"print \"The power dissipated by the %1d ohm resistor = %2d W\"%(R3, P3);\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The current drawn from the source = 2 A\n",
"The p.d. across resistor 4 ohm & 6 ohm = 4.8 V\n",
"The p.d. across resistor 3 ohm, 6 ohm & 8 ohm = 3.2 V\n",
"The p.d. across resistor 5 ohm = 10 V\n",
"The current through resistor 4 ohm = 1.2 A\n",
"The current through resistor 6 ohm = 0.8 A\n",
"The current through resistor 5 ohm = 2 A\n",
"The current through resistor 3 ohm = 1.067 A\n",
"The current through resistor 6 ohm = 0.533 A\n",
"The current through resistor 8 ohm = 0.4 A\n",
"The power dissipated by the 5 ohm resistor = 20 W\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.8, Page 49"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration&Calculations\n",
"# Applying Kirchhoff's current law (the sum of the currents arriving at a junction is equal to the sum of the \n",
"#currents leaving that junction) at junction A\n",
"I2 = 40 + 10; # Electric current, A\n",
"# Applying Kirchhoff's current law at junction C\n",
"I1 = 80 - I2; # Electric current, A\n",
"# Applying Kirchhoff's current law at junction D\n",
"I3 = 80 + 30; # Electric current, A\n",
"# Applying Kirchhoff's current law at junction E\n",
"I4 = I3 - 25; # Electric current, A\n",
"# Applying Kirchhoff's current law at junction F\n",
"I5 = 30 - 85; # Electric current, A\n",
"\n",
"# Result\n",
"print \"Current I1 = %2d A\\nCurrent I2 = %2d A\\nCurrent I3 = %3d A\\nCurrent I4 = %2d A\\nCurrent I5 = %2d A,\"%(I1, I2, I3, I4, I5);\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Current I1 = 30 A\n",
"Current I2 = 50 A\n",
"Current I3 = 110 A\n",
"Current I4 = 85 A\n",
"Current I5 = -55 A,\n"
]
}
],
"prompt_number": 8
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.9, Page 52"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import numpy as np\n",
"from numpy import linalg\n",
"from numpy.linalg import inv\n",
"\n",
"#Variable declaration\n",
"R1 = 3; # Resistance, ohms\n",
"R2 = 2; # Resistance, ohms\n",
"R3 = 10; # Resistance, ohms\n",
"E1 = 10; # E.m.f, V\n",
"E2 = 4; # E.m.f, V\n",
"\n",
"#Calculations\n",
"# Applying Kirchhoff's Current Law(the sum of the currents arriving at a junction is equal to the sum of the \n",
"#currents leaving that junction) \n",
"A = np.array([[3.,-2.],[13.,10.]])\n",
"B = np.array([6.,10.])\n",
"I1,I2 = np.linalg.solve(A,B)\n",
"I3 = ( I1 + I2 ); # Electric current through branch CD, A\n",
"V_CD = R3*I3; # P.d.across R3 resistor, V\n",
"\n",
"# Results\n",
"print \"The current through branch FA = %6.3f A\"%I1\n",
"print \"The current through branch EB = %5.3f A\"%I2\n",
"print \"The current through branch CD = %5.3f A\"%I3\n",
"print \"p.d.across %2d resistor = %4.2f V\"%(R3,V_CD)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The current through branch FA = 1.429 A\n",
"The current through branch EB = -0.857 A\n",
"The current through branch CD = 0.571 A\n",
"p.d.across 10 resistor = 5.71 V\n"
]
}
],
"prompt_number": 9
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.10, Page 53"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import numpy as np\n",
"from numpy import linalg\n",
"\n",
"#Variable declaration\n",
"E1 = 6; # E.m.f of battery, V\n",
"E2 = 4.5; # E.m.f of battery, V\n",
"R1 = 1.5; # Resistance, ohm\n",
"R2 = 2; # Resistance, ohm\n",
"R3 = 5; # Resistance, ohm\n",
"\n",
"#Calculations\n",
"# Part (a)\n",
"# Using matrix method for solving set of equations\n",
"A = np.array([[6.5, 5], [5, 7]])\n",
"B = np.array([6, 4.5]);\n",
"#X = inv(A)*B;\n",
"I1,I2 = np.linalg.solve(A,B) # Electric current through branch FA & DC, A\n",
"I3 = ( I1 + I2); # Electric current through branch BE, A\n",
"# Part (b)\n",
"V_BE = I3*R3; # P.d across resistor R3, V\n",
"\n",
"# Results\n",
"print \"Electric current through branch FA = %5.3f A\"%I1\n",
"print \"Electric current through branch DC = %6.4f A\"%I2\n",
"print \"Electric current through branch BE = %5.3f A\"%I3\n",
"print \"p.d across resistor %1d ohms = %5.3f V\"%(R3, V_BE);\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Electric current through branch FA = 0.951 A\n",
"Electric current through branch DC = -0.0366 A\n",
"Electric current through branch BE = 0.915 A\n",
"p.d across resistor 5 ohms = 4.573 V\n"
]
}
],
"prompt_number": 10
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.11, Page 57"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import numpy as np\n",
"from numpy import linalg\n",
"\n",
"#Variable declaration\n",
"R_AB = 6; # Resistance, ohm\n",
"R_BC = 4; # Resistance, ohm\n",
"R_DC = 1; # Resistance, ohm\n",
"R_AD = 3; # Resistance, ohm\n",
"R_BD = 5; # Resistance, ohm\n",
"\n",
"#Calculations\n",
"# Using matrix method for solving the set of equations \n",
"A = np.array([[6, -3, 5], [-4, 1, 10], [0, 4, 1]]);\n",
"B = ([0, 0, 10]);\n",
"#X = inv(A)*B;\n",
"I1,I2,I3 = np.linalg.solve(A,B); # Electric current, A\n",
"I_BC = I1 - I3; # Electric current, A\n",
"I_DC = I2 + I3; # Electric current, A\n",
"I = I1 + I2; # Supply current, A\n",
"\n",
"# Results\n",
"print \"The current through %1d ohm resistor = %5.3f A\"%(R_AB, I1)\n",
"print \"The current through %1d ohm resistor = %4.2f A\"%(R_BC, I_BC);\n",
"print \"The current through %1d ohm resistor = %5.3f A\"%(R_DC, I_DC);\n",
"print \"The current through %1d ohm resistor = %5.3f A\"%(R_AD, I2);\n",
"print \"The current through %1d ohm resistor = %5.3f A\"%(R_BD, I3);\n",
"print \"The supply current = %5.3f A\"%I\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The current through 6 ohm resistor = 1.074 A\n",
"The current through 4 ohm resistor = 0.89 A\n",
"The current through 1 ohm resistor = 2.638 A\n",
"The current through 3 ohm resistor = 2.454 A\n",
"The current through 5 ohm resistor = 0.184 A\n",
"The supply current = 3.528 A\n"
]
}
],
"prompt_number": 11
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.12, Page 58"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"R_AB = 6; # Resistance across branch AB, ohm \n",
"R_AD = 3; # Resistance across branch AD, ohm\n",
"R_BC = 4; # Resistance across branch BC, ohm\n",
"R_DC = 2; # Resistance across branch DC, ohm\n",
"\n",
"#Calculations\n",
"# Since R_AB/R_AD = R_BC/R_DC, so the wheatstone bridge is balanced hence no current flows through branch BD\n",
"I3 = 0;\n",
"\n",
"# Result\n",
"print \"The current through branch BD i.e I3 = %1d A\"%I3\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The current through branch BD i.e I3 = 0 A\n"
]
}
],
"prompt_number": 12
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 1.13, Page 62"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import numpy as np\n",
"from numpy import linalg\n",
"\n",
"#Variable declaration\n",
"R1 = 20; # Resistance, ohm\n",
"R2 = 10; # Resistance, ohm\n",
"R3 = 8; # Resistance, ohm\n",
"R4 = 5; # Resistance, ohm\n",
"R5 = 2; # Resistance, ohm\n",
"\n",
"#Calculations\n",
"A = np.array([[20, -10, 8], [-5, 2, 15], [0, 12, 2]]);\n",
"B = np.array([0, 0, 10]);\n",
"I1,I2,I3 = np.linalg.solve(A,B) # Electric current through BD, A\n",
"V_BD = I3*R3; # P.d across branch BD, V\n",
"# For balance conditions i.e I3 = 0, R1/R2 = R4/R5, solving for R4\n",
"R_4 = ( R1*R5 )/R2; # Resistance, ohm\n",
"\n",
"# Results\n",
"print \"The p.d between terminals B and D = %5.3f V\"%V_BD\n",
"print \"The value to which %1d ohm resistor must be adjusted in order to reduce the current through %1d ohm resistor to zero = %1d ohm\"%(R4, R3, R_4);\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The p.d between terminals B and D = 0.195 V\n",
"The value to which 5 ohm resistor must be adjusted in order to reduce the current through 8 ohm resistor to zero = 4 ohm\n"
]
}
],
"prompt_number": 13
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.14, Page 64"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"# For part (a)\n",
"Rm = 1000.; # Resistance, ohm\n",
"Rd = 1; # Resistance, ohm\n",
"Rv = 3502.; # Resistance, ohm\n",
"# Using Wheatstone bridge balanced condition i.e Rx/Rv = Rm/Rd , solving for Rx\n",
"Rx = ( Rm/Rd) * Rv; # Resistance,ohm\n",
"print \"The value of the resistance being measured = %5.3f mega-ohm\"%(Rx*1e-06);\n",
"\n",
"# Part (b)\n",
"Rm = 1.; # Resistance, ohm\n",
"Rd = 1000; # Resistance, ohm\n",
"Rv = 296; # Resistance, ohm\n",
"# Using Wheatstone bridge balanced condition i.e Rx/Rv = Rm/Rd , solving for Rx\n",
"Rx = ( Rm/Rd )*Rv; # Resistance,ohm\n",
"print \"The value of the resistance being measured = %5.3f ohm\"%Rx\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The value of the resistance being measured = 3.502 mega-ohm\n",
"The value of the resistance being measured = 0.296 ohm\n"
]
}
],
"prompt_number": 14
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 2.15, Page 67"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable declaration\n",
"l1 = 600e-03; # Scale reading, metre\n",
"l2 = 745e-03; # Scale reading, metre\n",
"l_s = 509.3e-03; # Total scale length, metre\n",
"E_s = 1.0186; # Source voltage, V\n",
"\n",
"#Calculations\n",
"E1 = ( l1/l_s )*E_s; # Voltage drop across length l1, V\n",
"E2 = ( l2/l_s)*E_s; # Voltage drop across length l2, V\n",
"\n",
"# Results\n",
"print \"The emf of the first cell = %3.1f V \"%E1\n",
"print \"The emf of the second cell = %3.2f V \"%E2\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The emf of the first cell = 1.2 V \n",
"The emf of the second cell = 1.49 V \n"
]
}
],
"prompt_number": 15
}
],
"metadata": {}
}
]
}
|