summaryrefslogtreecommitdiff
path: root/Engineering_Physics/chapter3.ipynb
blob: 1c763114f4d5b292cf54076743d2f2238ebb7b3a (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
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
{

 "metadata": {

  "name": "",

  "signature": "sha256:f8c5b92f0cb0a1787021af8dd46e58ab42d75991e4d7ba39c4a4693a16608b3e"

 },

 "nbformat": 3,

 "nbformat_minor": 0,

 "worksheets": [

  {

   "cells": [

    {

     "cell_type": "heading",

     "level": 1,

     "metadata": {},

     "source": [

      "Chapter3:DIFFRACTION"

     ]

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.1:pg-97"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate angular width and linear width \n",

      "lamda=6*10**-5\n",

      "e=0.01 #width of slit in cm\n",

      "#position of minima is given by\n",

      "sintheta=lamda/e               #sintheta=m*lamda/e             ,where m=1,2,3,......\n",

      "print \"sintheta=\",sintheta,\" m\"\n",

      "#since theta is very small,so sintheta is approximately equal to theta\n",

      "theta=sintheta\n",

      "theta1=2*theta\n",

      "print \"total angular width of central maximum is theta1=\",theta1,\" m radians \"\n",

      "d=100  #distance in cm\n",

      "Y=theta*d\n",

      "Y1=2*Y\n",

      "print \"linear width of central maximum on the screen is Y1=\",Y1,\" m cm\"\n",

      "print \"values of m =1,2,3,............ gives the directions of first, second .............minima\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "sintheta= 0.006  m\n",

        "total angular width of central maximum is theta1= 0.012  m radians \n",

        "linear width of central maximum on the screen is Y1= 1.2  m cm\n",

        "values of m =1,2,3,............ gives the directions of first, second .............minima\n"

       ]

      }

     ],

     "prompt_number": 2

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.2:pg-97"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate wavelength of light\n",

      "#in a diffraction pattern due to single slit, minima is given by e*sintheta=m*lamda\n",

      "#since theta is very small, sintheta is approximately equal to theta\n",

      "#theta=Y/d\n",

      "e=0.014 #width of slit in cm\n",

      "d=200 #distance in cm\n",

      "m=2 \n",

      "Y=1.6 #in cm\n",

      "lamda=Y*e/(d*m)\n",

      "print \"wavelength of light is lamda=\",lamda,\"cm\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "wavelength of light is lamda= 5.6e-05 cm\n"

       ]

      }

     ],

     "prompt_number": 5

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.3:pg-98"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate width of slit\n",

      "#direction of minima in fraunhofer diffraction due to single slit is given by math.pi/lamda*e*siuntheta=+m*math.pi,where m=1,2,3\n",

      "#angular spread of the central maximum on either side of the incident light is sintheta=lamda/e,where m=1,position of first minima\n",

      "lamda=5000*10**-8\n",

      "e=lamda/math.sin(math.pi/6)\n",

      "print \"width of slit is e=\",e,\"cm\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "width of slit is e= 0.0001 cm\n"

       ]

      }

     ],

     "prompt_number": 6

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.4:pg-98"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate wavelength of incident light\n",

      "#direction of minima is given by e*sintheta=+m*lamda\n",

      "#for first minima m=1,i.e. e*sintheta=lamda,sintheta is approximately equal to theta,then we can write it as e*theta=lamda ...........eq(1)\n",

      "#theta=Y/d........................eq(2) \n",

      "e=0.02 #in cm\n",

      "Y=0.5        #position of first minima from the central maxima in cm\n",

      "d=200           #distance of screen from the slit in cm\n",

      "#from eq(1) and eq(2),we get\n",

      "lamda=e*Y/d\n",

      "print \"wavelength of incident light is lamda=\",lamda,\"cm\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "wavelength of incident light is lamda= 5e-05 cm\n"

       ]

      }

     ],

     "prompt_number": 7

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.6:pg-99"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate values of lamda1 and lamda2\n",

      "#in fraunhofer diffraction pattern ,the direction of minima is given by e*sintheta=+m*lamda,where m=1,2,.......\n",

      "#direction of fourth minima (m=4) for wavelength lamda1 is given by e*sintheta1=4*lamda1..........eq(1)\n",

      "#similarly, e*sintheta2=5*lamda2..........eq(2)\n",

      "#from eq(1) and eq(2),we get e*sintheta=4*lamda1=5*lamda2....eq(3)\n",

      "y=0.5            #in cm\n",

      "f=100             #in cm\n",

      "theta=y/f                 #in radian\n",

      "sintheta=theta #theta is very small\n",

      "e=0.05       #width of slit in cm\n",

      "lamda1=e*sintheta/4\n",

      "print \"lamda1=\",lamda1,\"cm\"\n",

      "#from eq(3) we get,\n",

      "lamda2=4*lamda1/5\n",

      "print \"lamda2=\",lamda2,\"cm\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "lamda1= 6.25e-05 cm\n",

        "lamda2= 5e-05 cm\n"

       ]

      }

     ],

     "prompt_number": 8

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.7:pg-100"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate half angular width \n",

      "e=1.2*10**-4            #width of slit in cm\n",

      "y=6*10**-5      #wavelength of monochromatic light in cm\n",

      "theta=y/e\n",

      "print \"half angular width of central bright maxima is theta=\",theta,\"radian\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "half angular width of central bright maxima is theta= 0.5 radian\n"

       ]

      }

     ],

     "prompt_number": 9

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.8:pg-100"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate angle\n",

      "lamda=6000.0*10**-8      #wavelength of light in cm\n",

      "e=0.03       #width of slit in cm\n",

      "#e*sintheta=m*lamda,where m=1\n",

      "theta=math.degrees(math.asin(lamda/e)) \n",

      "print \"angle at which the first dark band are formed in the fraunhofer diffraction pattern is theta=\",round(theta,4),\"degree\"\n",

      "theta1=math.degrees(math.sin(3*lamda/(2*e)))\n",

      "print \"angle at which the next bright band are formed in the fraunhofer diffraction pattern is theta1=\",round(theta1,4),\"degree\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "angle at which the first dark band are formed in the fraunhofer diffraction pattern is theta= 0.1146 degree\n",

        "angle at which the next bright band are formed in the fraunhofer diffraction pattern is theta1= 0.1719 degree\n"

       ]

      }

     ],

     "prompt_number": 17

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.9:pg-101"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate distances of first dark band and of next bright band on either side of the central maximum\n",

      "#formula is e*sintheta=m*lamda,where m=1\n",

      "lamda=5890.0*10**-8     #wavelength of light in cm\n",

      "e=0.03 #width of slit in cm\n",

      "sintheta=lamda/e \n",

      "theta=sintheta #becoz theta is very small,so sintheta is approximately equal to theta\n",

      "f=50.0\n",

      "y=f*theta\n",

      "print \"linear distance of first minimum from the central maximum is y=\",y,\"cm\"\n",

      "sintheta1=3*lamda/(2*e)\n",

      "theta1=sintheta1\n",

      "y1=f*theta1\n",

      "print \"linear distance of first secondary maxima is y1=\",y1,\"cm\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "linear distance of first minimum from the central maximum is y= 0.0981666666667 cm\n",

        "linear distance of first secondary maxima is y1= 0.14725 cm\n"

       ]

      }

     ],

     "prompt_number": 13

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.10:pg-105"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate wavelength of light and missing orders\n",

      "omega=0.25  #fringe width in cm\n",

      "D=170 #distance in cm\n",

      "twod=0.04 # distance in cm\n",

      "lamda=omega*twod/D\n",

      "print \"wavelength of light is lamda=\",lamda,\"cm\"\n",

      "e=0.08 #width of slit in mm\n",

      "d=0.4 #in mm\n",

      "m=1\n",

      "n=m*(e+d)/e \n",

      "print \"missing order is n=\",n,\"unitless\"\n",

      "#we can also find order for m=2,3,....\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "wavelength of light is lamda= 5.88235294118e-05 cm\n",

        "missing order is n= 6.0 unitless\n"

       ]

      }

     ],

     "prompt_number": 14

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.11:pg-112"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate wavelength\n",

      "n=2.0 #order of spectrum\n",

      "theta=math.pi/6 #in radians\n",

      "E=1.0/5000 #let (e+d)=E\n",

      "lamda=E*math.sin(math.pi/6)/n\n",

      "print \"the wavelength of the spectral line is lamda=\",lamda,\"cm\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "the wavelength of the spectral line is lamda= 5e-05 cm\n"

       ]

      }

     ],

     "prompt_number": 16

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.12:pg-112"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate difference in deviations \n",

      "lamda=5*10**-5    #wavelength of light in cm\n",

      "eplusd=1/6000.0         #where eplusd=e+d\n",

      "theta1=math.degrees(math.asin(lamda/eplusd))   #for first order spectrum\n",

      "theta3=math.degrees(math.asin(3*lamda/eplusd)) #for second order spectrum\n",

      "difference=theta3-theta1\n",

      "print \"difference in deviations in first and third order spectra is difference =\",round(difference,1),\"degree\"\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "difference in deviations in first and third order spectra is difference = 46.7 degree\n"

       ]

      }

     ],

     "prompt_number": 15

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.13:pg-112"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate orders\n",

      "#let E=(e+d) \n",

      "#formula is (e+d)*sin thita=n*lamda\n",

      "#for maximum order to be possible thita=90 degree\n",

      "#sin theta=1\n",

      "E=2.54/2620 #in cm\n",

      "lamda=5*10**-5 #wavelength of the incident light in cm\n",

      "n=E/lamda\n",

      "print \"the orders will be visible is n=\",n,\"unitless\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "the orders will be visible is n= 19.3893129771 unitless\n"

       ]

      }

     ],

     "prompt_number": 18

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.14:pg-113"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate number of lines in the grating\n",

      "#theta1=theta2=30 degree\n",

      "#sin theta1=sin theta2=1/2\n",

      "lamda1=6*10**-5 \n",

      "                      #wavelength in cm\n",

      "lamda2=4.5*10**-5\n",

      "#let (e+d)=E \n",

      "#formula is (e+d)*sin theta1=n*lamda1----------eq(1)\n",

      "#(e+d)*sin theta2=(n+1)*lamda2----------eq(2)\n",

      "#we get,\n",

      "n=lamda2/(lamda1-lamda2)  #order of spectrum\n",

      "E=n*lamda1/math.sin(math.pi/6)\n",

      "number=1/E\n",

      "print \"number of lines is number=\",number,\"unitless\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "number of lines is number= 2777.77777778 unitless\n"

       ]

      }

     ],

     "prompt_number": 19

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.15:pg-113"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate order when visible light of wavelength in the range 4000 to 7500 angstrom\n",

      "#let E=(e+d)\n",

      "E=1.0/4000 #in cm\n",

      "lamda1=4*10**-5 \n",

      "                        #wavelength in cm\n",

      "lamda2=7.5*10**-5\n",

      "n1=E*math.sin(math.pi/2)/lamda1\n",

      "n2=E*math.sin(math.pi/2)/lamda2\n",

      "print \"order when wavelength of 4000 angstrom is n1=\",n1,\"unitless\"\n",

      "print \"order when wavelength of 7500 angstrom is n2=\",n2,\"unitless\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "order when wavelength of 4000 angstrom is n1= 6.25 unitless\n",

        "order when wavelength of 7500 angstrom is n2= 3.33333333333 unitless\n"

       ]

      }

     ],

     "prompt_number": 21

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.17:pg-114"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate angle of diffraction \n",

      "n=1 #order\n",

      "lamda=5000*10**-8             #wavelength of light in cm\n",

      "eplusd=1/5000.0      # in cm\n",

      "theta=math.degrees(math.asin(n*lamda/(eplusd)))\n",

      "minu=(theta-int(theta))*60 # minute\n",

      "print \"angle of diffraction for maximum intensity in the first order is theta=\",int(theta),\"degree\",round(minu),\"minutes\" \n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "angle of diffraction for maximum intensity in the first order is theta= 14 degree 29.0 minutes\n"

       ]

      }

     ],

     "prompt_number": 21

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.18:pg-115"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate number of lines in one centimeter of the grating\n",

      "#let E=(e+d)\n",

      "#formula for grating equation for principal maxima is (e+d)*sin theta=n*lamda\n",

      "n=2 #order of spectrum\n",

      "lamda=5*10**-5 #wavelength in cm\n",

      "E=n*lamda/math.sin(math.pi/6)\n",

      "number=1/E\n",

      "print \"number of lines is number=\",number,\"unitless\"\n",

      "#answer is given wrong in the book ,number of lines=1000\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "number of lines is number= 5000.0 unitless\n"

       ]

      }

     ],

     "prompt_number": 23

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.19:pg-115"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate which spectral line in 5th order will overlap with 4th order line of 5890 angstrom\n",

      "#the grating equation for principal maxima is (e+d)*sin theta =n*lamda\n",

      "n1=5 \n",

      "                #order of spectrum \n",

      "n2=4\n",

      "lamda2=5890*10**-8 #wavelength of 4th order spectrum in cm\n",

      "#(e+d)*sin theta=5*lamda-------------eq(1)\n",

      "#(e+d)*sin theta=4*5890*10**-8-----------------eq(2)\n",

      "#from eq(1) and eq(2) ,we get\n",

      "lamda1=n2*lamda2/n1\n",

      "print \"wavelength of 5th order spectrum is lamda1=\",lamda1,\"cm\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "wavelength of 5th order spectrum is lamda1= 4.712e-05 cm\n"

       ]

      }

     ],

     "prompt_number": 24

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.20:pg-115"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate grating element\n",

      "#grating equation for principal maxima is given by (e+d)*sintheta=n*lamda\n",

      "#let nth order spectrum for yellow line (lamda=6000 angstrom) coincide with (n+1)th order spectrum for blue line (lamda=4800 angstrom) \n",

      "#(e+d)*sintheta=n*6000*10**-8..eq(1)\n",

      "#(e+d)*sintheta=(n+1)*4800*10**-8.....eq(2)\n",

      "#from eq(1) and eq(2),we get n=4\n",

      "n=4\n",

      "lamda=6000*10**-8      #wavelength in cm\n",

      "sintheta=3.0/4   \n",

      "eplusd=n*lamda/sintheta\n",

      "print \"grating element is eplusd=\",eplusd,\"cm\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "grating element is eplusd= 0.00032 cm\n"

       ]

      }

     ],

     "prompt_number": 26

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.21:pg-116"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate angle of diffraction for third order spectrum and absent spectra if any\n",

      "n=3\n",

      "lamda=6000*10**-8\n",

      "eplusd=1/200.0\n",

      "theta=math.degrees(math.asin(n*lamda/eplusd))\n",

      "minu=(theta-int(theta))*60 # minute\n",

      "print \"angle of refraction is theta=\",int(theta),\"degree\",round(minu),\"minutes\"\n",

      "d=0.0025\n",

      "e=eplusd-d #width of wire in cm\n",

      "m=1\n",

      "n=eplusd*m/e\n",

      "print \"order of absent spectrum is n=\",n,\"unitless\"\n",

      "print \"here,m=1 is considered because the higher values of m result the order of absent spectrum more than the given order 3\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "angle of refraction is theta= 2 degree 4.0 minutes\n",

        "order of absent spectrum is n= 2.0 unitless\n",

        "here,m=1 is considered because the higher values of m result the order of absent spectrum more than the given order 3\n"

       ]

      }

     ],

     "prompt_number": 24

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.22:pg-116"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate difference in the two wavelengths\n",

      "#grating equation for principal maxima is (e+d)*sintheta=n*lamda...............eq(1)\n",

      "#differentiate both sides ,we get dtheta=n*dlamda/((e+d)*costheta)...........eq(2)\n",

      "lamda=5000           #mean value of wavelengths in angstrom\n",

      "cottheta=1.732       #cot30degree=1.732\n",

      "dtheta=0.01 #in radian\n",

      "#put the value of n from eq(2),we can write eq(2)  \n",

      "dlamda=lamda*dtheta*cottheta\n",

      "print \"difference in two wavelengths is dlamda=\",dlamda,\"angstrom\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "difference in two wavelengths is dlamda= 86.6 angstrom\n"

       ]

      }

     ],

     "prompt_number": 2

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.23:pg-117"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate dispersive power \n",

      "#differentiate grating equation ,we get dtheta/dlamda=n/((e+d)*costheta)\n",

      "n=2 #order \n",

      "eplusd=1/4000.0\n",

      "lamda=5000.0*10**-8 #wavelength in cm\n",

      "sintheta=n*lamda/(eplusd)\n",

      "costheta=math.sqrt(1-(sintheta)**2)\n",

      "dtheta=n/((eplusd)*costheta)   #where dispersive power dtheta/dlamda=dtheta\n",

      "print \"dispersive power of  grating in the second order spectrum is dtheta=\",int(dtheta),\"unitless\"\n",

      "\n",

      "# answer is slightly different due to approximation\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "dispersive power of  grating in the second order spectrum is dtheta= 8728 unitless\n"

       ]

      }

     ],

     "prompt_number": 27

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.24:pg-117"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate orders\n",

      "eplusd=1/4000.0\n",

      "lamda1=5*10.0**-5 #wavelengh in cm\n",

      "lamda2=7.5*10**-5\n",

      "nmax1=eplusd/lamda1\n",

      "nmax2=eplusd/lamda2\n",

      "print \"orders will be observed by a grating ,if it is illuminated by light of wavelength of 5000 angstrom is nmax1=\",nmax1,\"unitless \"\n",

      "print \"orders will be observed ,if it is illuminated by light of wavelength of 7500 angstrom is nmax2=\",round(nmax2,1),\"unitless\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "orders will be observed by a grating ,if it is illuminated by light of wavelength of 5000 angstrom is nmax1= 5.0 unitless \n",

        "orders will be observed ,if it is illuminated by light of wavelength of 7500 angstrom is nmax2= 3.3 unitless\n"

       ]

      }

     ],

     "prompt_number": 30

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.25:pg-118"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate difference in wavelengths of two lines\n",

      "#let E=(e+d)=1/5000\n",

      "#we get\n",

      "E=2*10**-4 #in cm\n",

      "n=2 #order of spectrum\n",

      "lamda=5893*10**-8 #wavelength in cm\n",

      "#dtheta=2.5'=(2.5/60)*(3.14/180),we get\n",

      "dtheta=7.27*10**-4 #in radian\n",

      "dlamda=math.sqrt(((E/n)**2)-lamda**2)*dtheta\n",

      "print \"the difference in wavelengths of two lines is dlamda=\",dlamda,\"cm\" \n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "the difference in wavelengths of two lines is dlamda= 5.87353693335e-08 cm\n"

       ]

      }

     ],

     "prompt_number": 5

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.26:pg-123"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate aperture of the objective of a telescope\n",

      "lamda=6*10**-5 #wavelength of light in cm\n",

      "dtheta=4.88*10**-6 # in radians\n",

      "a=1.22*lamda/dtheta\n",

      "print \"the aperture of the objective of a telescope is a=\",a,\"cm\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "the aperture of the objective of a telescope is a= 15.0 cm\n"

       ]

      }

     ],

     "prompt_number": 6

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.27:pg-123"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate separation of two points on the moon\n",

      "lamda=5.5*10**-5 #wavelength of light in cm\n",

      "a=500 #diameter in cm\n",

      "dtheta=1.22*lamda/a #limit of resolution of telescope in radians\n",

      "R=3.8*10**8 #distance between earth and moon in m\n",

      "X=R*dtheta\n",

      "print \"the separation of two points on the moon is X=\",X,\"m\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "the separation of two points on the moon is X= 50.996 m\n"

       ]

      }

     ],

     "prompt_number": 7

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.28:pg-124"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate numerical aperture of the objective\n",

      "lamda=5.461*10**-5 #wavelength in cm\n",

      "S=5.55*10**-5 #distance in cm\n",

      "NA=1.22*lamda/(2*S)\n",

      "print \"the numerical aperture of the objective is NA=\",NA,\"unitless\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "the numerical aperture of the objective is NA= 0.600218018018 unitless\n"

       ]

      }

     ],

     "prompt_number": 8

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.29:pg-124"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate resolving power of microscope\n",

      "NA=0.12 #numerical aperture\n",

      "lamda=6*10**-5 #wavelength of light in cm\n",

      "RP=2*NA/lamda #RP=resolving power\n",

      "print \"the resolving power of microscope is RP=\",RP,\"unitless\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "the resolving power of microscope is RP= 4000.0 unitless\n"

       ]

      }

     ],

     "prompt_number": 9

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.30:pg-124"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate maximum resolving power\n",

      "lamda=5*10**-5 #wavelength of light in cm\n",

      "N=40000 #total number of lines on grating\n",

      "#(e+d)=12.5*10**-5 cm\n",

      "#formula is nmax=(e+d)/lamda\n",

      "#we get\n",

      "nmax=2 #order of spectrum\n",

      "RP=nmax*N #RP=resolving power\n",

      "print \"the maximum resolving power is RP=\",RP,\"unitless\" \n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "the maximum resolving power is RP= 80000 unitless\n"

       ]

      }

     ],

     "prompt_number": 10

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.31:pg-124"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate minimum number of lines in a grating\n",

      "lamda1=5890 \n",

      "             #wavelengh in angstrom\n",

      "lamda2=5896\n",

      "dlamda=6 #smallest wavelength difference in angstrom\n",

      "n=2 #order of spectrum \n",

      "lamda=(lamda1+lamda2)/2 #average wavelength in angstrom\n",

      "RP=lamda/dlamda #RP=resolving power\n",

      "N=RP/n\n",

      "print \"minimum number of lines in a grating is N=\",N,\"unitless\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "minimum number of lines in a grating is N= 491 unitless\n"

       ]

      }

     ],

     "prompt_number": 11

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.32:pg-125"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#will the telescope be able to observe the wiremesh\n",

      "a=3 #aperture in cm\n",

      "lamda=5.5*10**-5 #wavelength of light in cm\n",

      "#limit of resolution of telescope is given by\n",

      "theta=1.22*lamda/a\n",

      "#alpha=spacing of wire-mesh/distance of objective from wire-mesh\n",

      "alpha=0.2/(80*10**2)\n",

      "print \"theta=\",theta,\"radian\"\n",

      "print \"alpha=\",alpha,\"radian\"\n",

      "print \"if alpha>theta then telescope will be able to observe the wire-mesh\"\n",

      "#value of alpha is given wrong in the book 2.25*10**-5 radian\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "theta= 2.23666666667e-05 radian\n",

        "alpha= 2.5e-05 radian\n",

        "if alpha>theta then telescope will be able to observe the wire-mesh\n"

       ]

      }

     ],

     "prompt_number": 12

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.33:pg-125"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#distance between the centres of  images of two stars\n",

      "lamda=5500*10**-8         #wavelength of light in cm\n",

      "f=4*10**2              #focal length of telescope objective in cm\n",

      "a=0.01*10**2         #diameter in cm\n",

      "X=1.22*lamda*f/a\n",

      "print \"distance between the centres of images of two stars is X=\",X,\"cm \"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "distance between the centres of images of two stars is X= 0.02684 cm \n"

       ]

      }

     ],

     "prompt_number": 13

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.34:pg-126"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate diameter of a telescope \n",

      "lamda=5.0*10**-5 #wavelength in cm\n",

      "theta=(math.pi/180)*(1.0/1000) #in radians\n",

      "a=1.22*lamda/theta\n",

      "print \"the diameter of a telescope is a=\",a,\"cm\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "the diameter of a telescope is a= 3.4950425503 cm\n"

       ]

      }

     ],

     "prompt_number": 16

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.35:pg-126"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate smallest angle between two stars\n",

      "lamda=5*10**-5 #wavelength in cm\n",

      "a=100*2.54 #diameter in cm\n",

      "theta=1.22*lamda/a\n",

      "print \"the smallest angle between two stars is thita=\",theta,\"radians\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "the smallest angle between two stars is thita= 2.40157480315e-07 radians\n"

       ]

      }

     ],

     "prompt_number": 17

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.36:pg-126"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate limit of resolution of the telescope\n",

      "lamda=5890*10**-8 #wavelength in cm\n",

      "a=1 #diameter in cm\n",

      "theta=1.22*lamda/a\n",

      "print \"the limit of resolution of the telescope is theta=\",theta,\"radians \"\n",

      "\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "the limit of resolution of the telescope is theta= 7.1858e-05 radians \n"

       ]

      }

     ],

     "prompt_number": 21

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.37:pg-126"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate resolving limit of microscope\n",

      "lamda=5.5*10**-5 #wavelengh in cm\n",

      "theta=math.pi/6 #in radians\n",

      "s=1.22*lamda/(2*math.sin(math.pi/6))\n",

      "print \"resolving limit of microscope is s=\",s,\"cm\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "resolving limit of microscope is s= 6.71e-05 cm\n"

       ]

      }

     ],

     "prompt_number": 20

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.38:pg-127"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate resolving power of grating \n",

      "N=15000 #total number of lines on grating\n",

      "lamda=6*10**-5 #wavelength in cm\n",

      "n=2 #order of spectrum\n",

      "RP=n*N\n",

      "print \"resolving power is RP =\",RP,\"unitless\"\n",

      "#to calculate smallest wavelength difference that can be resolved with a light of wavelength 6000angstrom in the second order\n",

      "dlamda=lamda/(n*N)\n",

      "print \"smallest wavelength difference dlamda=\",dlamda,\"cm\"\n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "resolving power is RP = 30000 unitless\n",

        "smallest wavelength difference dlamda= 2e-09 cm\n"

       ]

      }

     ],

     "prompt_number": 19

    },

    {

     "cell_type": "heading",

     "level": 2,

     "metadata": {},

     "source": [

      "Ex3.39:pg-127"

     ]

    },

    {

     "cell_type": "code",

     "collapsed": false,

     "input": [

      "import math\n",

      "#to calculate resolving power in the second order\n",

      "N=6*10**4 #N=total number of lines on grating\n",

      "n=2 #order of spectrum\n",

      "RP=n*N #RP=resoling power\n",

      "print \"the resolving power is RP=\",RP,\"unitless\"\n",

      "#to calculate smallest wavelength\n",

      "lamda=6000*10**-8 #wavelength in cm\n",

      "n=3 #order of spectrum\n",

      "dlamda=lamda/(n*N)\n",

      "print \"smallest wavelength that can be resolved in the third order in 6000angstrom wavelength region is dlamda=\",dlamda,\"cm\" \n"

     ],

     "language": "python",

     "metadata": {},

     "outputs": [

      {

       "output_type": "stream",

       "stream": "stdout",

       "text": [

        "the resolving power is RP= 120000 unitless\n",

        "smallest wavelength that can be resolved in the third order in 6000angstrom wavelength region is dlamda= 3.33333333333e-10 cm\n"

       ]

      }

     ],

     "prompt_number": 18

    }

   ],

   "metadata": {}

  }

 ]

}