summaryrefslogtreecommitdiff
path: root/sample_notebooks/mokshagunda/Chapter_2_DIFFRACTION.ipynb
blob: 9af6a7434be6ce501b2512db06a62b0efde7aa81 (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 2 DIFFRACTION"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2_1 pg.no:29"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "No of lines per centimeter is 5000\n"
     ]
    }
   ],
   "source": [
    "#To calculate the no of lines in one cm of grating surface\n",
    "from math import pi,sin\n",
    "k=2.\n",
    "lamda=5*10**-5 #units in cm\n",
    "theta=30 # units in degrees\n",
    "#We have nooflines=1/e=(k∗lamda)/sin(theta)\n",
    "nooflines=sin(theta*pi/180)/(k*lamda) #units in cm\n",
    "print \"No of lines per centimeter is %.f\"%nooflines\n",
    "#In text book the answer is printed wrong as 10ˆ3\n",
    "#The correct answer is 5∗10ˆ3"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2_2 pg.no:30"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "For First order spectra theta1=17.5 degrees\n",
      "For Third order spectra theta3=64.2 degrees\n",
      "Difference in Angles of deviation in first and third order spectra is theta3−theta1=46.70 degrees\n"
     ]
    }
   ],
   "source": [
    "#To Find the difference in angles of deviation in first and third order spectra\n",
    "from math import pi,asin\n",
    "lamda=5000. # units in armstrongs\n",
    "lamda=lamda*10**-8 # units in cm\n",
    "e=1./6000.\n",
    "#For first order e∗sin(theta1)=1∗lamda\n",
    "theta1=asin(lamda/e) # units in radians\n",
    "theta1=theta1*180./pi # units in degrees\n",
    "print \"For First order spectra theta1=%.1f degrees\"%theta1\n",
    "#For third order e∗sin(theta3)=3∗lamda\n",
    "theta3=asin(3.*lamda/e) # units in radians\n",
    "theta3=theta3*180/pi # units in degrees\n",
    "print \"For Third order spectra theta3=%.1f degrees\"%theta3\n",
    "diffe=theta3-theta1 #units in degrees\n",
    "print \"Difference in Angles of deviation in first and third order spectra is theta3−theta1=%.2f degrees\"%diffe"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2_3 pg.no:30"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false,
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "No of lines per cm=196.0 \n"
     ]
    }
   ],
   "source": [
    "#To calculate minimum no of lines per centimeter\n",
    "lamda1=5890 # units in armstrongs\n",
    "lamda2=5896 # units in armstrongs\n",
    "dlamda=lamda2-lamda1 #units in armstrongs\n",
    "k=2\n",
    "n=lamda1/(k*dlamda)\n",
    "width=2.5 #units in cm\n",
    "nooflines=n/width\n",
    "print \"No of lines per cm=%.1f \"%nooflines"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2_4 pg.no:31"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "As total no of lines required for resolution in first order is 981 and total no of lines in grating is 850 the lines will not be resolved in first order\n",
      "As total no of lines required for resolution in first order is 490 and total no of lines in grating is 850 the lines will be resolved in second order\n"
     ]
    }
   ],
   "source": [
    "#To examine two spectral lines are clearly resolved in first order and second order\n",
    "n=425.\n",
    "tno=2.*n\n",
    "lamda1=5890 # units in armstrongs\n",
    "lamda2=5896 # units in armstrongs\n",
    "dlamda=lamda2 -lamda1\n",
    "#For first order\n",
    "n=lamda1/dlamda\n",
    "print\"As total no of lines required for resolution in first order is %.f and total no of lines in grating is %d the lines will not be resolved in first order\"%(n,tno)\n",
    "#For second order\n",
    "n=lamda1/(2*dlamda)\n",
    "print\"As total no of lines required for resolution in first order is %.f and total no of lines in grating is %d the lines will be resolved in second order\"%(n,tno)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2_5 pg.no:32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Angle of separation is 16 minutes\n"
     ]
    }
   ],
   "source": [
    "#To find the angle of separation\n",
    "from math import asin,pi\n",
    "\n",
    "lamda1=5016.  # units in armstrongs\n",
    "lamda2=5048.  # units in armstrongs\n",
    "lamda1=lamda1*10**-8   # units in cm\n",
    "lamda2=lamda2*10**-8   # units in cm\n",
    "k=2.\n",
    "n=15000\n",
    "e=2.54/n     # units in cm \n",
    "theta1=asin((2*lamda1)/e)*(180/pi)    # units in in degrees\n",
    "theta2=asin((2*lamda2)/e)*(180/pi)  # units in in degrees\n",
    "diffe=theta2-theta1 # units in in degrees\n",
    "diffe=diffe*60 # units in minutes\n",
    "print \"Angle of separation is %.f minutes\"%diffe"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2_6 pg.no:32"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The dispersive power of the grating is 15000\n"
     ]
    }
   ],
   "source": [
    "#To Calculate the dispersive power of the grating\n",
    "from math import pi,asin,cos\n",
    "n=4000.\n",
    "e=1/n #units in cm\n",
    "k=3.\n",
    "lamda=5000 # units in armstrongs\n",
    "lamda=lamda*10**-8 # units in cm\n",
    "theta=asin((k*lamda)/e)*(180/pi) # units in degrees\n",
    "costheta=cos(theta*pi/180)\n",
    "disppower=(k*n)/costheta\n",
    "print \"The dispersive power of the grating is %.f\"%disppower"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2_7 pg.no:33"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The highest order spectrum Seen with monochromatic light is 3.33\n"
     ]
    }
   ],
   "source": [
    "#To Calculate highest power of spectrum seen with mono chromaic light\n",
    "lamda=6000.    # units in armstrongs\n",
    "lamda=lamda*10**-8   #units in cm\n",
    "n=5000.\n",
    "e=1/n #units in cm\n",
    "k=e/lamda\n",
    "print \"The highest order spectrum Seen with monochromatic light is %.2f\"%k"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2_8 pg.no:35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Wavelength of the lines is 0.0000606 cms\n",
      "Minimum grating width required is 4.2 cm \n"
     ]
    }
   ],
   "source": [
    "#To calculate the wavelength\n",
    "from math import pi,sin\n",
    "k=2.\n",
    "theta1=10.\n",
    "dtheta=3.\n",
    "dlamda=5*10**-9\n",
    "lamda=(sin((theta1*pi)/180)*dlamda*60*60)/(cos((theta1*pi)/180)*dtheta*(pi/180)) # units in cm\n",
    "print \"Wavelength of the lines is %.7f cms\"%lamda\n",
    "lamda_dlamda=lamda+dlamda # units in cm\n",
    "N=6063\n",
    "Ne=(N*k*lamda)/sin((theta1*pi)/180) # units in cm\n",
    "print \"Minimum grating width required is %.1f cm \"%Ne"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 2_9 pg.no:35"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Resolving power is 10000 \n"
     ]
    }
   ],
   "source": [
    "#To calculate resolving power in second order\n",
    "#We have e∗sin(theta)=k∗lamda\n",
    "#We have e∗0.2=k∗lamda −>1\n",
    "#And e∗0.3=(k+1)∗lamda −>2\n",
    "#Subtracting one and two 3∗0.1=lamda\n",
    "lamda=5000. # units in armstrongs\n",
    "lamda=lamda*10**-8 # units in cm\n",
    "e=lamda/0.1 # units in cm\n",
    "width=2.5 #units in cm\n",
    "N=width/e\n",
    "respower=2*N\n",
    "print \"Resolving power is %.f \"%respower"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}