diff options
author | Trupti Kini | 2016-05-31 23:30:26 +0600 |
---|---|---|
committer | Trupti Kini | 2016-05-31 23:30:26 +0600 |
commit | dfe37e794e1b33b0404d411cd96a0a734c25aedd (patch) | |
tree | 09926d84ad5fc460a280af99a9c6ce79cd576861 | |
parent | 337ea846a78fea16a0027b291b79b9da6ef93eb3 (diff) | |
download | Python-Textbook-Companions-dfe37e794e1b33b0404d411cd96a0a734c25aedd.tar.gz Python-Textbook-Companions-dfe37e794e1b33b0404d411cd96a0a734c25aedd.tar.bz2 Python-Textbook-Companions-dfe37e794e1b33b0404d411cd96a0a734c25aedd.zip |
Added(A)/Deleted(D) following books
A sample_notebooks/PanshulRaghav/Chapter1.ipynb
-rw-r--r-- | sample_notebooks/PanshulRaghav/Chapter1.ipynb | 219 |
1 files changed, 219 insertions, 0 deletions
diff --git a/sample_notebooks/PanshulRaghav/Chapter1.ipynb b/sample_notebooks/PanshulRaghav/Chapter1.ipynb new file mode 100644 index 00000000..6f169260 --- /dev/null +++ b/sample_notebooks/PanshulRaghav/Chapter1.ipynb @@ -0,0 +1,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": {}
+ }
+ ]
+}
\ No newline at end of file |