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
|
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"the divergence of the beam is 8.05960631817e-05 in radians\n",
"the divergence of the beam is 0.00461781426568 in degrees\n"
]
}
],
"source": [
"'''Example 1.1.1 :Divergence of a beam '''\n",
"\n",
"import math\n",
"\n",
" #decalring variables\n",
"Lambda=633*(10**-9) #wavelength of laser\n",
"s=10*10**-3 #spot size of the laser\n",
"w=s/2 # waist radius\n",
"\n",
"#calculations\n",
"\n",
"theta_radians=(4*Lambda)/(math.pi*(2*w))\n",
"num=math.pi*(w)\n",
"theta_degrees=math.degrees(theta_radians)\n",
"\n",
"#results\n",
"print \"the divergence of the beam is\",theta_radians,\"in radians\"\n",
"print \"the divergence of the beam is\",theta_degrees,\"in degrees\"\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Materials EpsilonR squareroot(EpsilonR)\n",
"\n",
"------------------------------------------\n",
"\n",
"silicon \t11.9 \t3.44963766213 \n",
"\n",
"Diamond \t5.7 \t2.38746727726 \n",
"\n",
"GaAs \t13.1 \t3.61939221417 \n",
"\n",
"SiO2 \t3.84 \t1.95959179423 \n",
"\n",
"Water \t80 \t8.94427191 \n",
"\n"
]
}
],
"source": [
"'''Example 1.2.1: relative permittivity and refractive index n'''\n",
"\n",
"\n",
"import math\n",
"\n",
"numbers=[0,1,2,3,4]\n",
"\n",
"#declaring array variables\n",
"materials=['silicon','Diamond','GaAs ','SiO2 ','Water '] #declaring the materials\n",
"relative_permittivity=[11.9,5.7,13.1,3.84,80] #declaring the relative permittivity at low frequencies\n",
"\n",
"#calculations\n",
"refractive_index=[] #declaring result set \n",
"for i in relative_permittivity:\n",
" t=math.sqrt(i)\n",
" refractive_index.append(t)\n",
" \n",
"#Results and Table\n",
"print \"Materials EpsilonR squareroot(EpsilonR)\\n\"\n",
"print \"------------------------------------------\\n\"\n",
"for j in numbers:\n",
" print materials[j],\"\\t\",relative_permittivity[j],\"\\t\",refractive_index[j],\"\\n\""
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The phase velocity is 206896551.724\n",
"The group velocity is 205479452.055\n"
]
}
],
"source": [
"'''Example 1.3.2:Group and phase velocities'''\n",
"\n",
"import math\n",
"\n",
"#declaring variables\n",
"Lambda=1*10**-6 #wavelength of light\n",
"n=1.450 #refractive index\n",
"c=3*10**8 #velocity of light in free space\n",
"group_index=1.46 #Group index(available from graph)\n",
"\n",
"#calculations\n",
"phase_velocity=c/n #calculation of phase velocity\n",
"group_velocity=c/group_index #calculation of group velocity\n",
"\n",
"#results\n",
"\n",
"print \"The phase velocity is \",phase_velocity\n",
"print \"The group velocity is \",group_velocity"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The Elctric field and Magnetic field of air are 86.7926073205 and 2.89308691068e-07 respectively\n",
"The Elctric field and Magnetic field of glass are 72.0773372269 and 3.48373796597e-07 respectively\n"
]
}
],
"source": [
"'''Example 1.4.1: Electric and magnetic fields in light'''\n",
"\n",
"import math\n",
"\n",
"#Declaring variables\n",
"Irradiance=1*10**-3*10**4 #Declaring irradiance in standard units\n",
"ng=1.45 #declaring refractive index of glass\n",
"c=3*10**8 #declaring velocity of light\n",
"n=1 #Refractive index of free space\n",
"e=8.85*10**-12\n",
"\n",
"#calculations of magnitude of electrical and magnetic fields in air\n",
"El_air=math.sqrt((2*Irradiance)/(c*e*n)) #Electric field calculation(air)\n",
"B_air=(n*El_air)/c #Magnetic field calculation(air)\n",
"\n",
"#calculations of magnitude of electrical and magnetic fields in glass\n",
"El_glass=math.sqrt((2*Irradiance)/(c*e*ng)) #Electric field calculation(glass) \n",
"B_glass=(ng*El_glass)/c #magnetic field calculation(glass) \n",
"\n",
"#Results\n",
"print \"The Elctric field and Magnetic field of air are \",El_air,\"and\",B_air,\"respectively\"\n",
"print \"The Elctric field and Magnetic field of glass are \",El_glass,\"and\",B_glass,\"respectively\""
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"A\n",
"the crirical angle is equal to 0.986206896552 \n",
"\n",
"B\n",
"The phase change in medium 1 at incident angle=85 degrees with electrical component perpendicular to the plane of incidence is 116.45255621 degrees\n",
"The phase change in medium 1 at incident angle=85 degrees with electrical component parallel to the plane of incidence is -62.1314255434 degrees\n",
"The phase change in medium 1 at incident angle=90 degrees with electrical component perpendicular to the plane of incidence is 180.0 degrees\n",
"The phase change in medium 1 at incident angle=90 degrees with electrical component parallel to the plane of incidence is -2.84217094304e-14 degrees \n",
"\n",
"C\n",
"The penetration depth of medium 2 at incident angle of 85 degrees is 7.80048054638e-07 meters\n",
"The penetration depth of medium 2 at incident angle of 90 degrees is 6.63145596216e-07 meters\n"
]
}
],
"source": [
"'''Example 1.6.2'''\n",
"import math\n",
"\n",
"#declaration of variables\n",
"\n",
"n1=1.450 #refractive index of first medium\n",
"n2=1.430 #refractive index of second medium\n",
"Lambda=1*10**-6 #wavelength of light at standard units\n",
"theta_i1=85 #declaration of incidence angle 1\n",
"theta_i2=90 #declaration of incidence angle 2\n",
"\n",
"#Calculation of minimum incidence angle\n",
"theta_c=n2/n1 #calculation of critical angle\n",
"\n",
"#Calculation of phase change in medium 1 at incident angle 85 with perpendicular electrical component\n",
"tanphi_pp_85m1=math.sqrt(math.pow(math.sin(math.radians(theta_i1)),2)-math.pow((n2/n1),2))/math.cos(math.radians(theta_i1))\n",
"phi_pp_85im1=2*math.degrees(math.atan(tanphi_pp_85m1))\n",
"\n",
"#Calculation of phase change in medium 1 at incident angle 85 with parallel electrical component\n",
"tanphi_prll_85m1=math.pow((n1/n2),2)*tanphi_pp_85m1\n",
"phi_prll_85m1=2*(math.degrees(math.atan(tanphi_prll_85m1)))-math.degrees(math.pi)\n",
"phi_prll_inv_85m1=180+phi_prll_85m1\n",
"\n",
"#Calculation of phase change in medium 1 at incident angle 90 with perpendicular electrical component\n",
"tanphi_pp_90m1=math.sqrt(math.pow(math.sin(math.radians(theta_i2)),2)-math.pow((n2/n1),2))/math.cos(math.radians(theta_i2))\n",
"phi_pp_90m1=2*math.degrees(math.atan(tanphi_pp_90m1))\n",
"\n",
"#Calculation of phase change in medium 1 at incident angle 85 with parallel electrical component\n",
"tanphi_prll_90m1=math.pow((n1/n2),2)*tanphi_pp_90m1\n",
"phi_prll_90m1=2*(math.degrees(math.atan(tanphi_prll_90m1)))-math.degrees(math.pi)\n",
"phi_prll_inv_90m1=180+phi_prll_90m1\n",
"\n",
"#Calculation of penetration depth in medium 2 at incident angle 85\n",
"alpha_85=(2*math.pi*n2/Lambda)*(math.sqrt((math.pow((n1/n2),2)*math.pow(math.sin(math.radians(theta_i1)),2))-1))\n",
"delta_85=1/alpha_85\n",
"\n",
"#calculation of penetration depth in medium 2 at incident angle 90\n",
"alpha_90=(2*math.pi*n2/Lambda)*(math.sqrt((math.pow((n1/n2),2)*math.pow(math.sin(math.radians(theta_i2)),2))-1))\n",
"delta_90=1/alpha_90\n",
"\n",
"#Results\n",
"print \"A\"\n",
"print \"the crirical angle is equal to \",theta_c,\"\\n\"\n",
"print \"B\"\n",
"print \"The phase change in medium 1 at incident angle=85 degrees with electrical component perpendicular to the plane of incidence is\",phi_pp_85im1,\"degrees\"\n",
"print \"The phase change in medium 1 at incident angle=85 degrees with electrical component parallel to the plane of incidence is\",phi_prll_85m1,\"degrees\"\n",
"print \"The phase change in medium 1 at incident angle=90 degrees with electrical component perpendicular to the plane of incidence is\",phi_pp_90m1,\"degrees\"\n",
"print \"The phase change in medium 1 at incident angle=90 degrees with electrical component parallel to the plane of incidence is\",phi_prll_90m1,\"degrees \\n\"\n",
"print \"C\"\n",
"print \"The penetration depth of medium 2 at incident angle of 85 degrees is \",delta_85,\"meters\"\n",
"print \"The penetration depth of medium 2 at incident angle of 90 degrees is \",delta_90,\"meters\""
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"A\n",
"the reflection coefficient when light travels from air to glass is -0.2\n",
"the reflectance when light passes from air to glass is 0.04\n",
"The phase change of the reflected light is \n",
"180\n",
"B\n",
"the reflection coefficient when light travels from glass to air is 0.2\n",
"the reflectance when light passes from glass to air is 0.04\n",
"The phase change of the reflected light is \n",
"180\n",
"C\n",
"The polarisation angle is 56.309932474\n"
]
}
],
"source": [
"'''Example 1.6.3: Reflection at normal Incidence.Internal and external reflection'''\n",
"import math\n",
"\n",
"#declaration of variables\n",
"nglass=1.5\n",
"nair=1\n",
"\n",
"#declaration of phase change\n",
"def phasechange(r):\n",
" if r<0:\n",
" return 180\n",
" else:\n",
" return 0 \n",
"#Calculation of reflection coefficient and intensity from air to glass\n",
"r_coeffag=(nair-nglass)/(nair+nglass) #reflection coefficient\n",
"Rag=math.pow(r_coeffag,2) #Reflectance\n",
"pag=phasechange(r_coeffag)\n",
"\n",
"\n",
"#Calculation of relection and intensity from glass to aie\n",
"r_coeffga=(nglass-nair)/(nglass+nair)\n",
"Rga=math.pow(r_coeffga,2)\n",
"pga=phasechange(r_coeffga)\n",
"\n",
"#calculation of polarisation angle\n",
"theta_p=math.degrees(math.atan(nglass/nair))\n",
"\n",
"#Results\n",
"print \"A\"\n",
"print\"the reflection coefficient when light travels from air to glass is \",r_coeffag\n",
"print \"the reflectance when light passes from air to glass is \",Rag\n",
"print \"The phase change of the reflected light is \\n\",pag\n",
"print \"B\"\n",
"print\"the reflection coefficient when light travels from glass to air is \",r_coeffga\n",
"print \"the reflectance when light passes from glass to air is \",Rga\n",
"print \"The phase change of the reflected light is \\n\",pag\n",
"\n",
"print \"C\"\n",
"print \"The polarisation angle is \",theta_p"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"the reflectance of the Silicon is 0.308641975309\n",
"the refractive index of coating must be 1.87082869339\n",
"the thickness of the coating is 9.21052631579e-08 meters\n"
]
}
],
"source": [
"'''Example 1.6.4: Antireflection coatings on solarcells'''\n",
"import math\n",
"\n",
"#Declaration of variables\n",
"nair=1\n",
"nsi=3.5\n",
"ncoating=1.9\n",
"Lambda=700*10**-9\n",
"\n",
"#declaration of phase change\n",
"def phasechange(r):\n",
" if r<0:\n",
" return 180\n",
" else:\n",
" return 0 \n",
"\n",
"#Calculation of reflectance at Silicon\n",
"rsi=((nair-nsi)/(nair+nsi))\n",
"Rsi=math.pow(rsi,2)\n",
"psi=phasechange(rsi)\n",
"\n",
"#calculation of refractive index of coating\n",
"ncoating_theoritical=math.sqrt(nair*nsi)\n",
"\n",
"#calculation of thickness\n",
"d=Lambda/(4*ncoating)\n",
"\n",
"#results\n",
"print \"the reflectance of the Silicon is \",Rsi\n",
"print \"the refractive index of coating must be \",ncoating_theoritical\n",
"print \"the thickness of the coating is \",d,\" meters\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# '''Example 1.7.1: Resonator modes and spectral width'''\n",
"import math\n",
"\n",
"#declaration of variables\n",
"L=100*10**-6\n",
"R=0.9\n",
"Lambda=900*10**-9\n",
"c=3*10**8\n",
"\n",
"#Calculation of seperation of modes\n",
"delta_vm=c/(2*L)\n",
"\n",
"#calculation of finesse\n",
"F=((math.pi)*math.sqrt(R))/(1-R)\n",
"\n",
"#calculation of modewidth\n",
"del_vm=delta_vm/F\n",
"\n",
"#calculation of mode frequency\n",
"vm=c/Lambda\n",
"\n",
"#calculation of spectral width\n",
"del_lambda=(c/math.pow(vm,2))*del_vm\n",
"\n",
"#Results\n",
"print \"The seperation of modes is \",delta_vm,\" Hertz\"\n",
"print \"The spectral width is\", del_lambda,\" meters\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"celltoolbar": "Edit 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
}
|