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
|
{
"metadata": {
"name": "",
"signature": "sha256:4f08cfe536912048165948aa8a78d3602da78d460154eb52213ea2da5e5f2029"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 01:Electromagnetics and Optics"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex1.6:pg-25"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"#To find refractive index of of the glass\n",
"import math\n",
"\n",
"# Given data\n",
"phi=0.7297; # Critical angle for glass-air interface\n",
"n2=1; # Refractive index of air\n",
"n1=n2/math.sin(phi); # Refractive index of glass\n",
"\n",
"# Displaying the result in command window\n",
"print \"\\n Refractive index of the glass = \",round(n1,1)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
" Refractive index of the glass = 1.5\n"
]
}
],
"prompt_number": 16
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex1.7:pg-25"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"#To calculate a)the speed of light b) The wavelenght in medium c) The wavenumber in medium\n",
"import math\n",
"\n",
"\n",
"#a)The speed of light\n",
"c=3*10**8; #Speed of light in free space (m/s)\n",
"n=1.45; #Given refractive index of dielectric medium\n",
"v=(c/n); #Speed of light in medium (in m/s)\n",
"\n",
"#Displaying the result in command window\n",
"print\" \\nSpeed of light in medium =\",round(v*10**-8,3),\" X 10^8 m/s',\"\n",
"\n",
"#b) The wavelenght in medium \n",
"f=190*10**12; #Given operating frequency of laser\n",
"lambdam=(v/f); #Wavelenght in medium \n",
"\n",
"#Displaying the result in command window\n",
"print\" \\nWavelenght of laser in medium =\",round(lambdam*10**(6),4),\" micrometer\"\n",
"\n",
"#c) The wavenumber in medium\n",
"k=(2*math.pi)/lambdam; #Wavenumber in medium\n",
"\n",
"#Displaying the result in command window\n",
"print \"\\nWavenumber in medium =\",round(k*10**-6,2),\" X 10^6 m^-1\"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
" \n",
"Speed of light in medium = 2.069 X 10^8 m/s',\n",
" \n",
"Wavelenght of laser in medium = 1.0889 micrometer\n",
"\n",
"Wavenumber in medium = 5.77 X 10^6 m^-1\n"
]
}
],
"prompt_number": 8
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex1.8:pg-26"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"# To calculate a)magnitude of the wave vector of the refracted wave b)x-component and z-component of the wave vector\n",
"\n",
"import math\n",
"#Given data\n",
"n1=1; # Refractive index of air\n",
"n2=1.45; # Refractive index of slap\n",
"theta1=math.pi/3; # Angle of incidence\n",
"lambdam=1.0889*10**(-6); # Wavelength in medium\n",
"theta2=math.asin(math.sin(theta1)/n2); # Angle of refraction\n",
"\n",
"# a)To calculate magnitude of the wave vector of the refracted wave\n",
"k=((2*math.pi)/lambdam); # Wavenumber\n",
"\n",
"# Displaying the result in command window\n",
"print\" Magnitude of the wave vector of the refracted wave is same as wave number =\",round(k*10**(-6),2),\" X 10^6 m^-1\"\n",
"\n",
"# b)To calculate x-component and z-component of the wave vector\n",
"kx=k*math.sin(theta2); # x-component of the wave vector\n",
"kz=k*math.cos(theta2); # z-component of the wave vector\n",
"\n",
"# Displaying the result in command window\n",
"print\"\\n z-component of the wave vector =\",round(kz*10**(-6),2),\" X 10^6 m**-1\"\n",
"print\"\\n x-component of the wave vector = \",round(kx*10**(-6),2),\" X 10^6 m**-1\"\n",
"# The answer is varrying due to round-off error \n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
" Magnitude of the wave vector of the refracted wave is same as wave number = 5.77 X 10^6 m^-1\n",
"\n",
" z-component of the wave vector = 4.63 X 10^6 m**-1\n",
"\n",
" x-component of the wave vector = 3.45 X 10^6 m**-1\n"
]
}
],
"prompt_number": 11
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Ex1.9:pg-30"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#To find length of the medium\n",
"import math\n",
"\n",
"\n",
"bandwidth=100*10**9; #Bandwidth of optical signal\n",
"w=2*math.pi*bandwidth; #Bandwidth of optical signal in rad/s\n",
"T=3.14*10**(-12); #Delay between minimum and maximum frequency component\n",
"beta2=10*(10**(-12))**2/10.0**3; #Group velocity dispersion parameter in s^2/km\n",
"L=T/(beta2*w); #Length of the medium\n",
"\n",
"# Displaying the result in command window\n",
"print\" Length of the medium =\",round(L),\" m\"\n",
"\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
" Length of the medium = 500.0 m\n"
]
}
],
"prompt_number": 15
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
|