summaryrefslogtreecommitdiff
path: root/sample_notebooks/rohitmahadev/Chapter1_1.ipynb
blob: 16205a41f0186b36cffe51c8977d0221ce4f9826 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:d669fd33d214dfe64d2894959328f05abdede2e1f58e2a68176378d9cf3931d3"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter1-circuit analysis"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex1-pg16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "##input\n",
      "r1=4.;##resistance between point A and B in ohms which is in series with 10 volts d.c. supply.\n",
      "r2=3.;##resistance between points C and D in ohms which is in series with a d.c. supply of 8 volts.\n",
      "r3=5.;##resistance betwwen points F and G in ohms\n",
      "##arms AB.CD,FG are in parallel with each other.\n",
      "v1=10.;##d.c. supply voltage in the arm AB in volts\n",
      "v2=8.;##d.c. supply voltage in the arm CD in volts\n",
      "\n",
      "##calculations\n",
      "##using SUPER POSITION THEOREM\n",
      "##voltage source of 8 volts is neglected and supply is 10 volts d.c\n",
      "R1=r1+((r2*r3)/(r2+r3));## total resistance in ohms\n",
      "bIa1=v1/R1;##current in arm AB in amperes \n",
      "cId1=v1*(r3/(R1*(r2+r3)));##current in arm CD in amperes\n",
      "dIc1= -cId1;\n",
      "fIg1=(v1/R1)-cId1;##current in arm FG in amperes\n",
      "##voltage source of 10 volts is neglected and supply is 8 volts d.c\n",
      "R2=r2+((r1*r3)/(r1+r3));##total resistance in ohms\n",
      "dIc2=v2/R2;##current in arm CD in amperes\n",
      "aIb2=v2*(r3/(R2*(r3+r1)));##current in arm AB in amperes\n",
      "bIa2= -aIb2;\n",
      "fIg2=(v2/R2)-aIb2;##current in arm FG in amperes\n",
      "I1=bIa1+bIa2;##current in 10 V source in amperes\n",
      "I2=dIc1+dIc2;##current in 8V source in amperes\n",
      "I3=fIg1+fIg2;##current in arm FG in amperes\n",
      "\n",
      "##output\n",
      "print'%s %.2f %s %.2f %s %.2f %s '%('the currents in the circuit are ',I1,'A' and '',I2,'A' and  '',I3,'A')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the currents in the circuit are  0.85  0.47  1.32 A \n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex2-pg16"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "##input\n",
      "v1=10.;## d.c. voltage source in volts present in arm 1 in series with a 2 ohm resistor\n",
      "v2=15.;##d.c. voltage source in volts present in arm 2 in series with a 3 ohm resistor\n",
      "r1=2.; ##resistance in arm 1 in ohms\n",
      "r2=3.;## resistance in arm 2 in ohms\n",
      "r3=1.8;##resistance between node formed by arm 1 and 2 and point A\n",
      "R=3.;##load resistance in ohms placed in arm AB\n",
      "## point A and B are in open condition and arm 1 and 2 are in parallel\n",
      "\n",
      "##calculations\n",
      "##thevenin equivalent circuit method\n",
      "i1=(v2-v1)/(r1+r2);## current in the parallel circuit in amperes\n",
      "e=v2-(i1*r2);## open cicuit e.m.f in volts i.e. thevenin's voltage\n",
      "r=r3+((r1*r2)/(r1+r3));## resistance to be considered between AandB in ohms i.e. thevenin's resistance\n",
      "I=e/(r+R);##current through the load resistance in amperes\n",
      "\n",
      "##output \n",
      "print'%s %.2f %s %.2f %s %.2f %s '%(' the thevenin equivalent generator will have a constant e.m.f. of ',e,' V' and 'internal resistance of ',r,' ohm.' and '\\n the current in 3 ohm resistor is ',I,' A')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " the thevenin equivalent generator will have a constant e.m.f. of  12.00 internal resistance of  3.38 \n",
        " the current in 3 ohm resistor is  1.88  A \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex3-pg17"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "##input\n",
      "r1=0.2;##resistance in arm 1 in ohms which is in series with 10 volts d.c. supply.\n",
      "r2=0.2;##resistance in arm 2 in ohms which is in series with a d.c. supply of 12 volts.\n",
      "r3=0.4;##resistance in arm 3 in ohms whichis in series with 15 volts d.c. supply .\n",
      "##arms 1,2 and 3 are in parallel with each other and are parallel with the arm AB.\n",
      "v1=10;##d.c. supply voltage in the arm 1 in volts\n",
      "v2=12;##d.c. supply voltage in the arm 2 in volts\n",
      "v3=15;##d.c. supply voltage in the arm 3 in volts\n",
      "R1=2.28;## resistance in arm AB in ohms in one case\n",
      "R2=5.82;## resistance in arm AB in ohms in another\n",
      "\n",
      "##calculations\n",
      "##thevenin equivalent circuit method\n",
      "e=((v3/r3)+(v2/r2)+(v1/r1))/((1/r1)+(1/r2)+(1/r3));## thevenin's voltage in volts\n",
      "r=1/((1/r1)+(1/r2)+(1/r3));##thevenin's resistance in ohms\n",
      "I1=e/(r+R1);## current when resistance in AB arm is 2.28 ohms\n",
      "I2=e/(r+R2);## current when resistance in AB arm is 5.82 ohms\n",
      "\n",
      "##output\n",
      "print'%s %.2f %s %.2f %s  %.2f %s %.2f %s '%('the equivalent generator has a constant voltage of ',e,' V 'and 'an internal resistance of ',r,' ohms' '\\n the load currents are ',I1,' A' and '',I2,' A')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the equivalent generator has a constant voltage of  11.80 an internal resistance of  0.08  ohms\n",
        " the load currents are   5.00  2.00  A \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex4-pg18"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "##input\n",
      "##AB,BC,CD,DA are arms of a wheatstone bridge\n",
      "r1=4.;##resistance in arm AB in ohms\n",
      "r2=6.;##resistance in arm BC in ohms\n",
      "r3=5.;##resistance in arm CD in ohms\n",
      "r4=3.;##resistance in arm DA in ohms\n",
      "v=4.;##d.c. supply given between points A and C in volt\n",
      "R=10.;##resistance of the detector placed between the points B and D in ohms\n",
      "\n",
      "##calculations\n",
      "aIb=v/(r1+r2);##current in arm AB in amperes\n",
      "aId=v/(r3+r4);##current in arm DA in amperes\n",
      "aVb=aIb*r1;##voltage drop along arm AB in volts\n",
      "aVd=aId*r4;##voltage drop across arm AD in volts\n",
      "dVb=aVb-aVd;##since D is positive with respect to B\n",
      "e=dVb;## open circuit voltage in volts\n",
      "r0=((r1*r2)/(r1+r2))+((r3*r4)/(r3+r4));##equivalent resistance in ohms when the supply neglected\n",
      "I=e/(r0+R);##current through the 10 ohms resistance in amperes\n",
      "\n",
      "##output\n",
      "print'%s %.2f %s'%('the current through the detector will be ',I,' A in the direction from D to B')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the current through the detector will be  0.01  A in the direction from D to B\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex5-pg19"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "##input\n",
      "v1=21.;##voltage of first battery in arm 1 in volts\n",
      "v2=16.;##voltage of second battery in arm 2 in volts\n",
      "r1=3.;##internal resistance of first battery in ohms\n",
      "r2=2.;##internal resistance of second battery in ohms\n",
      "R=6.;##resistance going to be introduced in arm AB in ohms\n",
      "##arms 1,2 and AB are in parallel\n",
      "##arm AB is a short circuit path\n",
      "\n",
      "##calculations\n",
      "##norton's equivalent circuit method\n",
      "Isc=(v1/r1)+(v2/r2);##current through short circuit path in amperes\n",
      "aRb=(r1*r2)/(r1+r2);##equivalent resistance in ohms\n",
      "##now 6ohm resistor is placed in arm AB\n",
      "aIb=Isc*((aRb)/(aRb+R));##current through 6 ohm resistor in amperes\n",
      "\n",
      "##output\n",
      "print'%s %.2f %s %.2f %s %.2f %s '%('the constants for norton equivalent generator are ',Isc,' A' and '',aRb,'ohm' '\\n the current through the 6 ohm resistor is ',aIb,' A')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the constants for norton equivalent generator are  15.00  1.20 ohm\n",
        " the current through the 6 ohm resistor is  2.50  A \n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex6-pg20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "##input\n",
      "v1=5.;##voltage of battery in arm 1 in volts\n",
      "v2=10.;##voltage of battery in arm 2 in volts\n",
      "v3=20.;##voltage of battery in arm 3 in volts\n",
      "r1=3.;##internal resistance of battery in arm 1 in ohms\n",
      "r2=8.;##internal resistance of battery in arm 2 in ohms\n",
      "r3=24.;##internal resistance of battery in arm 3 in ohms\n",
      "##arms 1,2,3 and AB are in parallel with each other and AB are in open condition\n",
      "r4=6.;##resistance between node formed by arms 1,2 and 3 and point A in ohms\n",
      "R0=7.;##load  resistance to be connected in arm AB in ohms\n",
      "##calculations\n",
      "##norton's equivalent method\n",
      "##batteries are neglected. so, only internal resistances remain in the arms\n",
      "R=1./((1./r1)+(1./r2)+(1./r3));##equivalent resistance in ohms\n",
      "aRb=R+r4;## total resistance when looked into the circuit from arm AB in ohm\n",
      "##applying superposition principle to determine the short circuit current\n",
      "##battery in arm 1 alone is considered\n",
      "R1=r1+(1./((1./r2)+(1./r3)+(1./r4)));##effective resistance in ohms\n",
      "I1=v1/R1;##current in amperes\n",
      "pd=I1*r1;##potential drop across the parallel combination in volts\n",
      "aIb1=pd/r4;##current in amperes\n",
      "##battery in the arm 2 alone is considered\n",
      "R2=r2+(1./((1./r1)+(1./r3)+(1./r4)));## effective resistance in ohms\n",
      "I2=v2/R2;##current in amperes\n",
      "V1=I2/((1./r1)+(1./r3)+(1./r4));##voltage in volts\n",
      "aIb2=V1/r4;##current in amperes\n",
      "##battery in the arm 3 alone is considered\n",
      "R3=r3+(1./((1./r1)+(1./r2)+(1./r4)));##effective resistance in ohms\n",
      "I3=v3/R3;##current in amperes\n",
      "V2=I3/((1./r1)+(1./r2)+(1./r4));##voltage in volts\n",
      "aIb3=V2/r4;##current in amperes\n",
      "Isc=aIb1+aIb2+aIb3;##short circuit current in amperes\n",
      "I=Isc*(aRb/(aRb+R0));##current through load resistor in amperes\n",
      "\n",
      "##output\n",
      "print'%s %.2f %s %.2f %s %.2f %s'%('Nortons equivalent generator will produce a constant current of ',Isc,' A' and 'has a shunt resistance of ',r2,' ohms' '\\n the current through the external resistor will be ',I,' A')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Nortons equivalent generator will produce a constant current of  0.94 has a shunt resistance of  8.00  ohms\n",
        " the current through the external resistor will be  0.50  A\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex7-pg20"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "##input\n",
      "##AB,BC,CD,DA are arms of a wheatstone bridge\n",
      "r1=4.;##resistance in arm AB in ohms\n",
      "r2=6.;##resistance in arm BC in ohms\n",
      "r3=5.;##resistance in arm CD in ohms\n",
      "r4=3.;##resistance in arm DA in ohms\n",
      "v=4.;##d.c. supply given between points A and C in volt\n",
      "R0=10.;##resistance of the detector placed between the points B and D in ohms\n",
      "##a detector is placed between the point B and D\n",
      "\n",
      "##calculations\n",
      "## noerton's equivalent circuit method\n",
      "R1=((r1*r2)/(r1+r2))+((r3*r4)/(r3+r4));## equivalent resistance assuming short circuit between poin A and C in ohms\n",
      "R2=((r1*r4)/(r1+r4))+((r2*r3)/(r2+r3));##equivalent resistance assuming short circuit between points B and D in ohms\n",
      "I1=v/R2;## total current in amperes\n",
      "aIb=v*(r4/(R2*(r4+r1)));##current in arm AB in amperes\n",
      "aVDb=v*aIb;##voltage drop in arm AB\n",
      "bVDc=v-aVDb;##voltage drop in arm DC\n",
      "bIc=bVDc/r2;##currrent in arm BC in amperes\n",
      "dIb=bIc-aIb;##current in arm DB in amperes\n",
      "Isc=dIb;##short circuit current in amperes\n",
      "I=Isc*(R1/(R1+R0));##current through the detector in amperes\n",
      "\n",
      "##output\n",
      "print'%s %.4f %s %.2f %s %.2f %s'%('Nortons equivalent generator will produce a constant current of ',Isc,' A' and 'has a shunt resistance of ',R1,' ohms' '\\n the current through the external resistor will be ',I,' A')\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Nortons equivalent generator will produce a constant current of  0.0234 has a shunt resistance of  4.28  ohms\n",
        " the current through the external resistor will be  0.01  A\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8-pg21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "##input\n",
      "##arma AB,BC and CA forms delta connection\n",
      "r1=2.;##resistance in arm AB in ohms\n",
      "r2=3.;##resistance in arm BC in ohms\n",
      "r3=5.;##resistance in arm CA in ohms\n",
      "\n",
      "##calculations\n",
      "##conversion of given delta into star connection\n",
      "##let N be the star point\n",
      "R1=(r1*r2)/(r1+r2+r3);##resistance in arm AN in ohms\n",
      "R2=(r2*r3)/(r1+r2+r3);##resistance in arm BN in ohms\n",
      "R3=(r1*r3)/(r1+r2+r3);##resistance in arm CN in ohms\n",
      "\n",
      "##output\n",
      "print'%s %.2f %s %.2f %s %.2f %s'%('the respective star connected resistances are ',R1,' ohm'and '',R2,' ohm' and '',R3,'ohm')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the respective star connected resistances are  0.60  1.50  1.00 ohm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9-pg22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "##input\n",
      "##AB,BC,CD,DA are arms of a wheatstone bridge\n",
      "r1=5.;##resistance in arm AB in ohms\n",
      "r2=20.;##resistance in arm BC in ohms\n",
      "r3=15.;##resistance in arm CD in ohms\n",
      "r4=4.;##resistance in arm DA in ohms\n",
      "v=4.;##d.c. supply given between points A and C in volt\n",
      "r0=0.5;## internal resistances pf the d.c. supply in ohms\n",
      "r5=15.;##resistance in arm BD in ohms\n",
      "\n",
      "##calculations\n",
      "##BCD is replaced by equivalent star connection\n",
      "##assume N as star piont after conversion\n",
      "bRn=(r2*r3)/(r3+r2+r5);##resistance in arm BN in ohms\n",
      "cRn=(r2*r5)/(r3+r2+r5);##resistance in arm CN in ohms\n",
      "dRn=(r5*r3)/(r3+r2+r5);##resistance in arm DN in ohms\n",
      "R=r0+cRn+(((r1+bRn)*(r4+dRn))/(r1+bRn+r4+dRn));##total resistance in ohms after conversion\n",
      "I=v/R;##totalcurrent supply in amperes\n",
      "I1=(v/R)*((r4+dRn)/(r1+bRn+r4+dRn));##current between points A and B in amperes\n",
      "I2=I-I1;##current between points A and D in amperes\n",
      "V1=I1*r1;##voltage drop across r1 in volts\n",
      "V2=I2*r4;##voltage drop across r4 in volts\n",
      "V3=V2-V1;##voltage drop across r5 in volts and B is positive to D\n",
      "I3=V3/r5;##current between points B and D in amperes\n",
      "I4=I1-I3;##current between points B and C in amperes\n",
      "I5=I2+I3;##current between points D and C in amperes\n",
      "\n",
      "##output\n",
      "print'%s %.2f %s %.2f %s %.2f %s  %.2f %s %.2f %s %.2f %s '%('the currents in each part of the circuit are \\n It= ',I,' A' and  '\\n aIb= ',I1,' A' and  '\\n aId= ',I2,' A 'and '\\n bId= ',I3,' A' and '\\n bIc= ',I4,' A' and '\\n dIc= ',I5,' A')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the currents in each part of the circuit are \n",
        " It=  0.35 \n",
        " aIb=  0.15 \n",
        " aId=  0.20 \n",
        " bId=   0.00 \n",
        " bIc=  0.15 \n",
        " dIc=  0.20  A \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex10-pg23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "##input\n",
      "##AN,BN,CN are connected in star fashion where N is the nuetral point\n",
      "r1=5.;##resistance in arm AN in ohms\n",
      "r2=20.;##resistance in arm BN in ohms\n",
      "r3=10.;##resistance in arm CN in ohms\n",
      "\n",
      "##calculations\n",
      "##star to delta conversion\n",
      "Y1=1./r1;##conductance of arm AN in seimens\n",
      "Y2=1./r2;##conductance of arm BN in seimens\n",
      "Y3=1./r3;##conductance of arm CN in seimens\n",
      "R1=1./((Y1*Y2)/(Y1+Y2+Y3));##resistance of arm AB in ohms\n",
      "R2=1./((Y2*Y3)/(Y1+Y2+Y3));##resistance of arm BC in ohms\n",
      "R3=1./((Y1*Y3)/(Y1+Y2+Y3));##resistance of arm CA in ohms\n",
      "\n",
      "##ouput\n",
      "print'%s %.2f %s %.2f %s %.2f %s '%('the equivalent resistances values for delta circuit are ',R1,' ohms,'and '',R2,' ohms' and '',R3,' ohms')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the equivalent resistances values for delta circuit are  35.00  70.00  17.50  ohms \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex11-pg23"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "##input\n",
      "##AB,BC,CD,DA forms an unbalanced wheatstone's bridge\n",
      "r1=2.;##resistance in arm AB in ohms\n",
      "r2=5.;##resistance in arm BC in ohms\n",
      "r3=6.;##resistance in arm CD in ohms\n",
      "r4=2.;##resistance in arm DA in ohms\n",
      "r5=10.;##resistance of detector placed between the points B and D\n",
      "v=4.;##batterry supplying d.c. voltage in volts which is placed between points A and C\n",
      "r0=0.2;## internal resistance of the battery in ohms\n",
      "\n",
      "##calculations\n",
      "##AB,BC and BD are cosidered to be in star connection with B as star point\n",
      "Y1=1./r1;##conductacne of r1 in seimens\n",
      "Y2=1./r2;##conductance of r2 in seimens\n",
      "Y3=1./r5;##conductance of r5 in seimens\n",
      "##after delta conversion\n",
      "R1=1./((Y1*Y2)/(Y1+Y2+Y3));##resistance between points A and B in ohms\n",
      "R2=1./((Y2*Y3)/(Y1+Y2+Y3));##resistance between points C and D in ohms\n",
      "R3=1./((Y1*Y3)/(Y1+Y2+Y3));##resistance between points D and A in ohms\n",
      "Rad=(r4*R3)/(r4+R3);##effective resistance of arm AD in ohms\n",
      "Rdc=(r3*R2)/(r3+R2);##effective resistance of arm DC in ohms\n",
      "Radc=(Rad+Rdc);##effective resistance if arms AD and DC in ohms\n",
      "R=r0+((R1*Radc)/(R1+Radc));## total resistance of hte circuit in ohms\n",
      "I=v/R;##total current in the circuit in amperes\n",
      "I1=I*(R1/(R1+Radc));##current in arm AD in amperes\n",
      "I2=I-I1;##current in arm AB in amperes\n",
      "V1=I1*r4;##voltage across arm AD in volts\n",
      "V2=I2*r1;##voltage across arm AB in volts\n",
      "V3=V1-V2;##voltage across arm BD in volts and B is positive to D\n",
      "I3=V3/r5;##current in arm BD in amperes\n",
      "\n",
      "##output\n",
      "print'%s %.2f %s'%('the current in the detector is ',I3,' A')\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the current in the detector is  0.01  A\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex12-pg24"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "##input\n",
      "## a battery consists of 10cells connected in series\n",
      "v=1.5;##e.m.f. of each cell in volts\n",
      "r=0.2;## internal resistance of each cell in ohms\n",
      "n=10.;##number of cells in the battery\n",
      "\n",
      "##calculations\n",
      "##for maximum power load resistance=internal resistance\n",
      "R=n*r;##total internal resistance of hte battery in ohms\n",
      "Rl=R;##load resistance in ohms\n",
      "e=n*v;##total e.m.f. of battery in volts\n",
      "I=e/(R+Rl);##current from battery in amperes\n",
      "P=(I**2)*R;##heating loss in the battery in watts\n",
      "V=e-(I*R);##terminal voltage in volts\n",
      "\n",
      "##output\n",
      "print'%s %.2f %s %.2f %s '%('The maximum value of power which the battery may transfer is ',P,' W' and 'an equal quantity of power is dissipated in the battery. \\n under these conditions the terminal p.d. is',V,'')\n",
      " \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The maximum value of power which the battery may transfer is  28.12 an equal quantity of power is dissipated in the battery. \n",
        " under these conditions the terminal p.d. is 7.50  \n"
       ]
      }
     ],
     "prompt_number": 1
    }
   ],
   "metadata": {}
  }
 ]
}