summaryrefslogtreecommitdiff
path: root/sample_notebooks/AviralYadav/Chapter1.ipynb
diff options
context:
space:
mode:
authorTrupti Kini2016-04-29 23:30:26 +0600
committerTrupti Kini2016-04-29 23:30:26 +0600
commit6f4ba5774ed840adcc21661885ea1a6dbc7554bf (patch)
tree3865652e03d917f5f97315c90c215ea74662fba9 /sample_notebooks/AviralYadav/Chapter1.ipynb
parent7d9639140a31ad541662f686cf8c0b339a33be49 (diff)
downloadPython-Textbook-Companions-6f4ba5774ed840adcc21661885ea1a6dbc7554bf.tar.gz
Python-Textbook-Companions-6f4ba5774ed840adcc21661885ea1a6dbc7554bf.tar.bz2
Python-Textbook-Companions-6f4ba5774ed840adcc21661885ea1a6dbc7554bf.zip
Added(A)/Deleted(D) following books
A sample_notebooks/AviralYadav/Chapter1.ipynb A sample_notebooks/ChandraShiva/CHAPTER1.ipynb A sample_notebooks/VidyaSri/CHAPTER01.ipynb A testing_by_test/screenshots/screenshot6.png A testing_by_test/screenshots/screenshot6_1.png A testing_by_test/screenshots/screenshot6_2.png A testing_by_test/screenshots/screenshot6_3.png A testing_by_test/screenshots/screenshot6_4.png A testing_by_test/screenshots/screenshot6_5.png A testing_by_test/vivek.ipynb A testing_by_test/vivek_1.ipynb
Diffstat (limited to 'sample_notebooks/AviralYadav/Chapter1.ipynb')
-rw-r--r--sample_notebooks/AviralYadav/Chapter1.ipynb211
1 files changed, 211 insertions, 0 deletions
diff --git a/sample_notebooks/AviralYadav/Chapter1.ipynb b/sample_notebooks/AviralYadav/Chapter1.ipynb
new file mode 100644
index 00000000..1a020ecb
--- /dev/null
+++ b/sample_notebooks/AviralYadav/Chapter1.ipynb
@@ -0,0 +1,211 @@
+{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:9d65d2e4b3b26b2a3e4a4d31118d76195de2fbfee6ec541d4c7103cd8e8236f5"
+ },
+ "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
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file