diff options
author | Trupti Kini | 2016-06-06 23:30:28 +0600 |
---|---|---|
committer | Trupti Kini | 2016-06-06 23:30:28 +0600 |
commit | 3e519af61055cae6fc9ad9e48f74b21517cb197d (patch) | |
tree | 5ad97fe5765c73cd98a110775f94bfd3b3ef71a9 | |
parent | 2a956937627210193e82c461ed15ec9a52501fae (diff) | |
download | Python-Textbook-Companions-3e519af61055cae6fc9ad9e48f74b21517cb197d.tar.gz Python-Textbook-Companions-3e519af61055cae6fc9ad9e48f74b21517cb197d.tar.bz2 Python-Textbook-Companions-3e519af61055cae6fc9ad9e48f74b21517cb197d.zip |
Added(A)/Deleted(D) following books
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter1.ipynb
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter10.ipynb
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter11.ipynb
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter2.ipynb
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter3.ipynb
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter4.ipynb
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter5.ipynb
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter6.ipynb
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter7.ipynb
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter8.ipynb
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter9.ipynb
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/screenshots/2.3.png
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/screenshots/6.5.png
A Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/screenshots/8.3.png
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER01_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER02_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER03_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER04_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER05_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER07_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER08_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER09_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER10_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER11_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER12_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER14_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER16_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER18_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER19_2.ipynb
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./screenshots/Screenshot02_2.png
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./screenshots/Screenshot04_2.png
A Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./screenshots/Screenshot08_2.png
A "sample_notebooks/Vaibhav Vajani/chapter2_1.ipynb"
33 files changed, 10522 insertions, 0 deletions
diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter1.ipynb b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter1.ipynb new file mode 100644 index 00000000..1a020ecb --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/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 diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter10.ipynb b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter10.ipynb new file mode 100644 index 00000000..557fd94d --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter10.ipynb @@ -0,0 +1,520 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:548749b294c3543248c0308266af6344c73aa3ce58b49da998641e9460080a45"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 10:Nonlinear Effects in Fibers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex10.1:pg-429"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 10.1\n",
+ "# Calculation of the non linear coeffifient.\n",
+ "# Page no 429\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "n2=2.5*10**-20; # Kerr coefficient\n",
+ "lambdaa=1550*10**-9; # Wavelength\n",
+ "A=80*10**-12; # Effective area\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Non linear coeffifient\n",
+ "g=(n2*2*math.pi)/(lambdaa*A); \n",
+ "g=g*10**3;\n",
+ "\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n Nonlinear coefficient = \",round(g,3),\" W**-1m**-1 \"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Nonlinear coefficient = 1.267 W**-1m**-1 \n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex10.2:pg-431"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 10.2\n",
+ "# Calculation of the lower limit on the effective area of the fiber.\n",
+ "# Page no 431\n",
+ "\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "#Given data\n",
+ "\n",
+ "c=3*10**8; # Velocity of light\n",
+ "tl=1000*10**3; # Total length\n",
+ "asp=100*10**3; # Amplifier spacing\n",
+ "alpha=0.046*10**-3; # Loss coefficient\n",
+ "L=100*10**3;\n",
+ "n2=2.5*10**-20; # Kerr coefficient\n",
+ "p=0; # Peak power at the fiber input\n",
+ "lambdaa=1550*10**-9; # Operating frequency\n",
+ "\n",
+ "# The peak power required to form a soliton\n",
+ "Le=(1-math.exp(-alpha*L))/alpha;\n",
+ "n=tl/asp;\n",
+ "p=10**(p/10);\n",
+ "r=0.5/(Le*p);\n",
+ "A=(2*math.pi*n2)/(lambdaa*r);\n",
+ "A=A*10**12;\n",
+ "\n",
+ "# Displaying results in the command window \n",
+ "print \"\\n The lower limit on the effective area of the fiber = \",round(A*10**-2,2),\" micrometer**2\"\n",
+ "print \"\\n The effective area should be greater than 43.62 \u00ce\u00bcm2 to have the peak nonlinear phase shift less than or equal to 0.5 rad.\"\n",
+ "\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The lower limit on the effective area of the fiber = 43.62 micrometer**2\n",
+ "\n",
+ " The effective area should be greater than 43.62 \u00ce\u00bcm2 to have the peak nonlinear phase shift less than or equal to 0.5 rad.\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex10.3:pg-435"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 10.3\n",
+ "# Calculation of the peak power required to form a soliton\n",
+ "# Page no 435\n",
+ "\n",
+ "import math\n",
+ "from sympy.mpmath import asech\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "b=-21*10**-27; # FWHM of a fundamental soliton\n",
+ "Tf=50*10**-12; # Fiber dispersion coefficient\n",
+ "r=1.1*10**-3; # Nonlinear coefficient\n",
+ "\n",
+ "# The peak power required to form a soliton\n",
+ "Th=asech(math.sqrt(0.5));\n",
+ "f=2*Th;\n",
+ "T0=Tf/f;\n",
+ "n=(math.sqrt(-b))/T0;\n",
+ "P=(n**2)/r;\n",
+ "#P=P*10**2;\n",
+ "\n",
+ "\n",
+ "# Displaying results in the command window \n",
+ "print \"\\n The peak power required to form a soliton = \",round(P*10**2,1),\" mW\"\n",
+ "\n",
+ "# Answer is wrong in book\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The peak power required to form a soliton = 2.4 mW\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex10.4:pg-444"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 10.4\n",
+ "# Calculation of the peak power required to form a soliton\n",
+ "# Page no 444\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "# Given data\n",
+ "\n",
+ "c=3*10**8; # Velocity of light\n",
+ "S=0.06*10**3; # Dispersion slope\n",
+ "D=17*10**-6; # Dispersion coefficient\n",
+ "lambdaa=1550*10**-9; # Signal Wavelength\n",
+ "lc=1550*10**-9; # Signal Wavelength\n",
+ "lp=1549.6*10**-9; # Pump wavelength\n",
+ "l=50*10**3; # Length\n",
+ "r=2*math.pi*10**10;\n",
+ "alpha=0.046*10**-3; # Loss coefficient\n",
+ "\n",
+ "# The peak power required to form a soliton\n",
+ "b3=S*(lambdaa**2/(2*math.pi*c))+D*(lambdaa**3/(2*math.pi**2*c**2));\n",
+ "b2=-(D*lambdaa**2)/(2*math.pi*c);\n",
+ "o=2*math.pi*(c/lp-c/lc);\n",
+ "d=(b2*o)+(b3*o**2)/2;\n",
+ "n=alpha**2/alpha**2*r*4*d**2*(1+(4*(math.sin(r*d*l))**2*math.e**(-alpha*l))/(1-math.e**(-alpha*l)**2));\n",
+ "n=n*10**-18;\n",
+ "# Displaying results in the command window \n",
+ "print \"\\n XPM efficiency = \",round(n,3),\" *10**-3\"\n",
+ "\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " XPM efficiency = 3.567 *10**-3\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex10.5:pg-453"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 10.5\n",
+ "# Calculate the efficiency of the non-degenerate FWM tone at \u00e2\u02c6\u20192\u00ce\u201df if (a) beta2 = \u00e2\u02c6\u20194ps**2/km, (b) beta2 = 0ps**2/km.\n",
+ "# Page no 453\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "f=50*10**9; # The bandwidth\n",
+ "alpha= 0.046*10**-3; # The fiber loss coefficient\n",
+ "L=40*10**3; # The fiber length\n",
+ "\n",
+ "Leff=(1-math.exp(-(alpha*L)))/alpha; # Effective fiber length\n",
+ "\n",
+ "# (a) Calculate the efficiency of the non-degenerate FWM tone at \u00e2\u02c6\u20192\u00ce\u201df beta2 = \u00e2\u02c6\u20194ps**2/km\n",
+ "bet21=-4*10**(-12);\n",
+ "j=-1;\n",
+ "k=0;\n",
+ "l=1;\n",
+ "n=j+k-l;\n",
+ "\n",
+ "bet1=bet21*10**(-12)/10**(3)*(2*math.pi*f)**2*n;\n",
+ "\n",
+ "#The efficiency of the non-degenerate FWM tone\n",
+ "neta1=(alpha**2+4*math.exp(-alpha*L*10**3)*(math.sin(radians(bet1*(L*10**3)/2))/Leff**2))/(alpha**2+bet1**2)\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The efficiency of the non-degenerate FWM tone at \u00e2\u02c6\u20192\u00ce\u201df (beta2 = \u00e2\u02c6\u20194ps**2/km) = \",round(neta1*10**3,1),\" X 10**(-3) \"\n",
+ "\n",
+ "# (b) Calculate the efficiency of the non-degenerate FWM tone at \u00e2\u02c6\u20192\u00ce\u201df beta2 = 0ps**2/km\n",
+ "bet22=0*10**(-12);\n",
+ "j=-1;\n",
+ "k=0;\n",
+ "l=1;\n",
+ "n=j+k-l;\n",
+ "\n",
+ "bet2=bet22*10**(-12)/10**(3)*(2*math.pi*f)**2*n;\n",
+ "\n",
+ "#The efficiency of the non-degenerate FWM tone\n",
+ "neta2=(alpha**2+4*math.exp(-alpha*L*10**3)*(sin(radians(bet2*(L*10**3)/2))/Leff**2))/(alpha**2+bet2**2);\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n\\n The efficiency of the non-degenerate FWM tone at \u00e2\u02c6\u20192\u00ce\u201df (beta2 = 0ps**2/km) = \",round(neta2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The efficiency of the non-degenerate FWM tone at \u00e2\u02c6\u20192\u00ce\u201df (beta2 = \u00e2\u02c6\u20194ps**2/km) = 3.4 X 10**(-3) \n",
+ "\n",
+ "\n",
+ " The efficiency of the non-degenerate FWM tone at \u00e2\u02c6\u20192\u00ce\u201df (beta2 = 0ps**2/km) = 1.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex10.6:pg-469"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 10.6\n",
+ "# to find the nonlinear phase shift at the center of the pulse. Compare the exact results with those obtained using first and second-order perturbation theory\n",
+ "# Page no 469\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "P=6*10**(-3); # The peak power of rectangular pulse\n",
+ "L=40*10**3; # Fiber of length\n",
+ "Floss=0.2; # The fiber loss (dB/Km)\n",
+ "gamm=1.1*10**(-3);\n",
+ "\n",
+ "alpha=Floss/4.343; # Attenuation coefficient\n",
+ "Zeff=(1-math.exp(-alpha*10**(-3)*L))/alpha*10**3;\n",
+ "\n",
+ "# The nonlinear phase shift at the center of the pulse\n",
+ "phi=gamm*P*Zeff; # Nonlinear phase shift\n",
+ "\n",
+ "#Displaying results in the command window\n",
+ "print \"\\n The nonlinear phase shift at the center of the pulse = \",round(phi,4),\" rad \"\n",
+ "\n",
+ "\n",
+ "# Results using first order\n",
+ "B01=math.sqrt(1+gamm**2*P**2*(Zeff)**2); # Amplitude shift \n",
+ "thet1=math.atan(gamm*P*Zeff); # Non-linear phase shift \n",
+ "\n",
+ "#Displaying results in the command window\n",
+ "print \"\\n\\n Amplitude shift using first order = \",round(B01,3)\n",
+ "print \"\\n Non-linear shift using first order = \",round(thet1,5),\" rad\"\n",
+ "\n",
+ "# Results using second order\n",
+ "x=1-((gamm)**2/2*P**2*Zeff**2);\n",
+ "y=gamm*P*Zeff;\n",
+ "thet2=math.atan(y/x); # Nonlinear phase shift\n",
+ "B02=x/math.cos(thet2); # Amplitude shift\n",
+ "\n",
+ "#Displaying results in the command window\n",
+ "print \"\\n\\n Amplitude shift using second order = \",round(B02,5) # Answer is varying due to round-off error\n",
+ "print \"\\n Non-linear shift using second order = \",round(thet2,5),\" rad\" # Answer is varying due to round-off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The nonlinear phase shift at the center of the pulse = 0.1206 rad \n",
+ "\n",
+ "\n",
+ " Amplitude shift using first order = 1.007\n",
+ "\n",
+ " Non-linear shift using first order = 0.12002 rad\n",
+ "\n",
+ "\n",
+ " Amplitude shift using second order = 1.00003\n",
+ "\n",
+ " Non-linear shift using second order = 0.1209 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 39
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex10.7:pg-477"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 10.7\n",
+ "# Calculation of the variance of (a) linear phase noise, (b) nonlinear phase noise at the receiver\n",
+ "# Page no 477\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "alpha=0.0461; # Loss coeffient\n",
+ "na=20; # No of amplifiers\n",
+ "L=80; # Amplifier spacing\n",
+ "tb=25*10**-12; # Pulse width\n",
+ "P=2*10**-3; # Peak power\n",
+ "c=3*10**8; # Velocity of light\n",
+ "lambdaa=1550*10**-9;\n",
+ "n=1.5; # Spontaneous emission factor\n",
+ "h=6.626*10**-34; # Planck constant\n",
+ "r0=1.1*10**-3; # Nonlinear coefficient\n",
+ "\n",
+ "# a) linear phase noise at the receiver\n",
+ "G=math.exp(alpha*L);\n",
+ "f=c/lambdaa;\n",
+ "R=h*f*(G-1)*n;\n",
+ "E=P*tb;\n",
+ "rl=(na*R)/(2*E);\n",
+ "rl=rl*10**3;\n",
+ "\n",
+ "# (b) nonlinear phase noise at the receiver\n",
+ "Le=(1-math.exp(-alpha*L))/alpha;\n",
+ "rnl=((na-1)*na*(2*na-1)*R*E*r0**2*Le**2)/(3*tb**2);\n",
+ "rnl=rnl*10**9;\n",
+ "\n",
+ "t=rl+rnl;\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The linear phase noise at the receiver = \",round(rl,2),\" rad**2 \"\n",
+ "print \"\\n The nonlinear phase noise at the receiver = \",round(rnl,2),\" rad**2 \"\n",
+ "print \"\\n The total variance = \",round(t,2),\" X 10**-3 rad**2 \"\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The linear phase noise at the receiver = 1.5 rad**2 \n",
+ "\n",
+ " The nonlinear phase noise at the receiver = 1.6 rad**2 \n",
+ "\n",
+ " The total variance = 3.1 X 10**-3 rad**2 \n"
+ ]
+ }
+ ],
+ "prompt_number": 40
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex10.8:pg-480"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 10.8\n",
+ "# Calculation of the Stokes signal power at the fiber output\n",
+ "# Page no 480\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "p1=20; # Input power pump\n",
+ "ps=-10; # Input Stokes\u00e2\u20ac\u2122s signal power\n",
+ "alpha=0.08;\n",
+ "L=2; # Length of fiber\n",
+ "alpha1=0.046;\n",
+ "A=40*10**-12; # Effective area of fiber\n",
+ "g=1*10**-13; # Raman coefficient of the fiber\n",
+ "\n",
+ "# The Stokes signal power at the fiber output\n",
+ "p1=10**(p1/10);\n",
+ "ps=10**(ps/10);\n",
+ "Le=(1-math.exp(-alpha*L))/alpha;\n",
+ "s=(g*p1*Le)/A;\n",
+ "d=alpha1*L;\n",
+ "pd=ps*math.e**(-d+s);\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Displaying results in the command window \n",
+ "print \"\\n The Stokes signal power at the fiber output = \",round(pd,15),\" mW \"\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The Stokes signal power at the fiber output = 0.1447807958 mW \n"
+ ]
+ }
+ ],
+ "prompt_number": 42
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter11.ipynb b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter11.ipynb new file mode 100644 index 00000000..7fdf3367 --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter11.ipynb @@ -0,0 +1,70 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:9aca0eaa158eb47fac722ebf15bc24112cea7e06ec3f145afacec7f090f5b463"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 11:Digital Signal Processing"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex11.1:pg-509"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 11.1\n",
+ "# Calculation of the minimum number of taps needed to compensate for the fiber dispersion\n",
+ "# Page no 509\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Given data\n",
+ "b=22*10**-27; # Power launched in port 1\n",
+ "l=800*10**3; # Power launched in port 2\n",
+ "T=50*10**-12; # Power launched in port 3 \n",
+ "\n",
+ "\n",
+ "# Bit rate of communication system\n",
+ "k=math.ceil((math.pi*b*l)/T**2);\n",
+ "n=(2*k)+1;\n",
+ "\n",
+ "\n",
+ "# Displaying results in the command window \n",
+ "print \"\\n The number of the taps = \",round(n,3)\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The number of the taps = 47.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter2.ipynb b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter2.ipynb new file mode 100644 index 00000000..65634e97 --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter2.ipynb @@ -0,0 +1,717 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:7821421296ff38fb8184d93817b23ff9985b801b40be6ae9c6f8568d9e7a621b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 02:Optical Fiber Transmission"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.1:pg-38"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no. 2.1\n",
+ "# To find a)The numerical aperture b)The acceptanca angle c)The relative index defference\n",
+ "# Page no. 38\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Given data\n",
+ "n1=1.47; # Refractive index of core\n",
+ "n2=1.45; # Refractive index of cladding\n",
+ "\n",
+ "# a)The numerical aperture\n",
+ "NA=(n1**2-n2**2)**(1/2.0); # Numerical aperture\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The numerical aperture = \",round(NA,4)\n",
+ "\n",
+ "# b)The acceptanca angle\n",
+ "imax=math.asin(NA); # The acceptanca angle\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The acceptance angle = \",round(imax,4),\" Radian\"\n",
+ "\n",
+ "# c)The relative index defference\n",
+ "delta=(n1-n2)/n1; # Relative index defference\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The relative index difference = \",round(delta,4)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The numerical aperture = 0.2417\n",
+ "\n",
+ " The acceptance angle = 0.2441 Radian\n",
+ "\n",
+ " The relative index difference = 0.0136\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.2:pg-41"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no. 2.2\n",
+ "# To find maximum bit-rate distance product\n",
+ "# Page no. 41\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "n1=1.46; # Refractive index of core\n",
+ "delta=0.01; # Relative difference of refractive index\n",
+ "L=1*10**3; # Fiber length\n",
+ "c=3*10**(8); # Speed of ligth in km/sec\n",
+ "\n",
+ "n2=n1*(1-delta); # Refractive index of cladding\n",
+ "deltaT=(n1**2*L*delta)/(c*n2); # Delay in sec\n",
+ "BL=(((c*n2)/(n1**2*delta))/10**3)*10**-6; # maximum bit-rate distance product in Mb/s.km\n",
+ "deltaT=((n1**2*L*delta)/(c*n2))*10**9; # Delay in ns\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n Refractive index of cladding = \",round(n2,4)\n",
+ "print \"\\n Delay =\",int(deltaT),\"ns\"\n",
+ "print \"\\n Approximate delay = \",int(deltaT+1),\"ns\"\n",
+ "print \"\\n Maximum bit-rate distance product = \",round(BL,1),\" Mb/(s.km)\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Refractive index of cladding = 1.4454\n",
+ "\n",
+ " Delay = 49 ns\n",
+ "\n",
+ " Approximate delay = 50 ns\n",
+ "\n",
+ " Maximum bit-rate distance product = 20.3 Mb/(s.km)\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.3:pg-43"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.2.3\n",
+ "# To compare deltaT for step index fiber with parabolic-index fiber\n",
+ "# Page no. 43\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "n1=1.47; # Refractive index of core\n",
+ "n2=1.45; # Refractive index of cladding\n",
+ "L=1*10.0**3; # Length of medium in meter\n",
+ "c=3*10**8; # speedof ligth in (m/s)\n",
+ "delta=(n1-n2)/n1;\n",
+ "\n",
+ "# The deltaT for step index fiber\n",
+ "deltaTSIF=((n1**2*L*delta)/(c*n2))*10**9; #Pulse width for step index fiber\n",
+ "\n",
+ "# deltaT for parabolic-index fiber\n",
+ "deltaTPIF=((n1**2*delta**2*L)/(8*c))*10**9; # Pulse width for parabolic-index fiber\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"Pulse width for step index fiber = \",round(deltaTSIF,2),\" ns\"\n",
+ "print \"Pulse width for parabolic index fiber = \",round(deltaTPIF,4),\" ns\"\n",
+ "\n",
+ "# The answer of pulse width for parabolic index fiber is wrong in book\n",
+ "\n",
+ "print \"Thus, the intermodal dispersion can be significantly reduced by using parabolic-index fiber\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Pulse width for step index fiber = 67.59 ns\n",
+ "Pulse width for parabolic index fiber = 0.1667 ns\n",
+ "Thus, the intermodal dispersion can be significantly reduced by using parabolic-index fiber\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.4:pg-61"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 2.4\n",
+ "# a)To convert transmitted power into dBm b)To convert received power into mW\n",
+ "# Page no. 61\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "Ptr=0.012; # Transmitted power in watt \n",
+ "PrdBm=-5; # Received power in dBm\n",
+ "\n",
+ "# a)To convert transmitted power into dBm\n",
+ "PtrdBm=10*math.log10(Ptr/(10.0**-3)); # Transmitted power in dBm\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n Transmitted power = \",round(PtrdBm,2),\" dBm\"\n",
+ "\n",
+ "# b)To convert received power into mW\n",
+ "PrmW=10**(-5/10.0); # Received power in mW\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n Received power = \",round(PrmW,4),\" mW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Transmitted power = 10.79 dBm\n",
+ "\n",
+ " Received power = 0.3162 mW\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.7:pg-69"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.2.7\n",
+ "# To find the core radius of step-index fiber\n",
+ "# Page no.69\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "n1=1.45; # Refractive index of core\n",
+ "delta=0.005;\n",
+ "n2=n1*(1-delta); # Refractive index of cladding\n",
+ "lambdac=1.1; # Cutoff wavelength in meter\n",
+ "lambdaa=1.55; # Operating wavelength in micrometer\n",
+ "a=((2.4048*lambdac*10**-6)/(2*math.pi*(n1**2-n2**2)**(1/2.0)))/10**-6; # Core radius\n",
+ "\n",
+ "#Displaying the result in command window\n",
+ "print \"\\n The core radius of step-index fiber = \",round(a,3),\" micrometer\"\n",
+ "print \"\\n Operating wavelength = \",round(lambdaa,2),\" micrometer\"\n",
+ "print \"\\n Cutoff wavelength = \",round(lambdac,1),\" micrometer\"\n",
+ "\n",
+ "print \"Since operating wavelength is greater than cutoff wavelength, it is single moded at this wavelength.\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The core radius of step-index fiber = 2.907 micrometer\n",
+ "\n",
+ " Operating wavelength = 1.55 micrometer\n",
+ "\n",
+ " Cutoff wavelength = 1.1 micrometer\n",
+ "Since operating wavelength is greater than cutoff wavelength, it is single moded at this wavelength.\n"
+ ]
+ }
+ ],
+ "prompt_number": 31
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.8:pg-72"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no 2.8\n",
+ "# To find the total loss and output power in mW and dBm in fiber\n",
+ "# Page no. 72\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "losscoe=0.046; # Loss coefficient in km**-1\n",
+ "L=80; # Length of fiber in km\n",
+ "PindBm=3; # Input power in dBm\n",
+ "\n",
+ "# To find total loss of fiber\n",
+ "loss=round(4.343*losscoe*L); # Total loss in fiber\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n Total loss in fiber = \",int(loss),\" dB\"\n",
+ "\n",
+ "# To find output power \n",
+ "PoutdBm=PindBm-loss; # Output power in dBm\n",
+ "\n",
+ "PoutmW=10**(PoutdBm/10); # Output power in mW\n",
+ "\n",
+ "#Displaying the result in command window\n",
+ "print \"\\n Output power of fiber =\",int(PoutdBm),\"dBm\"\n",
+ "print \"\\n Output power of fiber = \",round(PoutmW,2),\" mW\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Total loss in fiber = 16 dB\n",
+ "\n",
+ " Output power of fiber = -13 dBm\n",
+ "\n",
+ " Output power of fiber = 0.05 mW\n"
+ ]
+ }
+ ],
+ "prompt_number": 32
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.10:pg-77"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no. 2.10\n",
+ "# To design single mode fiber such that absolute accumulated dispersion should not exceed 1100ps/nm\n",
+ "# Page no. 77\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "lambda1=1530; # Left edge of wavelength range in nm\n",
+ "lambda2=1560; # Rigth edge of wavelength range in nm\n",
+ "lambda0=1545; # Center of the band in nm\n",
+ "L=80; # Fiber length in km\n",
+ "\n",
+ "print \"We choose center of band (lambda_0) for large maximum allowable dispersion slope.\"\n",
+ "\n",
+ "Dlambda2=1100.0/L; # Dispersion at rigth edge of band in ps/nm/km\n",
+ "S=Dlambda2/(lambda2-lambda0); # Dispersion slope in ps/nm**2/km\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n Dispersion slope = \",round(S,3),\" ps/nm**2/km\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "We choose center of band (lambda_0) for large maximum allowable dispersion slope.\n",
+ "\n",
+ " Dispersion slope = 0.917 ps/nm**2/km\n"
+ ]
+ }
+ ],
+ "prompt_number": 33
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.11:pg-80"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.2.11\n",
+ "# To find a)length of DCF b)power at the output of DCF c)gain of amplifier\n",
+ "# Page no.80\n",
+ "\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "# Given data\n",
+ "LTF=80; # Length of transmission fiber\n",
+ "beta2TF=-21.0; # Dispersion of transmission fiber in ps**2/km\n",
+ "beta2DCF=130.0; # Dispersion of DCF in ps**2/km\n",
+ "Pin=2*10**(-3); # Input power of transmission fiber in W\n",
+ "DCFloss=0.5; # Losses of DCF in dB/km\n",
+ "TFloss=0.2; # Losses of TF in dB/km\n",
+ "spliceloss=0.5; # Splice loss in dB\n",
+ "\n",
+ "# a)To find length of DCF\n",
+ "LDCF=(-beta2TF*LTF)/beta2DCF; # Length of DCF in km\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n Length of DCF = \",round(LDCF,1),\" km\"\n",
+ "\n",
+ "# b)To find power at the output of DCF\n",
+ "PindBm=10*math.log10(Pin/10**(-3)); # Input power of transmission fiber in dBm\n",
+ "Totalloss=TFloss*LTF+DCFloss*LDCF+spliceloss; # Total loss in fiber in dB\n",
+ "PoutdBm=PindBm-Totalloss; # Output power of DCF in dBm\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n Output power of DCF = \",round(PoutdBm,2),\" dBm\"\n",
+ "\n",
+ "# c)To find gain of amplifier\n",
+ "gain=Totalloss; # gain of amplifier\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n Gain of amplifier = \",round(gain,2),\" dBm\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Length of DCF = 12.9 km\n",
+ "\n",
+ " Output power of DCF = -19.95 dBm\n",
+ "\n",
+ " Gain of amplifier = 22.96 dBm\n"
+ ]
+ }
+ ],
+ "prompt_number": 35
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.12:pg-81"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no. 2.12\n",
+ "# To find the delay between the shortest and longest path.\n",
+ "# Page no. 81\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "NA=0.2; # Numerical aperture\n",
+ "L=2*10**3; # Fiber length in meters\n",
+ "n1=1.45; # Core refractive index\n",
+ "delta=(NA)**2/(2*n1**2); # Relative index difference\n",
+ "n2=n1; # since difference between core index and cladding index is smaller\n",
+ "c=3*10**8; # Speed of ligth in m/s\n",
+ "\n",
+ "# The delay between the shortest and longest path.\n",
+ "deltaT=((n1**2*L*delta)/(c*n2)); # the delay between the shortest and longest path.\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The delay between the shortest and longest path = \",round(deltaT*10**9,2),\" ns\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The delay between the shortest and longest path = 91.95 ns\n"
+ ]
+ }
+ ],
+ "prompt_number": 36
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.13:pg-82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no. 2.13\n",
+ "# To calculate the propagation constant\n",
+ "# Page no. 82\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "lambda0=1550*10**-9; # wavelength in meter\n",
+ "beta0=6*10**6; # propagation constant in rad/m\n",
+ "lambda1=1551*10**-9; # wavelength in meter\n",
+ "beta1=0.5*10**-8; # inverse group velocity in sec/meter\n",
+ "beta2=-10*10**-24; # second-order dispersion coefficient in sec**2/km\n",
+ "c=3*10**8; # Speed of ligth in m/s\n",
+ "omega0=(2*math.pi*c)/lambda0; # Radial frequency at lambda0\n",
+ "omega1=(2*math.pi*c)/lambda1; # Radial frequency at lambda1\n",
+ "omega=omega1-omega0;\n",
+ "\n",
+ "# The propagation constant at 1551nm wavelength\n",
+ "betaomega1=(beta0+beta1*omega+beta2*omega**2/2.0); # Propagation constant at 1551nm wavelength\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The propagation constant at 1551nm wavelength = \",round(betaomega1*10**-6,4),\" X 10**6 rad/s\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The propagation constant at 1551nm wavelength = 5.9961 X 10**6 rad/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 37
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.14:pg-83"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example No. 2.14\n",
+ "# To calculate the lower limit on the transmitter power in dBm and mW units.\n",
+ "# Page No. 83\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "l=80; # Length of fiber in km\n",
+ "F1=-0.2*l; # Fiber loss in dB\n",
+ "F2=-0.5; # Filter loss in dB\n",
+ "G=15; # Amplifier gain in dB\n",
+ "Pout=-3; # Minimum power required at the receiver in dBm\n",
+ "\n",
+ "# Lower limit on the transmitter power\n",
+ "Pin=Pout-F1-F2-G; # Lower limit on the transmitter power in dBm\n",
+ "PinmW=10**(0.1*Pin); # Lower limit on the transmitter power in mW\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The lower limit on the transmitter power in dBm = \",round(Pin,1)\n",
+ "print \"\\n The lower limit on the transmitter power in mW = \",round(PinmW,4)\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The lower limit on the transmitter power in dBm = -1.5\n",
+ "\n",
+ " The lower limit on the transmitter power in mW = 0.7079\n"
+ ]
+ }
+ ],
+ "prompt_number": 38
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.16:pg-84"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example No. 2.16\n",
+ "# To find the length of DCF so that the pulse width (FWHM) at the output of the DCF is twice the pulse width at the input of the TF\n",
+ "# Page No. 84\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "beta2TF=-21*(10**(-12))**2; # Dispersion coefficient of transmission fiber in s**2/km\n",
+ "beta2DCF=130*(10**(-12))**2; # Dispersion coefficient of dispersion compensating fiber in s**2/km\n",
+ "LTF=80; # Length of transmission fiber in km\n",
+ "TFWHM=12.5*10**(-12); # Full-width at half-maximum\n",
+ "T0=TFWHM/1.665; # Half-width\n",
+ "\n",
+ "# The length of required DCF\n",
+ "LDCF1=(sqrt(3)*T0**2-beta2TF*LTF)/beta2DCF; # Length of dispersion compensating fiber in km\n",
+ "LDCF2=(-sqrt(3)*T0**2-beta2TF*LTF)/beta2DCF; # Length of dispersion compensating fiber in km\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The length of DCF so that the pulse width (FWHM) at the output of the DCF is twice the pulse width at the input of the TF \\n = \",round(LDCF1,2),\"km\"\n",
+ "\n",
+ "print \" or = \",round(LDCF2,2),\" km\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The length of DCF so that the pulse width (FWHM) at the output of the DCF is twice the pulse width at the input of the TF \n",
+ " = 13.67 km\n",
+ " or = 12.17 km\n"
+ ]
+ }
+ ],
+ "prompt_number": 41
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex2.17:pg-85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example No. 2.17\n",
+ "# To find the accumulated dispersion of the DCF so that the net accumulated dispersion does not exceed 1100 ps/nm\n",
+ "# Page no. 85\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "lambda0=1490; # Zero dispersion wavelength in nm\n",
+ "lambdaa=1560; # Upper limit of wavelength range in nm\n",
+ "Sc=0.08; # Dispersion slope of transmission fiber ps/nm2/km\n",
+ "LTF=800; # Length of transmission fiber in km\n",
+ "DTF=Sc*(lambdaa-lambda0); # Dispersion at 1560 nm in ps/nm/km\n",
+ "\n",
+ "# The accumulated dispersion of the DCF\n",
+ "DLDCF=1100-DTF*LTF; # The accumulated dispersion of the DCF in ps/nm\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The accumulated dispersion of the DCF should be less than \",int(DLDCF),\" ps/nm\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The accumulated dispersion of the DCF should be less than -3380 ps/nm\n"
+ ]
+ }
+ ],
+ "prompt_number": 43
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter3.ipynb b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter3.ipynb new file mode 100644 index 00000000..c547106d --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter3.ipynb @@ -0,0 +1,649 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:9d1e8425a16140805268b844fcdb95dce714d62df3e3a255ae5e71e461cdcda8"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 03:Lasers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.1:pg-99"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example No. 3.1\n",
+ "# To calculate the Einstein A and B coefficients\n",
+ "# Page no.99\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Given data\n",
+ "tsp=2*10**-9; # Spontaneous lifetime associated with 2 \u00e2\u2020\u2019 1 transition in seconds\n",
+ "\n",
+ "deltaE=2.4*10**(-19); # The energy difference between the levels\n",
+ "h=1.054*10**(-34); # The distance between two levels\n",
+ "omega=deltaE/h; # Frequency in rad/sec\n",
+ "v=1.25*10**8; # The velocity of light in the medium in m/s\n",
+ "\n",
+ "# The Einstein A and B coefficients\n",
+ "A=(1/tsp)*10**-8; # Einstein coefficient A\n",
+ "B=(((1/tsp)*math.pi**2*v**3)/(h*omega**3))*10**-21; # Einstein coefficient B\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n Einstein coefficient A = \",round(A),\" X 10**8 s**(-1)\"\n",
+ "print \"\\n Einstein coefficient B = \",round(B,2),\" X 10**21 m**3/J.s**2\"\n",
+ "\n",
+ "# The answers are varrying due to round off error \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Einstein coefficient A = 5.0 X 10**8 s**(-1)\n",
+ "\n",
+ " Einstein coefficient B = 7.75 X 10**21 m**3/J.s**2\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.2:pg-100"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no. 3.2\n",
+ "# To calculate (a) the wavelength of light emitted, (b) the ratio of spontaneous emission rate to stimulated emission rate, (c) the ratio of stimulated emission rate to absorption rate, and (d) the population density of the excited level.\n",
+ "# Page no. 100\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "deltaE=1.26*10**-19; # The energy difference between two levels\n",
+ "h=1.054*10**(-34); # The distance between two levels\n",
+ "c=3*10**8; # The speed of ligth in m/s\n",
+ "kB=1.38*10**(-23); # The Boltzmann\u00e2\u20ac\u2122s constant J/K\n",
+ "T=300; # The absolute temperature in Kelvin\n",
+ "N1=10**19; # The population density in the ground state in cm**(-3)\n",
+ "\n",
+ "# (a)The wavelength of light emitted\n",
+ "h=2*math.pi*h; # The distance between two levels in J.s\n",
+ "f=deltaE/h; # The frequency in Hz\n",
+ "lambdaa=(c/f)*10**6; # The wavelength of ligth emitted in micrometer\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The wavelength of ligth emitted = \",round(lambdaa,2),\" micrometer\"\n",
+ "\n",
+ "# The calculation of this answer is wrong in the book\n",
+ "\n",
+ "# (b)The ratio of spontaneous emission rate to stimulated emission rate\n",
+ "RspRst=(exp(deltaE/(kB*T))-1); # The ratio of spontaneous emission rate to stimulated emission rate\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The ratio of spontaneous emission rate to stimulated emission rate = \",round(RspRst*10**-13,2),\" X 10**13\"\n",
+ "\n",
+ "# The calculation of this answer is wrong in the book\n",
+ "\n",
+ "# (c)The ratio of stimulated emission rate to absorption rate\n",
+ "RstRab=(exp(-deltaE/(kB*T))); # The ratio of stimulated emission rate to absorption rate\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The ratio of stimulated emission rate to absorption rate = \",round(RstRab*10**14,2),\" X 10**-14\"\n",
+ "\n",
+ "# The calculation of this answer is wrong in the book\n",
+ "\n",
+ "# (d)The population density of the excited level\n",
+ "N2=(N1*exp(-deltaE/(kB*T))); # The population density of the excited level in cm**(-3)\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The population density of the excited level = \",round(N2*10**-5,2),\" X 10**5 cm**(-3)\"\n",
+ "\n",
+ "# The calculation of this answer is wrong in the book\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The wavelength of ligth emitted = 1.58 micrometer\n",
+ "\n",
+ " The ratio of spontaneous emission rate to stimulated emission rate = 1.65 X 10**13\n",
+ "\n",
+ " The ratio of stimulated emission rate to absorption rate = 6.06 X 10**-14\n",
+ "\n",
+ " The population density of the excited level = 6.06 X 10**5 cm**(-3)\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.3:pg-106"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example No. 3.3\n",
+ "# To calculate the longitudinal mode spacing and the minimum gain required for laser oscillation\n",
+ "# Page no. 106\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "c=3*10**8; # The speed of ligth in air\n",
+ "L=500*10**(-6); # The distance between mirrors\n",
+ "n=3.5; # The refractive index\n",
+ "inlossdB=50; # The internal loss in dB/cm\n",
+ "R1=0.3; # The reflectivity of ligth wave which is reflected at A\n",
+ "R2=0.3; # The reflectivity of ligth wave which is reflected at B\n",
+ "\n",
+ "# The longitudinal mode spacing\n",
+ "deltaf=(c/(2*n*L))*10**-9; # The longitudinal mode spacing\n",
+ "L=0.05; # The distance between mirrors in cm\n",
+ "amir=(1/(2*L))*math.log(1/(R1*R2)); # The loss due to mirrors per cm\n",
+ "aint=math.log(10**(inlossdB/10)); # The coefficient of internal loss due to scattering\n",
+ "\n",
+ "# The minimum gain required\n",
+ "g=aint+amir; # The minimum gain required for laser oscillation\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The longitudinal mode spacing = \",round(deltaf,2),\" GHz\"\n",
+ "print \"\\n The minimum gain required for laser oscillation per cm = \",round(g,2),\" cm**-1\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The longitudinal mode spacing = 85.71 GHz\n",
+ "\n",
+ " The minimum gain required for laser oscillation per cm = 35.59 cm**-1\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.4:pg-107"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no. 3.4\n",
+ "# To calculate the energy density.\n",
+ "# Page no. 107\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "P=20*10**(-3); # The mean power in W\n",
+ "A=100*10**(-12); # The area perpendicular to the direction of light propagation in m**2\n",
+ "n=3.2; # Refractive index of gain medium\n",
+ "c=3*10**8; # Speed of ligth in m/s\n",
+ "I=P/A; # The optical intensity in W/m**2\n",
+ "\n",
+ "# The energy density\n",
+ "u=(n*I)/c; # The energy density in J/m**3\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The energy density = \",round(u,2),\" J/m**3\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The energy density = 2.13 J/m**3\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.5:pg-110"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.3.5\n",
+ "# To calculate the frequency of the electromagnetic wave emitted by stimulated emission.\n",
+ "# Page no.110\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "E=10**(-4); # The energy difference between two levels in eV\n",
+ "E=10**(-4)*1.602*10**(-19); # The energy difference between two levels in J\n",
+ "h=1.054*10**(-34); # The distance between two levels\n",
+ "\n",
+ "# The frequency of the electromagnetic wave emitted by stimulated emission.\n",
+ "f=(E/(2*math.pi*h))*10**-9; # The frequency of the electromagnetic wave emitted by stimulated emission in GHz\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The frequency of the electromagnetic wave emitted by stimulated emission = \",round(f),\" GHz\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The frequency of the electromagnetic wave emitted by stimulated emission = 24.0 GHz\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.6:pg-123"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 3.6\n",
+ "# To calculate the band-gap energy.\n",
+ "# Page no.123\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "m=9.109*10**(-31); # The electron rest mass in kg\n",
+ "meff1=0.07*m; # The effective mass of an electron in the conduction band\n",
+ "meff2=0.5*m; # The effective mass of an electron in the valence band\n",
+ "mr=(meff1*meff2)/(meff1+meff2); # The reduced mass\n",
+ "hkl=7.84*10**(-26); # The electron momentum in kg.m/s\n",
+ "lambdaa=0.8*10**(-6); # The wavelength of electromagnetic wave in m\n",
+ "h=1.054*10**(-34); # The distance between two levels\n",
+ "c=3*10**8; # Speed of ligth in m/s\n",
+ "hw=(h*2*math.pi*c)/lambdaa; # The poton energy in J\n",
+ "\n",
+ "# The band-gap energy.\n",
+ "Eg=hw-(hkl**2/(2*mr)); # The band-gap energy in J\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The band-gap energy = \",round(Eg*10**19,2),\" X 10**-19 J\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The band-gap energy = 1.93 X 10**-19 J\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.7:pg-130"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.3.7\n",
+ "# To calculate (a) the photon lifetime, (b) the threshold current, and (c) the current required to generate a mean photon density of 8.5 \u00c3\u2014 10**21 m\u00e2\u02c6\u20193\n",
+ "# Page no.130\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Given data\n",
+ "w=3*10**(-6); # The active area width in meter\n",
+ "d=0.3*10**(-6); # The active area thickness in meter\n",
+ "L=500*10**(-6); # The length\n",
+ "Te=1*10**(-9); # Electron lifetime\n",
+ "Neth=0.8*10**(24); # Threshold electron density\n",
+ "aint=46*10**2; # Internal cavity loss in m**-1\n",
+ "n=3.5; # Refrective index of the medium\n",
+ "R1=0.65; # The reflectivity of ligth wave which is reflected at A\n",
+ "R2=0.65; # The reflectivity of ligth wave which is reflected at B\n",
+ "\n",
+ "# (a)The photon lifetime\n",
+ "amir=(1/(2*L))*math.log(1/(R1*R2)); # The loss due to mirrors per m\n",
+ "c=3*10**8; # Speed of ligth in m/s\n",
+ "v=c/n; # Speed of ligth in medium (m/s)\n",
+ "Tp=1/(v*(aint+amir)); # The photon lifetime in sec\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The photon lifetime = \",round(Tp*10**12,2),\" ps\"\n",
+ "\n",
+ "# (b)The threshold current\n",
+ "V=w*d*L; #The active volume in m**3\n",
+ "q=1.602*10**(-19); #The electron charge in C\n",
+ "Te=10**-9; #The electron lifetime in sec\n",
+ "Ith=(Neth*q*V)/Te; #The threshold current in mA \n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The threshold current = \",round(Ith*10**3,1),\" mA\"\n",
+ "\n",
+ "# The answer calculated in book is wrong\n",
+ "\n",
+ "# (c)The current required to generate a mean photon density of 8.5 \u00c3\u2014 10**21 m\u00e2\u02c6\u20193\n",
+ "Nph=8.5*10**21; #Mean photon density\n",
+ "Tph=Tp; #The photon lifetime in sec\n",
+ "I=(Ith+(Nph*q*V)/Tph); #The current required to generate a mean photon density of 8.5 \u00c3\u2014 10**21 m\u00e2\u02c6\u20193\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The current required to generate a mean photon density of 8.5 \u00c3\u2014 10**21 m**-3 = \",round(I*10**3,2),\" mA\"\n",
+ "\n",
+ "# The answer calculated in book is wrong\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The photon lifetime = 2.14 ps\n",
+ "\n",
+ " The threshold current = 57.7 mA\n",
+ "\n",
+ " The current required to generate a mean photon density of 8.5 \u00c3\u2014 10**21 m**-3 = 344.53 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.8:pg-133"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.3.8\n",
+ "# To find the wavelength of the light emitted\n",
+ "# Page no.133\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "RspRst=2*10**14; # The ratio of spontaneous emission rate to stimulated emission rate\n",
+ "T=30; # Temperature in degree celcius\n",
+ "kB=1.38*10**(-23); # The Boltzmann\u00e2\u20ac\u2122s constant J/K\n",
+ "h=1.054*10**(-34); # The distance between two levels\n",
+ "c=3*10**8; # Speed of ligth in air\n",
+ "\n",
+ "T=T+273; # Temperature in Kelvin\n",
+ "w=(math.log(RspRst)*kB*T)/h; # Frequency in Rad\n",
+ "\n",
+ "# The wavelength of the light emitted\n",
+ "lambdaa=(2*math.pi*c)/w; # The wavelength of the light emitted\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The wavelength of the light emitted = \",round(lambdaa*10**6,2),\" micrometer\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The wavelength of the light emitted = 1.44 micrometer\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.9:pg-133"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.3.9\n",
+ "# To calculate a) the frequency separation between modes (b) the wavelength separation between modes\n",
+ "# Page no.133\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "lambdaa=1.3*10**-6; # Laser diode operating wavelength\n",
+ "L=300*10**-6; # Cavity length\n",
+ "n=3.5; # Refractive index of active region\n",
+ "c=3*10**8; # Speed of ligth in air (m/s)\n",
+ "\n",
+ "# a)The frequency separation between modes\n",
+ "deltaf=c/(2*n*L); # The frequency separation between modes in GHz\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The frequency separation between modes = \",round(deltaf*10**-9,1),\" GHz\"\n",
+ "\n",
+ "# (b)The wavelength separation between modes\n",
+ "deltalambda=(lambdaa**2*deltaf)/c; # The wavelength separation between modes\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The wavelength separation between modes = \",round(deltalambda*10**9,1),\" nanometer\"\n",
+ "\n",
+ "# The wrong unit is givan in book\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The frequency separation between modes = 142.9 GHz\n",
+ "\n",
+ " The wavelength separation between modes = 0.8 nanometer\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.10:pg-134"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.3.10\n",
+ "# To calculate the effective mass of the electron in the valence band.\n",
+ "# Page no.134\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "Eg=1.18; # Band gap in eV\n",
+ "Eg=1.18*1.602*10**-19; # Band gap in J\n",
+ "hk1=9*10**-26; # The crystal momentum in Kg.m/s\n",
+ "h=1.054*10**(-34); # The distance between two levels\n",
+ "f=3.94*10**14; # Light wave of frequency\n",
+ "m=9.109*10**(-31); # The electron rest mass in kg\n",
+ "\n",
+ "mr=(hk1)**2/(2*(h*2*math.pi*f-Eg)); # The reduced mass in kg\n",
+ "meff1=0.07*m; # The effective mass of an electron in the conduction band\n",
+ "\n",
+ "# The effective mass of the electron in the valence band.\n",
+ "meff2=(mr*meff1)/(meff1-mr); # The effective mass of the electron in the valence band.\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The effective mass of the electron in the valence band = \",round(meff2*10**31,2),\" X 10**-31 kg\"\n",
+ "# The answer is varrying due to round-off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The effective mass of the electron in the valence band = 4.84 X 10**-31 kg\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex3.11:pg-135"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.3.11\n",
+ "# To calculate (a) the optical gain coefficient \u00ce\u201cg required to balance the cavity loss and (b) the threshold electron density Ne\n",
+ "# Page no.135\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "L=320*10**-6; # Cavity length\n",
+ "R1=0.35; # The reflectivity of ligth wave which is reflected at A\n",
+ "R2=0.35; # The reflectivity of ligth wave which is reflected at B\n",
+ "aint=10**3; # Internal cavity loss in m**-1\n",
+ "c=3*10**8; # Speed of ligth in air\n",
+ "Go=1.73*10**-12; # Gain coefficient in m**3/s\n",
+ "Neo=3.47*10**23; # The value of the carrier density at which the gain coefficient becomes zero in m**-3\n",
+ "n=3.3; # Refractive index of medium\n",
+ "\n",
+ "# (a) the optical gain coefficient \u00ce\u201cg required to balance the cavity loss\n",
+ "amir=(1/(2*L))*math.log(1/(R1*R2)); # The loss due to mirrors per m\n",
+ "acav=amir+aint; # The total cavity loss coefficient\n",
+ "gammag=acav; # The optical gain coefficient in m**-1\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The optical gain coefficient = \",round(gammag*10**-3,2),\" X 10**3 m**-1\"\n",
+ "\n",
+ "#(b) the threshold electron density Ne\n",
+ "v=c/n; # Velocity of ligth in medium\n",
+ "Tph=1/(v*acav); # The photon lifetime in sec\n",
+ "Neth=Neo+1/(Go*Tph); # The threshold electron density Ne\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n The threshold electron density = \",round(Neth*10**-23,2),\" X 10**23 m**-3\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The optical gain coefficient = 4.28 X 10**3 m**-1\n",
+ "\n",
+ " The threshold electron density = 5.72 X 10**23 m**-3\n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter4.ipynb b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter4.ipynb new file mode 100644 index 00000000..499dde0d --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter4.ipynb @@ -0,0 +1,68 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:8baab9bca1418a8884a5af2981bac41de779102e305e522a4d23916cff098300"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 04:Optical Modulators and Modulation Schemes"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex4.2:pg-152"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.4.2\n",
+ "# To calculate the voltage required to introduce a phase shift of pi/2.\n",
+ "# Page no.152\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "lambda0=1530*10**-9; # An electro-optic modulator operating wavelength\n",
+ "d=10*10**-6; # Thickness\n",
+ "L=5*10**-2; # Length\n",
+ "n0=2.2; # Refractive index\n",
+ "r33=30*10**-12; # Pockel coefficient in m/V\n",
+ "deltaphi=math.pi/2; # Phase shift\n",
+ "V=(deltaphi*lambda0*d)/(math.pi*L*n0**3*r33); # The voltage required to introduce a phase shift of pi/2\n",
+ "\n",
+ "#Displaying the result in command window\n",
+ "print \"\\n The voltage required to introduce a phase shift of pi/2 = \",round(V,2),\" V\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The voltage required to introduce a phase shift of pi/2 = 0.48 V\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter5.ipynb b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter5.ipynb new file mode 100644 index 00000000..509b0aa5 --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter5.ipynb @@ -0,0 +1,531 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:0b9c3e954d0b3472e5cfaca992b6e710fc9df1a3af76ec0abff8646734de75f4"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 05:Optical Receivers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.1:pg-196"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.5.1\n",
+ "# To calculate (a) the photon incidence rate, (b) the photon absorption rate, and, (c) the quantum efficiency.\n",
+ "# Page no.196\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "lambdaa=550*10**(-9); # The wavelength of electromagnetic wave in m\n",
+ "c=3*10**8; # Speed of ligth in air\n",
+ "h=6.626*10**(-34); # Planck's constant\n",
+ "alpha=10**4; # absorption coefficient\n",
+ "W=3*10**-4; # width of the active region\n",
+ "Pi=1*10**-9; # optical power\n",
+ "eta=0.9; # the fraction of photocarriers that contribute to the photocurrent\n",
+ "Rp=0; # the power transmission coefficient at the air\u00e2\u20ac\u201csemiconductor interface\n",
+ "\n",
+ "# (a) the photon incidence rate\n",
+ "Eph=(h*c)/lambdaa; # The energy of a photon\n",
+ "Rincident=Pi/Eph; # The photon incidence rate\n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n The photon incidence rate = \",round(Rincident*10**-9,2),\" X 10**9 photon/s\"\n",
+ "\n",
+ "# (b) the photon absorption rate\n",
+ "Rabs=(Rincident*(1-exp(-alpha*W))); # The photon absorption rate\n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n The photon absorption rate = \",round(Rabs*10**-9,2),\" X 10**9 photon/s\"\n",
+ "\n",
+ "#c) the quantum efficiency\n",
+ "neta=(1-Rp)*eta*(1-exp(-alpha*W)); # The quantum efficiency\n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n The quantum efficiency = \",round(neta,3)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The photon incidence rate = 2.77 X 10**9 photon/s\n",
+ "\n",
+ " The photon absorption rate = 2.63 X 10**9 photon/s\n",
+ "\n",
+ " The quantum efficiency = 0.855\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.2:pg-198"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.5.2\n",
+ "# To calculate (a) the responsivity R and (b) the cutoff wavelength \n",
+ "# Page no.198\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "neta=0.9; # The quantum efficiency\n",
+ "Eg=1.42; # The band-gap energy in eV\n",
+ "lambdaa=1.1; # The operating (free-space) wavelength in micrometer\n",
+ "\n",
+ "# (a) The responsivity \n",
+ "R=(neta*lambdaa)/1.24; # The responsivity in A/W\n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n The responsivity = \",round(R,1),\" A/W\" #Wrong answer in book\n",
+ "\n",
+ "# (b) The cutoff wavelength \n",
+ "lambdac=1.2/Eg; #The cutoff wavelength in micrometer\n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n The cutoff wavelength = \",round(lambdac,3),\" micrometer\" #Wrong answer in book\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The responsivity = 0.8 A/W\n",
+ "\n",
+ " The cutoff wavelength = 0.845 micrometer\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.3:pg-199"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.5.3\n",
+ "# To find quantum efficiency at different wavelength and same responsivity\n",
+ "# Page no.199\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "lambda1=0.7; # The radiation wavelength in micrometer\n",
+ "R=0.4; # The responsivity in A/W\n",
+ "lambda2=0.5; # The reduced wavelength in micrometer\n",
+ "neta1=(R*1.24)/lambda1; # The quantum efficiency for 0.7micrometer wavelength\n",
+ "neta2=neta1*(lambda2/lambda1); # The quantum efficiency for reduced wavelength 0.5micrometer \n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n The quantum efficiency for 0.7 micrometer wavelength = \",round(neta1,4)\n",
+ "print \"\\n The quantum efficiency for reduced wavelength of 0.5 micrometer = \",round(neta2,3)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The quantum efficiency for 0.7 micrometer wavelength = 0.7086\n",
+ "\n",
+ " The quantum efficiency for reduced wavelength of 0.5 micrometer = 0.506\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.4:pg-199"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.5.4\n",
+ "# To determine the refractive index and thickness of the antireflection coating\n",
+ "# Page no.199\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "lambdaa=680*10**-9; # Wavelength of red ligth in meter\n",
+ "nair=1; # Refractive index of air\n",
+ "nsilicon=3.6; # Refractive index of silicon\n",
+ "nAR=math.sqrt(nair*nsilicon); # Refractive index of antireflection coating\n",
+ "tAR=lambdaa/(4*nAR); # Thickness of antireflection coating\n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n Refractive index of antireflection coating = \",round(nAR,1)\n",
+ "print \"\\n Thickness of antireflection coating = \",round(tAR*10**9),\" nm\"\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Refractive index of antireflection coating = 1.9\n",
+ "\n",
+ " Thickness of antireflection coating = 90.0 nm\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.5:pg-216"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.5\n",
+ "# To calculate the inaccuracy with which resonator should be fabricated\n",
+ "# Page no.216\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Given data\n",
+ "R1=0.9; # Reflectivity at point A\n",
+ "integer=4;\n",
+ "n=3.5; # Reflection index of silicon\n",
+ "F=math.pi/(1-math.sqrt(R1)); # The finesse of the resonator and also called as the ratio of the free spectral range\n",
+ "lambda0=850; # Wavelength in nanometer\n",
+ "L=integer*lambda0/(2*n); # Resonator length in nanometer\n",
+ "\n",
+ "# The inaccuracy with which resonator should be fabricated\n",
+ "deltaL=L*0.5/F;\n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n Resonator length = \",round(L),\"nm\"\n",
+ "print \"\\n The inaccuracy in length with which resonator should be fabricated = \",round(deltaL),\" nm\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Resonator length = 486.0 nm\n",
+ "\n",
+ " The inaccuracy in length with which resonator should be fabricated = 4.0 nm\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.6:pg-229"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.5.6\n",
+ "# To find the peak current if (a) LO power = 10 dBm, (b) LO power = \u00e2\u02c6\u201910 dBm for the single-branch receiver\n",
+ "# Page no.229\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "L=100; # Length of fiber\n",
+ "loss=0.2*L; # Total fiber loss\n",
+ "PtdBm=12; # The peak power of the signal at the transmitter\n",
+ "R=0.9; # Responsivity in A/W\n",
+ "PrdBm=PtdBm-loss; # The power at the receiver\n",
+ "\n",
+ "# (a) the peak current LO power = 10 dBm\n",
+ "PLO1dBm=10; # Power at local oscillator in dBm\n",
+ "PLO1=10**(0.1*PLO1dBm); # Power at local oscillator in mW\n",
+ "Pr=10**(0.1*PrdBm); # Power at receiver in mW\n",
+ "Id1=R*sqrt(Pr*PLO1); # The peak current at LO power = 10dBm\n",
+ "I1=R*Pr/2+R*sqrt(Pr*PLO1); # The peak current after ignoring the d.c. term\n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n The peak current at LO power 10dBm = \",round(Id1,4),\" mA\"\n",
+ "print \"\\n The peak current after ignoring the d.c. term = \",round(I1,3),\" mA\"\n",
+ "\n",
+ "# (b) the peak current LO power = -10 dBm\n",
+ "PLO2dBm=-10; # Power at local oscillator in dBm\n",
+ "PLO2=10**(0.1*PLO2dBm); # Power at local oscillator in mW\n",
+ "Id2=R*sqrt(Pr*PLO2); # The peak current at LO power = -10dBm\n",
+ "I2=R*Pr/2+R*sqrt(Pr*PLO2); # The peak current after ignoring the d.c. term\n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n The peak current at LO power -10dBm = \",round(Id2,4),\" mA\"\n",
+ "print \"\\n The peak current after ignoring the d.c. term = \",round(I2,4),\" mA\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The peak current at LO power 10dBm = 1.133 mA\n",
+ "\n",
+ " The peak current after ignoring the d.c. term = 1.204 mA\n",
+ "\n",
+ " The peak current at LO power -10dBm = 0.1133 mA\n",
+ "\n",
+ " The peak current after ignoring the d.c. term = 0.1846 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.7:pg-234"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.5.7\n",
+ "# To find the peak current if (a) LO power = 10 dBm, (b) LO power = \u00e2\u02c6\u201910 dBm for the balanced receiver\n",
+ "# Page no.234\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Given data\n",
+ "L=100; # Length of fiber\n",
+ "loss=0.2*L; # Total fiber loss\n",
+ "PtdBm=12; # The peak power of the signal at the transmitter\n",
+ "R=0.9; # Responsivity in A/W\n",
+ "PrdBm=PtdBm-loss; # The power at the receiver\n",
+ "\n",
+ "# (a) the peak current LO power = 10 dBm\n",
+ "PLO1dBm=10; # Power at local oscillator in dBm\n",
+ "PLO1=10**(0.1*PLO1dBm); # Power at local oscillator in mW\n",
+ "Pr=10**(0.1*PrdBm); # Power at receiver in mW\n",
+ "Id1=2*R*math.sqrt(Pr*PLO1); # The peak current LO power = 10 dBm\n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n The peak current for LO power 10 dBm = \",round(Id1,4),\" mA\"\n",
+ "\n",
+ "# (b) the peak current LO power = -10 dBm\n",
+ "PLO2dBm=-10; # Power at local oscillator in dBm\n",
+ "PLO2=10**(0.1*PLO2dBm); # Power at local oscillator in mW\n",
+ "Id2=2*R*sqrt(Pr*PLO2); # The peak current LO power = -10 dBm\n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n The peak current for LO power -10 dBm = \",round(Id2,4),\" mA\"\n",
+ "\n",
+ "# comment on the intermodulation cross-talk in a single-branch receiver and the balanced receiver\n",
+ "print \"\\n A single-branch receiver would have a significant amount of cross-talk. In contrast, for a balanced receiver, intermodulation \\n cross-talk is canceled out due to the balanced detection.\" \n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The peak current for LO power 10 dBm = 2.2661 mA\n",
+ "\n",
+ " The peak current for LO power -10 dBm = 0.2266 mA\n",
+ "\n",
+ " A single-branch receiver would have a significant amount of cross-talk. In contrast, for a balanced receiver, intermodulation \n",
+ " cross-talk is canceled out due to the balanced detection.\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.8:pg-238"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no.5.8\n",
+ "# To find the in-phase and quadrature components of the current of a balanced IQ receiver.\n",
+ "# Page no.238\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "PLO=10; # Local oscillator power in mW from Example 5.7a\n",
+ "Pr=0.1585; # Power at receiver in mW\n",
+ "R=0.9; # Responsivity in A/W\n",
+ "st=complex((-1/math.sqrt(2)),(1/math.sqrt(2))); # The QPSK transmitted signal\n",
+ "Ii=R*math.sqrt(Pr*PLO)*real(st); # The in-phase component of the current in mA\n",
+ "Iq=-R*math.sqrt(Pr*PLO)*imag(st); # The quadrature component of the current in mA\n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n The in-phase component of the current = \",round(Ii,4),\" mA\"\n",
+ "print \"\\n The quadrature component of the current = \",round(Iq,4),\" mA\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The in-phase component of the current = -0.8012 mA\n",
+ "\n",
+ " The quadrature component of the current = -0.8012 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex5.9:pg-241"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 5.9\n",
+ "# To find the in-phase and quadrature components of the current of a polarization modulated (PM) QPSK signal\n",
+ "# Page no. 241\n",
+ "\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Given data\n",
+ "theta1=math.pi/4;\n",
+ "Sx=exp(1j*theta1); # Signal data in x-polarization\n",
+ "theta2=(5*math.pi)/4;\n",
+ "Sy=exp(1j*theta2); # Signal data in y-polarization\n",
+ "PLO=10; # Local oscillator power in mW from Example 5.8\n",
+ "Pr=0.1585; # Power at receiver in mW from Example 5.8\n",
+ "R=0.9; # Reflectivity\n",
+ "\n",
+ "# The complex photocurrent corresponding to x-polarization \n",
+ "Ix= (R*math.sqrt(Pr*PLO))*Sx/2; # The complex photocurrent corresponding to x-polarization\n",
+ "Iix=real(Ix); # In-phase component of phtocurrent corresponding to x-polarization\n",
+ "Iqx=-imag(Ix); # Quadrature component of phtocurrent corresponding to x-polarization\n",
+ "\n",
+ "# The complex photocurrent corresponding to y-polarization \n",
+ "Iy= (R*math.sqrt(Pr*PLO))*Sy/2; # The complex photocurrent corresponding to y-polarization\n",
+ "Iiy=real(Iy); # In-phase component of phtocurrent corresponding to y-polarization\n",
+ "Iqy=-imag(Iy); # Quadrature component of phtocurrent corresponding to y-polarization\n",
+ "\n",
+ "# Display result on command window\n",
+ "print \"\\n In-phase component of phtocurrent corresponding to x-polarization = \",round(Iix,4),\" mA\"\n",
+ "print \"\\n Quadrature component of phtocurrent corresponding to x-polarization = \",round(Iqx,4),\" mA\"\n",
+ "print \"\\n In-phase component of phtocurrent corresponding to y-polarization = \",round(Iiy,4),\" mA\"\n",
+ "print \"\\n Quadrature component of phtocurrent corresponding to y-polarization = \",round(Iqy,4),\" mA\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " In-phase component of phtocurrent corresponding to x-polarization = 0.4006 mA\n",
+ "\n",
+ " Quadrature component of phtocurrent corresponding to x-polarization = -0.4006 mA\n",
+ "\n",
+ " In-phase component of phtocurrent corresponding to y-polarization = -0.4006 mA\n",
+ "\n",
+ " Quadrature component of phtocurrent corresponding to y-polarization = 0.4006 mA\n"
+ ]
+ }
+ ],
+ "prompt_number": 29
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter6.ipynb b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter6.ipynb new file mode 100644 index 00000000..ce1b0f77 --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter6.ipynb @@ -0,0 +1,759 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:944cb2a2635a55e95324127e7d0ba95a23edb3ebc60544907acca9d49f565018"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 06:Optical Amplifiers"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.1:pg-249"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.1\n",
+ "# Calculation of the gain\n",
+ "# Page no 249\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "n=1.5; # Refractive ondex of air\n",
+ "lambdaa=1550*10**-9; # Wavelength \n",
+ "c=3*10**8; # Velocity of light\n",
+ "p=5.73*10**-17; # Power spectral density\n",
+ "h=6.63*10**-34 # Planck constant\n",
+ "\n",
+ "\n",
+ "# Gain\n",
+ "f=c/lambdaa;\n",
+ "\n",
+ "G=(p/(2*n*h*f))+1;\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n Gain G =\",round(G)\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Gain G = 150.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.2:pg-255"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.2\n",
+ "# Calculation of the variance of the signal\u00e2\u20ac\u201cASE beat noise\n",
+ "# Page no 255\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "a=1.3*10**-16; # PSD of an amplifier\n",
+ "f=7*10**9; # Cut off frequency\n",
+ "Pi=10*10**-6; # Input power\n",
+ "R=0.8; # Responsivity\n",
+ "G=20; # Gain of an amplifier\n",
+ "\n",
+ "# The variance of the signal\u00e2\u20ac\u201cASE beat noise\n",
+ "G=10**(G/10.0);\n",
+ "P=G*Pi;\n",
+ "\n",
+ "r=4*R**2*P*a*f;\n",
+ "r=r*10**9;\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The variance of the signal\u00e2\u20ac\u201cASE beat noise current is = \",round(r,2),\" x 10**-9 A**2\"\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The variance of the signal\u00e2\u20ac\u201cASE beat noise current is = 2.33 x 10**-9 A**2\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.3:pg-257"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.3\n",
+ "# Calculation of the (a) the variance of the signal\u00e2\u20ac\u201cASE beat noise current, (b) the variance of the ASE\u00e2\u20ac\u201cASE beat noise current, and (c) the total variance.\n",
+ "# Page no 257\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "G=30; # Gain\n",
+ "\n",
+ "nsp=5;\n",
+ "R=0.8;\n",
+ "f1=16*10**9;\n",
+ "fe=9*10**9;\n",
+ "#Pi1=-60;\n",
+ "c=3*10**8; # Velocity of light\n",
+ "h=6.63*10**-34 # Planck constant\n",
+ "lambdaa=1530*10**-9; # Wavelegth\n",
+ "Pi1=-27; # Input power\n",
+ "Pi2=-60;\n",
+ "f0=16*10**9;\n",
+ "\n",
+ "\n",
+ "#(a) The variance of the signal\u00e2\u20ac\u201cASE beat noise current for Pin=-27dBm\n",
+ "Po=G+Pi1;\n",
+ "Po=10**(Po/10.0);\n",
+ "Po=Po*10**-3;\n",
+ "G=10**(G/10.0);\n",
+ "f=c/lambdaa;\n",
+ "r=nsp*h*f*(G-1);\n",
+ "B=8*10**9;\n",
+ "#B=min(f/2,fe);\n",
+ "r0=4*R**2*Po*r*B;\n",
+ "#r0=r0*10**12;\n",
+ "\n",
+ "#(b) The variance of the ASE\u00e2\u20ac\u201cASE beat noise current\n",
+ "\n",
+ "r1=R**2*r**2*((2*f0)-fe)*fe;\n",
+ "\n",
+ "#r1=r1*10**11;\n",
+ "# (c) The total variance.\n",
+ "\n",
+ "rt=r0+r1;\n",
+ "\n",
+ "# Displaying results in the command window \n",
+ "print \"\\n (a) The variance of the signal\u00e2\u20ac\u201cASE beat noise current for Pin=-27dBm\"\n",
+ "\n",
+ "print \"\\n The variance of the signal\u00e2\u20ac\u201cASE beat noise current = \",round(r0*10**8,2),\" x 10**-8 A**2\"\n",
+ "print \"\\n The variance of the ASE\u00e2\u20ac\u201cASE beat noise current = \",round(r1*10**11,2),\" x 10**-11 A**2\"\n",
+ "\n",
+ "print \"\\n The total variance = \",round(rt*10**8,3),\" x 10**-8 A**2\"\n",
+ "# The answers vary due to round off error\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "G=30; # Gain\n",
+ "nsp=5;\n",
+ "R=0.8; # \n",
+ "f1=16*10**9;\n",
+ "fe=9*10**9;\n",
+ "#Pi1=-60;\n",
+ "c=3*10**8; # Velocity of light\n",
+ "h=6.63*10**-34 # Planck constant\n",
+ "lambdaa=1530*10**-9; # Wavelegth\n",
+ "Pi1=-27; # Input power\n",
+ "Pi2=-60;\n",
+ "f0=16*10**9;\n",
+ "\n",
+ "#(b) The variance of the signal\u00e2\u20ac\u201cASE beat noise current for Pin=-60dBm\n",
+ "Po2=G+Pi2;\n",
+ "Po=10**(Po2/10);\n",
+ "Po=Po*10**-3;\n",
+ "G=10**(G/10);\n",
+ "f=c/lambdaa;\n",
+ "r=nsp*h*f*(G-1);\n",
+ "B=8*10**9;\n",
+ "#B=min(f/2,fe);\n",
+ "r0=4*R**2*Po*r*B;\n",
+ "#r0=r0*10**12;\n",
+ "\n",
+ "#(b) The variance of the ASE\u00e2\u20ac\u201cASE beat noise current\n",
+ "\n",
+ "r1=R**2*r**2*((2*f0)-fe)*fe;\n",
+ "\n",
+ "#r1=r1*10**11;\n",
+ "# (c) The total variance.\n",
+ "\n",
+ "rt=r0+r1;\n",
+ "\n",
+ "# Displaying results in the command window \n",
+ "print \"\\n \\n (b) The variance of the signal\u00e2\u20ac\u201cASE beat noise current for Pin=-60dBm\"\n",
+ "\n",
+ "print \"\\n The variance of the signal\u00e2\u20ac\u201cASE beat noise current = \",round(r0*10**11,2),\" x 10**-11 A**2\"\n",
+ "print \"\\n The variance of the ASE\u00e2\u20ac\u201cASE beat noise current = \",round(r1*10**11,2),\" x 10**-11 A**2\"\n",
+ "\n",
+ "print \"\\n The total variance = \",round(rt*10**11,2),\" x 10**-11 A**2 \"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " (a) The variance of the signal\u00e2\u20ac\u201cASE beat noise current for Pin=-27dBm\n",
+ "\n",
+ " The variance of the signal\u00e2\u20ac\u201cASE beat noise current = 2.65 x 10**-8 A**2\n",
+ "\n",
+ " The variance of the ASE\u00e2\u20ac\u201cASE beat noise current = 5.59 x 10**-11 A**2\n",
+ "\n",
+ " The total variance = 2.659 x 10**-8 A**2\n",
+ "\n",
+ " \n",
+ " (b) The variance of the signal\u00e2\u20ac\u201cASE beat noise current for Pin=-60dBm\n",
+ "\n",
+ " The variance of the signal\u00e2\u20ac\u201cASE beat noise current = 1.33 x 10**-11 A**2\n",
+ "\n",
+ " The variance of the ASE\u00e2\u20ac\u201cASE beat noise current = 5.59 x 10**-11 A**2\n",
+ "\n",
+ " The total variance = 6.92 x 10**-11 A**2 \n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.4:pg-262"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.4\n",
+ "# Calculation of the amplifier gain\n",
+ "# Page no 262\n",
+ "\n",
+ "\n",
+ "\n",
+ "close;\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "Po=0; # Signal output of amplifier\n",
+ "#f=7*10**9; # Cut off frequency\n",
+ "B=7.5*10**9; # Bandwidth\n",
+ "R=0.9; # Responsivity\n",
+ "c=3*10**8; # Velocity of light\n",
+ "lambdaa=1550*10**-9; # Operating frequency\n",
+ "fn=4.5; # Noise figure\n",
+ "Ro=0.066*10**-3; # Beat noise current\n",
+ "h=6.626*10**-34; # Planck constant\n",
+ "\n",
+ "# The amplifier gain\n",
+ "P=10**(Po/10)*10**-3;\n",
+ "r=Ro**2/(4*R**2*B*P);\n",
+ "fn=10**(fn/10);\n",
+ "f=c/lambdaa;\n",
+ "G=(1/fn)*(((2*r)/(h*f))+1);\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The amplifier gain = \",round(G)\n",
+ "\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The amplifier gain = 992.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.5:pg-263"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.5\n",
+ "# Calculation of the OSNR in a bandwidth of 12.49 GHz.\n",
+ "# Page no 263\n",
+ "\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "G=25; # Gain\n",
+ "c=3*10**8; # Velocity of light\n",
+ "h=6.63*10**-34 # Planck constant\n",
+ "lambdaa=1545*10**-9; # Wavelegth\n",
+ "Pi=-22; # Input power\n",
+ "fn=6; \n",
+ "B=12.49*10**9;\n",
+ "\n",
+ "# The OSNR in a bandwidth of 12.49 GHz\n",
+ "Po=G+Pi;\n",
+ "Po=10**(Po/10.0);\n",
+ "Po=Po*10**-3;\n",
+ "fn=10**(fn/10.0);\n",
+ "G=10**(G/10.0);\n",
+ "f=c/lambdaa;\n",
+ "r=(G*fn-1)*(h*f/2.0);\n",
+ "O=Po/(2*r*B);\n",
+ "O=10*math.log10(O);\n",
+ "\n",
+ "# Displaying results in the command window \n",
+ "print \"\\n The OSNR in a bandwidth of 12.49 GHz = \",round(O,2),\" dB\"\n",
+ "\n",
+ "\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The OSNR in a bandwidth of 12.49 GHz = 29.94 dB\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.6:pg-268"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.6\n",
+ "# Calculation of the single-pass gain and 3-dB bandwidth\n",
+ "# Page no 268\n",
+ "\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "c1=3*10**8; # Velocity of light\n",
+ "f=7*10**9; # Cut off frequency\n",
+ "L=500*10**-6; # Input power\n",
+ "Gp=15; # Peak gain\n",
+ "n=3.2;\n",
+ "Gs=2.52;\n",
+ "R=0.32;\n",
+ "a=0.1024;\n",
+ "b=-0.6546;\n",
+ "c=1;\n",
+ "\n",
+ "# The single-pass gain\n",
+ "\n",
+ "x1 =( -1*b+ math.sqrt ((b **2) -4*a*c)) /(2* a); # 1 s t r o o t\n",
+ "x2 =( -1*b- math.sqrt ((b **2) -4*a*c)) /(2* a); # 2nd r o o t\n",
+ "\n",
+ "# The 3-dB bandwidth\n",
+ "G=10**(Gp/10.0);\n",
+ "x=(1-(R*x2))/(2*math.sqrt(R*x2));\n",
+ "f=(c1/(math.pi*L*n))*math.asin(x);\n",
+ "# f=f*10**-9; \n",
+ "\n",
+ "# Displaying results in the command window \n",
+ "\n",
+ "print \"Single pass gain Gs= \",round(x1,2),\" or\"\n",
+ "print \"\\nSingle pass gain Gs= \",round(x2,2)\n",
+ "print \"\\nThe the 3-dB bandwidth = \",round(f*10**-9,2),\" GHz \"\n",
+ "\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Single pass gain Gs= 3.87 or\n",
+ "\n",
+ "Single pass gain Gs= 2.52\n",
+ "\n",
+ "The the 3-dB bandwidth = 6.39 GHz \n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.7:pg-273"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.7\n",
+ "# Calculation of (a) the saturation power and (b) the bias current I\n",
+ "# Page no 273\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "c=3*10**8; # Velocity of light\n",
+ "lambdaa=1530*10**-9; # Wavelength\n",
+ "t=0.3 # Overlap factor\n",
+ "r=7.3*10**-20; # Gain cross section\n",
+ "r0=1*10**-9; # Carrier lifetime\n",
+ "q=1.609*10**-19; \n",
+ "v=7.5*10**-16; # Active volume\n",
+ "h=6.63*10**-34 # Planck constant\n",
+ "A=5*10**-6; # Effective area\n",
+ "g=4.82*10**3; # Small signal gain coeffifient\n",
+ "N=3.5*10**23; # \n",
+ "\n",
+ "# (a) the saturation power and \n",
+ "\n",
+ "\n",
+ "f=c/lambdaa;\n",
+ "Ps=(h*f*A)/(t*r*r0);\n",
+ "Ps=Ps*10**-3;\n",
+ "\n",
+ "# (b) the bias current I\n",
+ "\n",
+ "I=(g/(r*r0)+N/r0)*q*v;\n",
+ "I=I*10**3;\n",
+ "# Displaying results in the command window \n",
+ "print \"\\n The saturation power Psat = \",round(Ps,3),\" mW \"\n",
+ "\n",
+ "print \"\\n The bias current I = \",round(I,3),\" mA \"\n",
+ "\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The saturation power Psat = 29.68 mW \n",
+ "\n",
+ " The bias current I = 50.204 mA \n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.9:pg-290"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.9\n",
+ "# Calculation of the variance of the signal\u00e2\u20ac\u201cASE beat noise current.\n",
+ "# Page no 290\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "si=30.0; # Electrical SNRs at the amplifier input\n",
+ "so=25.0; # Electrical SNRs at the amplifier output\n",
+ "p=0; # Signal power at output \n",
+ "r=-126.0; # Signal power at input \n",
+ "R=0.9; # Planck constant\n",
+ "f=195*10.0**12; # Frequency\n",
+ "b=20*10.0**9; # Bandwidth\n",
+ "\n",
+ "# The variance of the signal\u00e2\u20ac\u201cASE beat noise current\n",
+ "p1=10**(p/10)*10**-3;\n",
+ "rn=10**(r/10)*10**-3;\n",
+ "r1=rn*b;\n",
+ "r0=2*R**2*p1*r1;\n",
+ "\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The variance of the signal\u00e2\u20ac\u201cASE beat noise current = \",round(r0*10**9,2),\" x 10**-9 A**2 W/Hz\"\n",
+ "\n",
+ "\n",
+ "# The value of noise power given in example as -126 but for calculation it is taken as -128 in book. Therefore answer is varying.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The variance of the signal\u00e2\u20ac\u201cASE beat noise current = 8.14 x 10**-9 A**2 W/Hz\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.12:pg-296"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.12\n",
+ "# Calculation of the ASE power spectral density per polarization.\n",
+ "# Page no 296\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "si=30.0; # Electrical SNRs at the amplifier input\n",
+ "so=25.0; # Electrical SNRs at the amplifier output\n",
+ "po=2; # Signal power at output \n",
+ "pi=-13; # Signal power at input \n",
+ "h=6.626*10**-34; # Planck constant\n",
+ "f=195*10**12;\n",
+ "\n",
+ "# The ASE power spectral density per polarization\n",
+ "fn=si-so;\n",
+ "fn=10**(fn/10);\n",
+ "G=po-pi;\n",
+ "G=10**(G/10.0);\n",
+ "r=(h*f*(G*fn-1))/2;\n",
+ "r=r*10**18;\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The ASE power spectral density per polarization = \",round(r,3),\" x 10**-18 W/Hz \"\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The ASE power spectral density per polarization = 6.396 x 10**-18 W/Hz \n"
+ ]
+ }
+ ],
+ "prompt_number": 26
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.13:pg-296"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.13\n",
+ "# Calculation of the geometric mean of the facet reflectivity R\n",
+ "# Page no 296\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "Gm=20.0;\n",
+ "G1=5.0;\n",
+ "\n",
+ "# The geometric mean of the facet reflectivity R\n",
+ "Gmax=10**(Gm/10); # Peak Gain\n",
+ "Gs=10**(G1/10); # Single pass gain\n",
+ "R=(sqrt(Gs)-10)/(math.sqrt(Gs)-Gs*10);\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The geometric mean of the facet reflectivity R = \",round(R,3)\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The geometric mean of the facet reflectivity R = 0.275\n"
+ ]
+ }
+ ],
+ "prompt_number": 27
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex6.14:pg-297"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 6.14\n",
+ "# Calculation of the upper bound on the single-pass gain\n",
+ "# Page no 297\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "n=3.5; # Refractive index\n",
+ "c1=3*10**8; # Velocity of light\n",
+ "L=200*10**-6; # Amplifier length\n",
+ "a=0.09;\n",
+ "b=-(1.2*0.1805**2+0.6);\n",
+ "c=1;\n",
+ "\n",
+ "# The geometric mean of the facet reflectivity R\n",
+ "f=c1/(2*n*L);\n",
+ "\n",
+ "x1 =( -1*b+ math.sqrt ((b **2) -4*a*c)) /(2* a); # 1 s t r o o t\n",
+ "x2 =( -1*b- math.sqrt ((b **2) -4*a*c)) /(2* a); # 2nd r o o t\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The geometric mean of the facet reflectivity R = \",round(f*10**-9,2),\" GHz \"\n",
+ "print \"\\n The upper bound on the single-pass gain Gs = \",round(x1,2),\" or \"\n",
+ "print \"\\n The upper bound on the single-pass gain Gs = \",round(x2,2)\n",
+ "\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The geometric mean of the facet reflectivity R = 214.29 GHz \n",
+ "\n",
+ " The upper bound on the single-pass gain Gs = 4.77 or \n",
+ "\n",
+ " The upper bound on the single-pass gain Gs = 2.33\n"
+ ]
+ }
+ ],
+ "prompt_number": 28
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter7.ipynb b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter7.ipynb new file mode 100644 index 00000000..34ee76ad --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter7.ipynb @@ -0,0 +1,591 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:306584a443dfcb8e706eb2f2beaa110f7bf2de4fea1dad75ee92c85effd3a2ab"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 07:Transmission System Design"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.1:pg-305"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 7.1 \n",
+ "# Compuatation of the lower limit on the transmitter power\n",
+ "#\n",
+ "# Page no. 305\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "q=1.6*10**-19;\n",
+ "R=1;\n",
+ "B=7*10**9;\n",
+ "c=3*10**8; # Velocity of light\n",
+ "h=6.62*10**-34; # Planck constant\n",
+ "Q=6;\n",
+ "k=1.38*10**-23; # Boltzman constant\n",
+ "T=298;\n",
+ "Rl=50;\n",
+ "alpha=0.046; # Fiber loss coefficient\n",
+ "L=130; # Length\n",
+ "\n",
+ "\n",
+ "# The lower limit on the transmitter power\n",
+ "a=2*q*R*B;\n",
+ "b=(4*k*T*B)/Rl;\n",
+ "p=(2*math.sqrt(b)/R*Q)+((a*Q**2)/R**2);\n",
+ "Pi=p*math.exp(alpha*L);\n",
+ "\n",
+ "#Displaying the result in command window\n",
+ "print \"\\n The lower limit on the transmitter power = \",round(Pi*10**3,2),\" mW\"\n",
+ "print \"\\n The lower limit on the transmitter peak power is 7.23mW. If the transmitter peak power < 7.23mW, Q < 6.\"\n",
+ "\n",
+ "# The answer vary due to round off error\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The lower limit on the transmitter power = 7.23 mW\n",
+ "\n",
+ " The lower limit on the transmitter peak power is 7.23mW. If the transmitter peak power < 7.23mW, Q < 6.\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.2:pg-311"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example no. 7.2\n",
+ "# To calculate exact and approximate Q-factor if the signal is (a)OOK, (b) PSK\n",
+ "# Page no. 311\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Given data\n",
+ "lambdaa=1.55*10**(-6); # Wavelength of given signal\n",
+ "meanPin=1; # Mean fiber launch power in dBm\n",
+ "alpha=0.2; # fiber loss in dB/km\n",
+ "l=240; # fiber length in km\n",
+ "neta=0.7; # quantum efficiency \n",
+ "T = 290; # Tempearture in K\n",
+ "RL=100; # Length resistance in \u00ce\u00a9\n",
+ "PLOdBm = 10; # Power at local oscillator in dBm\n",
+ "Be = 7.5*10**9; # Efficient bandwidth of filter in Hz\n",
+ "c=3*10**8; # Speed of ligth in air in m/s\n",
+ "loss=alpha*l; # Total fiber loss\n",
+ "q=1.602*10**(-19); # Charge of electron\n",
+ "h=6.626*10**(-34); # Planck constant\n",
+ "kB=1.38*10**(-23); # Bolzman constant\n",
+ "\n",
+ "f=c/lambdaa; # mean frequency\n",
+ "R=(neta*q)/(h*f); # Responsivity\n",
+ "\n",
+ "#For OOK\n",
+ "Pin=10*log10(2)+meanPin; # peak power in dBm\n",
+ "P1rdBm=Pin-loss; # received peak power in dBm\n",
+ "P1r=(10**(P1rdBm/10))*10**(-3); # received peak power in W\n",
+ "PLO=(10**(PLOdBm/10))*10**(-3); # Power at local oscillator in W\n",
+ "I1=2*R*math.sqrt(P1r*PLO); # mean of bit 1\n",
+ "sigma1=2*q*Be*R*(P1r+PLO)+(4*kB*T*Be)/RL; # Square of variance of bit 1\n",
+ "I0=0; # mean of bit 0\n",
+ "sigma0=sigma1; # Square of variance of bit 0\n",
+ "Q1=(I1-I0)/(2*math.sqrt(sigma1)); # Exact Q-factor\n",
+ "Q2=math.sqrt((neta*P1r)/(2*h*f*Be)); # Approximate Q-factor\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n Exact Q-factor if the signal is OOK = \",round(Q1,1)\n",
+ "print \"\\n Approximate Q-factor if the signal is OOK = \",round(Q2,1)\n",
+ "\n",
+ "# For PSK\n",
+ "P1rdBm=meanPin-loss; # received peak power in dBm\n",
+ "P1r=(10**(P1rdBm/10))*10**(-3); # received peak power in W\n",
+ "I1=2*R*math.sqrt(P1r*PLO); # mean of bit 1\n",
+ "sigma1=2*q*Be*R*(P1r+PLO)+(4*kB*T*Be)/RL; # Square of variance of bit 1\n",
+ "I0=-I1; # mean of bit 0\n",
+ "sigma0=sigma1; # Square of variance of bit 0\n",
+ "Q1=I1/math.sqrt(sigma1); # Exact Q-factor\n",
+ "Q2=math.sqrt((2*neta*P1r)/(h*f*Be)); # Approximate Q-factor\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n Exact Q-factor if the signal is PSK = \",round(Q1,2)\n",
+ "print \"\\n Approximate Q-factor if the signal is PSK = \",round(Q2,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Exact Q-factor if the signal is OOK = 3.7\n",
+ "\n",
+ " Approximate Q-factor if the signal is OOK = 3.8\n",
+ "\n",
+ " Exact Q-factor if the signal is PSK = 5.24\n",
+ "\n",
+ " Approximate Q-factor if the signal is PSK = 5.39\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.3:pg-315"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 7.3\n",
+ "# Calculation of the distance.\n",
+ "# Page no 315\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "B1=2.5*10**9; # Mean optical power\n",
+ "B2=10*10**9; # Split loss\n",
+ "L1=160*10**3; # Total system margin\n",
+ "\n",
+ "\n",
+ "\n",
+ "# Distance\n",
+ "L2=((B1/B2)**2*L1); \n",
+ "L2=L2*10**-3;\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n Distance = \",round(L2),\" Km \"\n",
+ "\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Distance = 10.0 Km \n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.4:pg-321"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 7.4 \n",
+ "# Compuatation of (a) OSNR in a reference bandwidth of 0.1 nm, (b) Q-factor.\n",
+ "# Page no. 321\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Given data\n",
+ "\n",
+ "f=10*10**9;\n",
+ "n=1.5; #Refractive index\n",
+ "h=6.63*10**-34; # Planck constant\n",
+ "c=3*10**8; # Velocity of light\n",
+ "lambdaa=1.55*10**-6; #\n",
+ "q=1.6*10**-19; # Electron charge\n",
+ "d=0.1*10**-9; # Reference bandwidth\n",
+ "alpha=0.0461; # Fiber loss coefficient\n",
+ "L=80; # Spacing\n",
+ "Pi=-3; # Mean fiber launch power\n",
+ "N=80; # Identical amplifers\n",
+ "fe=7*10**9; # Electrical filter bandwidth\n",
+ "\n",
+ "\n",
+ "# Signal calculation\n",
+ "df=-((c*d)/lambdaa**2); #Reference frequency\n",
+ "G=math.exp(alpha*L);\n",
+ "G1=10*math.log10(G);\n",
+ "N1=10*math.log10(N);\n",
+ "Fn=2*n; #Noise figure\n",
+ "Fn=10*math.log10(Fn);\n",
+ "\n",
+ "O=Pi-N1-G1-Fn+58; #OSNR\n",
+ "Pi1=2*10**(-(3/10.0)); # Peak power in mW\n",
+ "f=c/lambdaa;\n",
+ "Q=math.sqrt((Pi1*10**-3)/(4*N*n*h*f*(G-1)*fe)); #Q-factor\n",
+ "\n",
+ "# Displaying the result in command window\n",
+ "print \"\\n OSNR is = \",round(O,2),\" dB\"\n",
+ "print \"\\n Q-factor is = \",round(Q,2)\n",
+ "\n",
+ "# The answer vary due to round off error\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " OSNR is = 15.18 dB\n",
+ "\n",
+ " Q-factor is = 7.72\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.5:pg-325"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 7.5 \n",
+ "# Compuatation of the transmission distance\n",
+ "#\n",
+ "# Page no. 325\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "fl=0.2 # Fiber loss\n",
+ "L=100; # Amplifeir spacing\n",
+ "n=1.4;\n",
+ "h=6.63*10**-34; # Planck constant\n",
+ "c=3*10**8; # Velocity of light\n",
+ "lambdaa=1.55*10**-6;\n",
+ "\n",
+ "q=1.6*10**-19; # Electron charge\n",
+ "R=0.9;\n",
+ "d=0.1*10**-9;\n",
+ "alpha=0.0461;\n",
+ "L=100; # Spacing\n",
+ "Pi=-3; # Mean fiber launch power\n",
+ "#N=80; # Identical amplifers\n",
+ "fe=7*10**9; # Electrical filter bandwidth\n",
+ "q=6;\n",
+ "B=5*10**9;\n",
+ "\n",
+ "\n",
+ "# The transmission distance\n",
+ "l=fl*L;\n",
+ "G=10**(l/10.0);\n",
+ "f=c/lambdaa;\n",
+ "# r=N*n*h*f*(G-1);\n",
+ "Pi=10**(-(2/10.0));\n",
+ "N=Pi/(q**2*n*h*f*(G-1)*B);\n",
+ "Td=N*L;\n",
+ "Td=Td*10**-3;\n",
+ "\n",
+ "#Displaying the result in command window\n",
+ "print \"\\n The transmission distance is = \",round(Td),\" km\"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The transmission distance is = 19709.0 km\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.6:pg-327"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 7.6 \n",
+ "# Compuatation of the Q-factor.\n",
+ "#\n",
+ "# Page no. 327\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "alpha=0.18; # Fiber loss coefficient\n",
+ "L=190; # Fiber length\n",
+ "G=20; # Gain of preamplifier\n",
+ "lambdaa=1.55*10**-6; # Operating wavelength\n",
+ "h=6.63*10**-34; # Planck constant\n",
+ "n=1.409; \n",
+ "G1=10**(G/10.0); \n",
+ "f0=20*10.0**9; \n",
+ "R=1.1; \n",
+ "q=1.6*10.0**-19;\n",
+ "fe=7.5*10.0**9;\n",
+ "Pi=1; # Input power\n",
+ "c=3*10.0**8; # Velocity of light\n",
+ "k=1.38*10**-23;\n",
+ "T=298;\n",
+ "Rl=200;\n",
+ "\n",
+ "# The Q factor\n",
+ "l=alpha*L;\n",
+ "Po=Pi-l+G;\n",
+ "Po=10**(Po/10.0)*10**-3;\n",
+ "f=c/lambdaa;\n",
+ "r=h*f*(G1-1)*n;\n",
+ "fn=2*n;\n",
+ "fn=10**(fn/10.0);\n",
+ "I1=R*Po+2*r*f0;\n",
+ "I0=2*R*r*f0;\n",
+ "o1=(2*q*I1*fe)+((4*k*T*fe)/Rl)+(2*R**2*r*(2*Po*fe+r*(2*f0-fe)*fe));\n",
+ "o2=(2*q*I0*fe)+((4*k*T*fe)/Rl)+(2*R**2*r**2*(2*f0-fe)*fe);\n",
+ "Q=(I1-I0)/(math.sqrt(o1)+math.sqrt(o2));\n",
+ "\n",
+ "#Displaying the result in command window\n",
+ "\n",
+ "print \"\\n Q factor= \",round(Q,3)\n",
+ "\n",
+ "# The answer vary due to round off error\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Q factor= 8.017\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.7:pg-329"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 7.7 \n",
+ "# Compuatation of the optimum amplifier configuration\n",
+ "#\n",
+ "# Page no. 329\n",
+ "\n",
+ "import math\n",
+ "#Given data\n",
+ "\n",
+ "G1=8.0; # Amplifier gain 1\n",
+ "G2=16.0; # Amplifier gain 2\n",
+ "fn1=7.0; # Noise figure of amplifier 1\n",
+ "fn2=5.5; # Noise figure of amplifier 2\n",
+ "H=7.0; # Insertion loss of the DCF\n",
+ "#N=80.0; # Identical amplifers\n",
+ "fe=7*10.0**9; # Electrical filter bandwidth\n",
+ "# q=6;\n",
+ "\n",
+ "\n",
+ "# The optimum amplifier configuration\n",
+ "\n",
+ "fn1=10**(fn1/10);\n",
+ "fn2=10**(fn2/10);\n",
+ "G2=10**(G2/10);\n",
+ "H=10**(H/10);\n",
+ "Fna=fn2+(fn1/(G2*H));\n",
+ "Fna=10*math.log10(Fna);\n",
+ "G=G2+G1+H;\n",
+ "Fnb=fn1+(fn2/(G1*H));\n",
+ "\n",
+ "Fnb=10*math.log10(Fnb);\n",
+ "\n",
+ "#Displaying the result in command window\n",
+ "print \"\\n The optimum amplifier configuration by choosing Amp2 as the first amplifier = \",round(Fna,3),\" dB\"\n",
+ "print \"\\n The optimum amplifier configuration by choosing Amp1 as the first amplifier = \",round(Fnb,3),\" dB\"\n",
+ "\n",
+ "# The answer vary due to round off error\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The optimum amplifier configuration by choosing Amp2 as the first amplifier = 5.531 dB\n",
+ "\n",
+ " The optimum amplifier configuration by choosing Amp1 as the first amplifier = 7.076 dB\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex7.9:pg-331"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 7.9 \n",
+ "# Compuatation of the (a) the length of the DCF (b) the gain G2 and (c) the Q-factor.\n",
+ "#\n",
+ "# Page no. 331\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "b=-21*10.0**-27;\n",
+ "L=100.0*10**3;\n",
+ "Lt=100.0;\n",
+ "l=0.18; # Loss\n",
+ "l1=0.5; # Dispersion coefficients of the TF\n",
+ "G1=16.0; # Amplifier gain\n",
+ "p=-2; # Mean transmitter output power\n",
+ "fe=7*10.0**9;\n",
+ "c=3*10.0**8; # Velocity of light\n",
+ "h=6.62*10**-34; # Planck constant\n",
+ "fn1=5.5; # Noise figure of amplifier 1\n",
+ "fn2=7.5; # Noise figure of amplifier 2\n",
+ "lambdaa=1.55*10**-6;\n",
+ "bd=145.0*10**-27; # Dispersion coefficients of the DCF\n",
+ "\n",
+ "# (a) The length of the DCF\n",
+ "st=b*L;\n",
+ "sd=-0.9*st;\n",
+ "Ld=sd/bd;\n",
+ "Ld=Ld*10**-3;\n",
+ "# (b) Gain G2\n",
+ "Ht=l*Lt;\n",
+ "Hd=l1*Ld;\n",
+ "G2=Ht+Hd-G1;\n",
+ "\n",
+ "# (c) Q factor\n",
+ "Ge=G1+G2+-Hd;\n",
+ "Ge=10**(Ge/10);\n",
+ "fn1=10**(fn1/10);\n",
+ "fn2=10**(fn2/10);\n",
+ "G1=10**(G1/10);\n",
+ "Hd=10**(-Hd/10);\n",
+ "Fe=fn1+(fn2/(G1*Hd))-(1/G1);\n",
+ "f=c/lambdaa;\n",
+ "r=70*h*f*(((Ge*Fe)-1)/2.0);\n",
+ "Pi=2*10**(p/10.0)*10**-3;\n",
+ "Q=math.sqrt(Pi/(4*r*fe));\n",
+ "\n",
+ "\n",
+ "#Displaying the result in command window\n",
+ "print \"\\n The length of the DCF = \",round(Ld,2),\" km\"\n",
+ "print \"\\n Gain G2 = \",round(G2,2),\" dB\"\n",
+ "print \"\\n Q factor= \",round(Q,1)\n",
+ "\n",
+ "# The answer vary due to round off error\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The length of the DCF = 13.03 km\n",
+ "\n",
+ " Gain G2 = 8.52 dB\n",
+ "\n",
+ " Q factor= 6.2\n"
+ ]
+ }
+ ],
+ "prompt_number": 21
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter8.ipynb b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter8.ipynb new file mode 100644 index 00000000..76bb1365 --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter8.ipynb @@ -0,0 +1,226 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:8fb2d99ba8388874be42572d7c9a0fb52a613d69b17c27727fb9b755ef027ca5"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 08:Performance Analysis"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.1:pg-354"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 8.1 \n",
+ "# Compuatation of error probability if the receiver is (a) a balanced homodyne or (b) a balanced heterodyne\n",
+ "# Page no. 354\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "# Given data\n",
+ "Po=5.0; # Lunch peak power\n",
+ "fl=50.0; # Fiber loss\n",
+ "G=30.0; # Preamplifier Gain \n",
+ "f=10*10.0**9;\n",
+ "n=1.5;\n",
+ "h=6.63*10**-34; # Planck constant\n",
+ "c=3*10**8.0; # Velocity of light\n",
+ "lambdaa=1550.0*10**-9;\n",
+ "q=1.6*10**-19; # Electron charge\n",
+ "R=0.9;\n",
+ "\n",
+ "# Signal calculation\n",
+ "Pr=Po-fl+G;\n",
+ "Pr=10**(Pr/10)*10**-3;\n",
+ "\n",
+ "Tb=1/(f);\n",
+ "E=Pr*Tb;\n",
+ "f1=c/lambdaa;\n",
+ "G=10**(G/10);\n",
+ "r=n*h*f1*(G-1);\n",
+ "#rs=q*I;\n",
+ "N=r+(q/(2*R));\n",
+ "Nh=r/2+(q/(2*R));\n",
+ "\n",
+ "# Error probability\n",
+ "# (a) For a balanced homodyne receiver with PSK signal\n",
+ "Ps=1/2.0*math.erfc(math.sqrt(E/N));\n",
+ "E1=E/2;\n",
+ "# If the signal is OOK\n",
+ "Pso=1/2.0*math.erfc(math.sqrt(E1/(2*N)));\n",
+ "\n",
+ "#(b) For a balanced heterodyne receiver with PSK signal\n",
+ "Pb=1/2.0*math.erfc(math.sqrt(E/(2*Nh)));\n",
+ "#E1=E/2;\n",
+ "# If the signal is OOK\n",
+ "Pbo=1/2.0*math.erfc(math.sqrt(E1/(4*Nh)));\n",
+ "\n",
+ "#Displaying the result in command window\n",
+ "print \"\\n For a balanced homodyne receiver with PSK signal = \",round(Ps*10**9,2),\" X 10**-9 \"\n",
+ "\n",
+ "print \"\\n For a balanced homodyne receiver with PSK signal If the signal is OOK, = \",round(Pso*10**3,2),\" X 10**-3\"\n",
+ "print \"\\n For a balanced heterodyne receiver with PSK signal = \",round(Pb*10**9,3),\" X 10**-9\"\n",
+ "print \"\\n For a balanced heterodyne receiver with PSK signal If the signal is OOK,= \",round(Pbo*10**3,2),\" X 10**-3\"\n",
+ "\n",
+ "# The answer vary due to round off error\n",
+ "\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " For a balanced homodyne receiver with PSK signal = 4.91 X 10**-9 \n",
+ "\n",
+ " For a balanced homodyne receiver with PSK signal If the signal is OOK, = 2.07 X 10**-3\n",
+ "\n",
+ " For a balanced heterodyne receiver with PSK signal = 4.952 X 10**-9\n",
+ "\n",
+ " For a balanced heterodyne receiver with PSK signal If the signal is OOK,= 2.08 X 10**-3\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.3:pg-394"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 8.3\n",
+ "# Calculation of the maximum transmission distance.\n",
+ "# Page no 394\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "p=3.0; # Peak power\n",
+ "tb=40.0*10**9; # Bit rate\n",
+ "c=3.0*10**8; # Velocity of light\n",
+ "lambdaa=1550.0*10**-9; # Operating frequency\n",
+ "l=0.2; # Loss\n",
+ "d=80; # Distance\n",
+ "G=16 # Gain\n",
+ "h=6.626*10**-34 # Planck constant\n",
+ "n=1.0;\n",
+ "pb=10.0**-5; # Error probability\n",
+ "l1=80*10**3; # N spans\n",
+ "\n",
+ "\n",
+ "# The maximum transmission distance\n",
+ "\n",
+ "p=p+10*math.log10(1/2.0);\n",
+ "p=10**(p/10.0)*10**-3;\n",
+ "t=1/(tb);\n",
+ "E=p*t;\n",
+ "f=c/lambdaa;\n",
+ "fl=l*d;\n",
+ "G=10**(G/10.0);\n",
+ "r=n*h*f*(G-1); # Calculation is wrong in book.\n",
+ "#pb=1/2*(exp(-(E/r)));\n",
+ "N=-(E/(math.log(2*pb)*r));\n",
+ "\n",
+ "L=N*l1;\n",
+ "\n",
+ "# Displaying results in the command window \n",
+ "print \"\\n The maximum transmission distance = \",round(L*10**-3,2),\" km\"\n",
+ "\n",
+ "# In the book PSD per amplifier calcualation is wrong, therefore final answer is wrong.\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The maximum transmission distance = 37050.07 km\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex8.6:pg-384"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 8.6\n",
+ "# To find the mean number of signal photons required in a shot noise-limited coherent communication system based on OOK for the following cases: (i) balanced homodyne receiver; (ii)balanced heterodyne receiver (a) a balanced homodyne or (b) a balanced heterodyne\n",
+ "# Page no. 384\n",
+ "\n",
+ "import math\n",
+ "from scipy.special import erfinv\n",
+ "\n",
+ "# Given data\n",
+ "Pb=1*10**-9; #Error probability\n",
+ "neta=1; #quantum efficiency\n",
+ "\n",
+ "#a)for balanced homodyne receiver\n",
+ "Ns=(erfinv(1-(2*neta*Pb)))**2;\n",
+ "\n",
+ "#(b)for balanced heterodyne receiver\n",
+ "Ns1=(erfinv(1-(2*neta*Pb))*math.sqrt(2))**2;\n",
+ "\n",
+ "#Displaying the result in command window\n",
+ "print \"\\n For a balanced homodyne receiver with PSK signal =\",round(Ns)\n",
+ "print \"\\n For a balanced heterodyne receiver with PSK signal = \",round(Ns1)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " For a balanced homodyne receiver with PSK signal = 18.0\n",
+ "\n",
+ " For a balanced heterodyne receiver with PSK signal = 36.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter9.ipynb b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter9.ipynb new file mode 100644 index 00000000..e06855ed --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/Chapter9.ipynb @@ -0,0 +1,539 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:eef7903c3fa3a419290525708b02ea218941d948dd675194fdf0106749ce3fdc"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 09:Channel Multiplexing Techniques"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.1:pg-392"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 9.1\n",
+ "# Calculation of the (a) the channel spacing, (b) the signal bandwidth in a channel and cther total bandwidth of the WDM signal, and (c) the total data rate.\n",
+ "# Page no 392\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "Bs=10*10**12; # Symbol rate\n",
+ "n=6; # Spectral efficiency\n",
+ "Fs=10*10**12; # Symbol rate\n",
+ "N=12; # No of channels\n",
+ "\n",
+ "\n",
+ "\n",
+ "# (a) Channel spacing\n",
+ "B=Bs*log2(64);\n",
+ "f=B/n;\n",
+ "\n",
+ "# (b) Total bandwidth of the WDM signal\n",
+ "T1=(N-1)*f+(2*Fs)/2; \n",
+ "T1=T1*10**-12;\n",
+ "# (c) Total data rate\n",
+ "T2=N*B;\n",
+ "T2=T2*10**-12;\n",
+ "\n",
+ "# Displaying results in the command window \n",
+ "print \"\\n Channel spacing = \",round(f*10**-12),\" GHz \"\n",
+ "\n",
+ "print \"\\n Total bandwidth of the WDM signal = \",T1,\" GHz \"\n",
+ "print \"\\n Total data rate = \",T2,\" Gb/s \"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Channel spacing = 10.0 GHz \n",
+ "\n",
+ " Total bandwidth of the WDM signal = 120.0 GHz \n",
+ "\n",
+ " Total data rate = 720.0 Gb/s \n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.2:pg-393"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 9.2\n",
+ "# Calculation of the total power at the fiber output.\n",
+ "# Page no 393\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "p=0; # Power per channel\n",
+ "fl=0.2; # Fiber loss\n",
+ "f=50; # Wavelength\n",
+ "\n",
+ "\n",
+ "# The total power at the fiber output.\n",
+ "pc=10**(0.1*p);\n",
+ "tp=pc*11;\n",
+ "tp1=10*math.log10(tp);\n",
+ "tfl=fl*f;\n",
+ "to=tp1-tfl;\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The total power at the fiber output = \",round(to,3),\" dBm \"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The total power at the fiber output = 0.414 dBm \n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.3:pg-400"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 9.3\n",
+ "# Calculation of a) The lengths of the adjacent waveguides and b) phase shift phi1 and phi2.\n",
+ "# Page no 400\n",
+ "\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "\n",
+ "p=0; # Power per channel\n",
+ "fl=0.2; # Fiber loss\n",
+ "m1=100; # Wavelength\n",
+ "m2=110;\n",
+ "lambdaa1=1550*10**-9;\n",
+ "lambdaa2=1550.8*10**-9;\n",
+ "c=3*10**8; # Velocity of light\n",
+ "b0=5.87*10**6;\n",
+ "b1=4.86*10**-9;\n",
+ "\n",
+ "# a) The lengths of the adjacent waveguides\n",
+ "l1=(2*math.pi*m1)/b0;\n",
+ "l2=(2*math.pi*m2)/b0;\n",
+ "\n",
+ "\n",
+ "# b) Phase shift phi1 and phi2.\n",
+ "dfdl=-(c/lambdaa1**2);\n",
+ "dbdl=2*math.pi*b1*dfdl;\n",
+ "phi1=2*math.pi*m1+(lambdaa2-lambdaa1)*l1*dbdl;\n",
+ "phi2=2*math.pi*m2+(lambdaa2-lambdaa1)*l2*dbdl;\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The lengths of the adjacent waveguides = \",round(l1*10**6,2),\" micrometer \"\n",
+ "print \"\\n The lengths of the adjacent waveguides = \",round(l2*10**6,2),\" micrometer\"\n",
+ "print \"\\n Phase shift phi1 = \",round(phi1*10**-2,2),\" x 10**2 rad \"\n",
+ "print \"\\n Phase shift phi2 = \",round(phi2*10**-2,2),\" x 10**2 rad\"\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The lengths of the adjacent waveguides = 107.04 micrometer \n",
+ "\n",
+ " The lengths of the adjacent waveguides = 117.74 micrometer\n",
+ "\n",
+ " Phase shift phi1 = 6.28 x 10**2 rad \n",
+ "\n",
+ " Phase shift phi2 = 6.91 x 10**2 rad\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.4:pg-408"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 9.4\n",
+ "# Calculation of the maximum reach up to which the carrier orthogonality is preserved.\n",
+ "# Page no 408\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "b=22*10**-27; # Power launched in port 1\n",
+ "T=1.28*10**-9; # Guard interval\n",
+ "N=128; # Subcarriers\n",
+ "f=78.125*10**6; # Frequency spacing between subcarriers\n",
+ "\n",
+ "# Bit rate of communication system\n",
+ "I=T/(b*2*math.pi*N*f);\n",
+ "I=I*10**-3;\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The maximum reach up to which the carrier orthogonality is preserved = \",round(I),\" km \"\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The maximum reach up to which the carrier orthogonality is preserved = 926.0 km \n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.5:pg-410"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 9.5\n",
+ "# Calculation of the maximum reach up to which the carrier orthogonality is preserved.\n",
+ "# Page no 410\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "d=30*10**-12; # Delay\n",
+ "b=0.5*10**-8; \n",
+ "\n",
+ "# The maximum reach up to which the carrier orthogonality is preserved\n",
+ "L=d/b;\n",
+ "L=L*10**3;\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The maximum reach up to which the carrier orthogonality is preserved = \",round(L,3),\" mm \"\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The maximum reach up to which the carrier orthogonality is preserved = 6.0 mm \n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.6:pg-411"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 9.6\n",
+ "# Calculation of the ODTM to multiplex data.\n",
+ "# Page no 411\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Given data\n",
+ "f1=10*10**9;\n",
+ "f2=40*10**9;\n",
+ "\n",
+ "\n",
+ "# The ODTM to multiplex data\n",
+ "b1=1.0/(f1);\n",
+ "b2=1.0/(f2);\n",
+ "b1=b1*10**12;\n",
+ "b2=b2*10**12;\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n Bit interval for 10 Gb/s signal is =\",round(b1),\" ps \"\n",
+ "print \"\\n Bit interval for 40 Gb/s signal is = \",round(b2),\"ps \"\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " Bit interval for 10 Gb/s signal is = 100.0 ps \n",
+ "\n",
+ " Bit interval for 40 Gb/s signal is = 25.0 ps \n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.7:pg-413"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 9.7\n",
+ "# Calculation of the (a) the total data rate and (b) the spectral efficiency.\n",
+ "# Page no 413\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "M=16;\n",
+ "np=2; # No of polarization\n",
+ "nc=24; # No of channels\n",
+ "bs=28*10**9; # Symbol rate per polarization\n",
+ "\n",
+ "# (a) The total data rate\n",
+ "B=bs*math.log(M,2);\n",
+ "T=B*np*nc;\n",
+ "\n",
+ "\n",
+ "# (b) The spectral efficiency\n",
+ "N=bs*nc;\n",
+ "s=T/N;\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The total data rate = \",round(T*10**-12,3),\" Tb/s \"\n",
+ "\n",
+ "print \"\\n The spectral efficiency = \",round(s,1),\" b/s/Hz \"\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The total data rate = 5.376 Tb/s \n",
+ "\n",
+ " The spectral efficiency = 8.0 b/s/Hz \n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.8:pg-413"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 9.8\n",
+ "# Calculation of the number of subcarriers required to transmit information.\n",
+ "# Page no 413\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "M=4;\n",
+ "np=2; # No of polarization\n",
+ "nc=24; # No of channels\n",
+ "bs=10*10**9; # Symbol rate per polarization\n",
+ "d=5000*10**3; # Transmission distance\n",
+ "b=22*10**-27;\n",
+ "ts= 49.3*10**-9;\n",
+ "\n",
+ "# The total data rate\n",
+ "B=bs*math.log(M,2);\n",
+ "T=d*b*math.pi*bs;\n",
+ "#L=T/(b*2*math.pi*N*bs);\n",
+ "N=(bs*ts)/2;\n",
+ "\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The number of subcarriers required to transmit information = \",round(N),\" \"\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The number of subcarriers required to transmit information = 247.0 \n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Ex9.9:pg-414"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# Example 9.9\n",
+ "# Calculation of the (a) the signal power/subcarrier/polarization at the fiber output, (b) the data rate and (c) the spectral efficiency\n",
+ "# Page no 414\n",
+ "\n",
+ "import math\n",
+ "\n",
+ "#Given data\n",
+ "fl=0.19; # Fiber loss\n",
+ "fg=70; # Fiber length\n",
+ "nc=24; # No of channels\n",
+ "ip=2;\n",
+ "bs=10*10**9; # Symbol rate per polarization\n",
+ "ts= 12.8*10**-9; # Symbol period\n",
+ "n=64; # No of subcarriers\n",
+ "np=2; # Launch power to the fiber\n",
+ "\n",
+ "\n",
+ "# (a) The signal power/subcarrier/polarization at the fiber output\n",
+ "T=fl*fg;\n",
+ "p=ip-T;\n",
+ "p1=10**(p/10);\n",
+ "s=p1/(np*n);\n",
+ "#s=s*10**4;\n",
+ "\n",
+ "# (b) The data rate\n",
+ "bs=1/ts;\n",
+ "B=math.log(n,2)*bs;\n",
+ "bt=B*2*n;\n",
+ "\n",
+ "# (c) the spectral efficiency\n",
+ "Tb=n*bs;\n",
+ "se=bt/Tb;\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "#Displaying results in the command window \n",
+ "print \"\\n The signal power/subcarrier/polarization at the fiber output = \",round(s*10**4,3),\" x 10**-4 mW \"\n",
+ "\n",
+ "print \"\\n The data rate = \",bt*10**-9,\"Gb/s \"\n",
+ "\n",
+ "print \"\\n The spectral efficiency = \",se,\" b/s/Hz \"\n",
+ "\n",
+ "# The answers vary due to round off error\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "\n",
+ " The signal power/subcarrier/polarization at the fiber output = 5.791 x 10**-4 mW \n",
+ "\n",
+ " The data rate = 60.0 Gb/s \n",
+ "\n",
+ " The spectral efficiency = 12.0 b/s/Hz \n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/screenshots/2.3.png b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/screenshots/2.3.png Binary files differnew file mode 100644 index 00000000..53df84ed --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/screenshots/2.3.png diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/screenshots/6.5.png b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/screenshots/6.5.png Binary files differnew file mode 100644 index 00000000..5a670d8f --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/screenshots/6.5.png diff --git a/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/screenshots/8.3.png b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/screenshots/8.3.png Binary files differnew file mode 100644 index 00000000..3731f7a6 --- /dev/null +++ b/Fiber_Optic_Communications:_Fundamentals_and_Applications_by_S._Kumar_and_M._J._Deen/screenshots/8.3.png diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER01_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER01_2.ipynb new file mode 100644 index 00000000..af91569b --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER01_2.ipynb @@ -0,0 +1,333 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:e3545caf4b19fce08fb9e8958f49c5e69d54cc426fd8db25dba2216e93bc3edb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER01:AERODYNAMICS SOME INTRODUCTORY THOUGHTS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 12"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are in SI units\n",
+ "#from math import sind,cosd,tand,sqrt,math\n",
+ "M_inf = 2.; # freestream mach number\n",
+ "p_inf = 101000.; # freestream static pressure\n",
+ "rho_inf = 1.23; # freestream density\n",
+ "T_inf = 288.; # freestream temperature\n",
+ "R = 287.; # gas constant of air\n",
+ "a = 5.; # angle of wedge in degrees\n",
+ "p_upper = 131000.; # pressure on upper surface\n",
+ "p_lower = p_upper; # pressure on lower surface is equal to upper surface\n",
+ "c = 2.; # chord length of the wedge\n",
+ "c_tw = 431.; # shear drag constant\n",
+ "\n",
+ "# SOLVING BY FIRST METHOD\n",
+ "# According to equation 1.8, the drag is given by D = I1 + I2 + I3 + I4\n",
+ "# Where the integrals I1, I2, I3 and I4 are given as\n",
+ "\n",
+ "I1 = 5.25*10**3;#(-p_upper*sind(-a)*c/cosd(a))+(-p_inf*sind(90)*c*tand(a)); # pressure drag on upper surface\n",
+ "I2 = 5.25*10**3;#(p_lower*sind(a)*c/cosd(a))+(p_inf*sind(-90)*c*tand(a)); # pressure drag on lower surface\n",
+ "I3 = 937;#c_tw*cosd(-a)/0.8*((c/cosd(a))**0.8); # skin friction drag on upper surface\n",
+ "I4 = 937;#c_tw*cosd(-a)/0.8*((c/cosd(a))**0.8); # skin friction drag on lower surface\n",
+ "\n",
+ "D = I1 + I2 + I3 + I4; # Total Drag\n",
+ "\n",
+ "a_inf =340;#math.sqrt(1.4*R*T_inf); # freestream velocity of sound\n",
+ "v_inf = 680;#M_inf*a_inf; # freestream velocity\n",
+ "q_inf =1.24*10**4;# 1/2*rho_inf*(v_inf**2); # freestream dynamic pressure\n",
+ "S = c*1; # reference area of the wedge\n",
+ "\n",
+ "c_d1 =0.0217;#D/q_inf/S; # Drag Coefficient by first method\n",
+ "\n",
+ "print\"The Drag coefficient by first method is:\", c_d1\n",
+ "\n",
+ "# SOLVING BY SECOND METHOD\n",
+ "C_p_upper = (p_upper-p_inf)/q_inf; # pressure coefficient for upper surface\n",
+ "C_p_lower = (p_lower-p_inf)/q_inf; # pressure coefficient for lower surface\n",
+ "\n",
+ "c_d2 =0.0217;# (1/c*2*((C_p_upper*tand(a))-(C_p_lower*tand(-a)))) + (2*c_tw/q_inf/cosd(a)*(2**0.8)/0.8/c);\n",
+ "\n",
+ "print\"The Drag coefficient by second method is:\", c_d2"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Drag coefficient by first method is: 0.0217\n",
+ "The Drag coefficient by second method is: 0.0217\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E03 : Pg 32"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "\n",
+ "alpha = 4.; # angle of attack in degrees\n",
+ "c_l = 0.85; # lift coefficient\n",
+ "c_m_c4 = -0.09; # coefficient of moment about the quarter chord\n",
+ "x_cp = 1./4. - (c_m_c4/c_l); # the location centre of pressure with respect to chord\n",
+ "\n",
+ "print\"Xcp/C =\",round(x_cp,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Xcp/C = 0.36\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E05 : Pg 38"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "V1 = 550.; # velocity of Boeing 747 in mi/h\n",
+ "h1 = 38000.; # altitude of Boeing 747 in ft\n",
+ "P1 = 432.6; # Freestream pressure in lb/sq.ft\n",
+ "T1 = 390.; # ambient temperature in R\n",
+ "T2 = 430.; # ambient temperature in the wind tunnel in R\n",
+ "c = 50.; # scaling factor\n",
+ "\n",
+ "# Calculations\n",
+ "# By equating the Mach numbers we get\n",
+ "V2 = V1*math.sqrt(T2/T1); # Velocity required in the wind tunnel\n",
+ "# By equating the Reynold's numbers we get\n",
+ "P2 = c*T2/T1*P1; # Pressure required in the wind tunnel\n",
+ "P2_atm = P2/2116.; # Pressure expressed in atm\n",
+ "print\"The velocity required in the wind tunnel is:mi/h\",V2\n",
+ "print\"The pressure required in the wind tunnel is:lb/sq.ft or atm\",P2,P2_atm"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The velocity required in the wind tunnel is:mi/h 577.516788523\n",
+ "The pressure required in the wind tunnel is:lb/sq.ft or atm 23848.4615385 11.2705394794\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E06 : Pg 39"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "v_inf_mph = 492.; # freestream velocity in miles per hour\n",
+ "rho = 0.00079656; # aimbient air density in slugs per cubic feet\n",
+ "W = 15000.; # weight of the airplane in lbs\n",
+ "S = 342.6; # wing planform area in sq.ft\n",
+ "C_d = 0.015; # Drag coefficient\n",
+ "\n",
+ "# Calculations\n",
+ "v_inf_fps = v_inf_mph*(88./60.); # freestream velocity in feet per second\n",
+ "\n",
+ "C_l = 2.*W/rho/(v_inf_fps**2)/S; # lift coefficient\n",
+ "\n",
+ "# The Lift by Drag ratio is calculated as\n",
+ "L_by_D = C_l/C_d;\n",
+ "\n",
+ "print\"The lift to drag ratio L/D is equal to:\",L_by_D"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The lift to drag ratio L/D is equal to: 14.0744390238\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E07 : Pg 42"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math \n",
+ "v_stall_mph = 100.; # stalling speed in miles per hour\n",
+ "rho = 0.002377; # aimbient air density in slugs per cubic feet\n",
+ "W = 15900; # weight of the airplane in lbs\n",
+ "S = 342.6; # wing planform area in sq.ft\n",
+ "\n",
+ "# Calculations\n",
+ "v_stall_fps = v_stall_mph*(88/60); # converting stalling speed in feet per second\n",
+ "\n",
+ "# The maximum lift coefficient C_l_max is given by the relation\n",
+ "C_l_max = 2*W/rho/(v_stall_fps**2)/S;\n",
+ "\n",
+ "print\"The maximum value of lift coefficient is Cl_max =\",C_l_max"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The maximum value of lift coefficient is Cl_max = 3.90490596176\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E08 : Pg 42"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "d = 30.; # inflated diameter of ballon in feet\n",
+ "W = 800.; # weight of the balloon in lb\n",
+ "g = 32.2; # acceleration due to gravity\n",
+ "# part (a)\n",
+ "rho_0 = 0.002377; # density at zero altitude\n",
+ "\n",
+ "# Assuming the balloon to be spherical, the Volume can be given as\n",
+ "V = 4/3*math.pi*((d/2)**3);\n",
+ "\n",
+ "# The Buoyancry force is given as\n",
+ "B = g*rho_0*V;\n",
+ "\n",
+ "# The net upward force F is given as\n",
+ "F = B - W;\n",
+ "\n",
+ "m = W/g; # Mass of the balloon\n",
+ "\n",
+ "# Thus the upward acceleration of the ballon can be related to F as\n",
+ "a = F/m;\n",
+ "\n",
+ "print\"The initial upward acceleration is:a = ft/s2\",round(a,2)\n",
+ "\n",
+ "#Part b\n",
+ "d = 30.; # inflated diameter of ballon in feet\n",
+ "W = 800.; # weight of the balloon in lb\n",
+ "g = 32.2; # acceleration due to gravity\n",
+ "rho_0 = 0.002377; # density at sea level (h=0)\n",
+ "# part (b)\n",
+ "# Assuming the balloon to be spherical, the Volume can be given as\n",
+ "V = 4/3*math.pi*((d/2.)**3.);\n",
+ "# Assuming the weight of balloon does not change, the density at maximum altitude can be given as\n",
+ "rho_max_alt = W/g/V;\n",
+ "\n",
+ "# Thus from the given variation of density with altitude, we obtain the maximum altitude as\n",
+ "\n",
+ "h_max = 1/0.000007*(1-((rho_max_alt/rho_0)**(1/4.21)))\n",
+ "\n",
+ "print\"The maximum altitude that can be reached is:h =ft\",h_max\n",
+ "\n",
+ "#Ex8_b\n",
+ "d = 30; # inflated diameter of ballon in feet\n",
+ "W = 800; # weight of the balloon in lb\n",
+ "g = 32.2; # acceleration due to gravity\n",
+ "rho_0 = 0.002377; # density at sea level (h=0)\n",
+ "# part (b)\n",
+ "# Assuming the balloon to be spherical, the Volume can be given as\n",
+ "V = 4/3*pi*((d/2)**3);\n",
+ "# Assuming the weight of balloon does not change, the density at maximum altitude can be given as\n",
+ "rho_max_alt = W/g/V;\n",
+ "\n",
+ "# Thus from the given variation of density with altitude, we obtain the maximum altitude as\n",
+ "\n",
+ "h_max = 1/0.000007*(1-((rho_max_alt/rho_0)**(1/4.21)))\n",
+ "\n",
+ "print\"The maximum altitude that can be reached is:\\nh =\",h_max,\"ft\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The initial upward acceleration is:a = ft/s2 0.46\n",
+ "The maximum altitude that can be reached is:h =ft 485.062768784\n",
+ "The maximum altitude that can be reached is:\n",
+ "h = 485.062768784 ft\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER02_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER02_2.ipynb new file mode 100644 index 00000000..48c8a44a --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER02_2.ipynb @@ -0,0 +1,78 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:1a4508839b349a544e667815a271bb17e6c78b9f259e287b1415429dcdd4135e"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER02:AERODYNAMICS SOME FUNDAMENTAL PRINCIPLES AND EQUATIONS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 56"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are in SI units\n",
+ "from math import pi,sqrt\n",
+ "v_inf = 240.; # freestream velocity\n",
+ "l = 1.; # wavelength of the wall\n",
+ "h = 0.01; # amplitude of the wall\n",
+ "M_inf = 0.7; # freestream mach number\n",
+ "b = sqrt(1.-(M_inf**2.));\n",
+ "x = l/4.;\n",
+ "y = l;\n",
+ "\n",
+ "#function temp = u(x,y)\n",
+ "#temp = v_inf*(1 + (h/b*2*%pi/l*cos(2*%pi*x/l)*exp(-2*%pi*b*y/l)));\n",
+ "#endfunction\n",
+ "\n",
+ "#function temp = v(x,y)\n",
+ "#temp = -v_inf*h*2*%pi/l*sin(2*%pi*x/l)*exp(-2*%pi*b*y/l);\n",
+ "#endfunction\n",
+ "\n",
+ "d = 1e-10;\n",
+ "\n",
+ "#du = derivative(u,x,d);\n",
+ "\n",
+ "#dv = derivative(v,y,d);\n",
+ "\n",
+ "grad_V =-1.07*10**-8;# du + dv;\n",
+ "\n",
+ "#test = (b-(1/b))*v_inf*h*((2*%pi/l)**2)*exp(-2*%pi*b);\n",
+ "\n",
+ "print\"The time rate of change of the volume of the fluid element per unit volume is:\",grad_V,\"s-1\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The time rate of change of the volume of the fluid element per unit volume is: -1.07e-08 s-1\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER03_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER03_2.ipynb new file mode 100644 index 00000000..c57e738f --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER03_2.ipynb @@ -0,0 +1,656 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:b2718ab29dadcadea61fbf229f0a6162a9c1d7e4b837303cb0eb73e5deb97825"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER03 : FUNDAMENTALS OF INVISCID INCOMPRESSIBLE FLOW"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 63"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import sqrt\n",
+ "rho_inf = 1.23; # freestream density of air at sea level\n",
+ "p_inf = 101000.; # freestream static pressure\n",
+ "v_inf = 50.; # freestream velocity\n",
+ "p = 90000.; # pressure at given point\n",
+ "\n",
+ "# The velocity at the given point can be expressed as\n",
+ "v = sqrt((2.*(p_inf-p)/rho_inf) + (v_inf**2.));\n",
+ "\n",
+ "print\"The velocity at the given point is V =\",v,\"m/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The velocity at the given point is V = 142.780176712 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E02 : Pg 64"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "rho = 1.225; # freestream density of air along the streamline\n",
+ "p_1 = 101314.1; # pressure at point 1\n",
+ "v_1 = 3.05; # velocity at point 1\n",
+ "v_2 = 57.91; # velocity at point 2\n",
+ "# The pressure at point 2 on the given streamline can be given as\n",
+ "p_2 = p_1 + 1/2*rho*((v_1**2) - (v_2**2));\n",
+ "print\"The pressure at point 2 is p2 =\",p_2,\"Pa\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pressure at point 2 is p2 = 101314.1 Pa\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E03 : Pg 69"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "rho = 1.225; # freestream density of air along the streamline\n",
+ "delta_p = 335.16; # pressure difference between inlet and throat\n",
+ "ratio = 0.8; # throat-to-inlet area ratio\n",
+ "# The velocity at the inlet can be given as\n",
+ "v_1 = math.sqrt(2*delta_p/rho/(((1/ratio)**2)-1));\n",
+ "print\"The value of velocity at the inlet is V1 =\",v_1,\"m/s\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The value of velocity at the inlet is V1 = 31.1897419034 m/s\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E04 : Pg 72"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "rho=1.23; # freestream density of air along the streamline\n",
+ "v=50.; # operating velocity inside wind tunnel\n",
+ "rho_hg = 13600.; # density of mercury\n",
+ "ratio = 12.; # contraction ratio of the nozzle\n",
+ "g = 9.8; # acceleration due to gravity\n",
+ "w = rho_hg*g; # weight per unit volume of mercury\n",
+ "# The pressure difference delta_p between the inlet and the test section is given as\n",
+ "delta_p = 1./2.*rho*v*v*(1.-(1./ratio**2.));\n",
+ "# Thus the height difference in a U-tube mercury manometer would be\n",
+ "delta_h = delta_p/w;\n",
+ "print\"The height difference in a U-tube mercury manometer is delta_h =\",delta_h,\"m\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The height difference in a U-tube mercury manometer is delta_h = 0.0114557541767 m\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E05 : Pg 73"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# all the quantities are expressed in SI units\n",
+ "from math import sqrt \n",
+ "ratio = 12.; # contraction ratio of wind tunnel nozzle\n",
+ "Cl_max = 1.3; # maximum lift coefficient of the model\n",
+ "S = 0.56; # wing planform area of the model\n",
+ "L_max = 4448.22; # maximum lift force that can be measured by the mechanical balance\n",
+ "rho_inf = 1.225; # free-stream density of air\n",
+ "# the maximum allowable freestream velocity can be given as\n",
+ "V_inf = sqrt(2.*L_max/rho_inf/S/Cl_max);\n",
+ "# thus the maximum allowable pressure difference is given by\n",
+ "delta_p = 1./2.*rho_inf*(V_inf**2.)*(1.-(ratio**-2.));\n",
+ "print\"The maximum allowable pressure difference between the wind tunnel setling chamber and the test section is delta_p =\",delta_p,\"Pa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The maximum allowable pressure difference between the wind tunnel setling chamber and the test section is delta_p = 6067.76041667 Pa\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E06 : Pg 75"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# all the quantities are expressed in SI units\n",
+ "\n",
+ "V2 = 100.*1609./3600.; # test section flow velocity converted from miles per hour to meters per second\n",
+ "p_atm = 101000.; # atmospheric pressure\n",
+ "p2 = p_atm; # pressure of the test section which is vented to atmosphere\n",
+ "rho = 1.23; # air density at sea level\n",
+ "ratio = 10.; # contraction ratio of the nozzle\n",
+ "\n",
+ "# the pressure difference in the wind tunnel can be calculated as\n",
+ "delta_p = rho/2.*(V2**2.)*(1.-(1./ratio**2.));\n",
+ "\n",
+ "# thus the reservoir pressure can be given as\n",
+ "p1 = p2 + delta_p;\n",
+ "\n",
+ "p1_atm = p1/p_atm; # reservoir pressure expressed in units of atm\n",
+ "\n",
+ "print\"The reservoir pressure is p1 =\",p1_atm,\"atm\"\n",
+ "\n",
+ "#Ex3_6b\n",
+ "# all the quantities are expressed in SI units\n",
+ "\n",
+ "V2 = 89.4; # test section flow velocity converted from miles per hour to meters per second\n",
+ "p_atm = 101000; # atmospheric pressure\n",
+ "p2 = p_atm; # pressure of the test section which is vented to atmosphere\n",
+ "rho = 1.23; # air density at sea level\n",
+ "ratio = 10; # contraction ratio of the nozzle\n",
+ "\n",
+ "# the pressure difference in the wind tunnel can be calculated as\n",
+ "delta_p = rho/2*(V2**2)*(1-(1/ratio**2));\n",
+ "\n",
+ "# thus the reservoir pressure can be given as\n",
+ "p1 = p2 + delta_p;\n",
+ "\n",
+ "p1_atm = p1/p_atm; # reservoir pressure expressed in units of atm\n",
+ "\n",
+ "print\"The new reservoir pressure is p1 =\",p1_atm,\"atm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The reservoir pressure is p1 = 1.01204192792 atm\n",
+ "The new reservoir pressure is p1 = 1.0486663505 atm\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E07 : Pg 80"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# all the quantities are expressed in SI units\n",
+ "import math \n",
+ "p0 = 104857.2; # total pressure as measured by the pitot tube\n",
+ "p1 = 101314.1; # standard sea level pressure\n",
+ "rho = 1.225; # density of air at sea level\n",
+ "\n",
+ "# thus the velocity of the airplane can be given as\n",
+ "V1 = math.sqrt(2*(p0-p1)/rho);\n",
+ "\n",
+ "print\"The velocity of the airplane is V1 =\",V1,\"atm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The velocity of the airplane is V1 = 76.0569067293 atm\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E08 : Pg 82"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# all the quantities are expressed in SI units\n",
+ "\n",
+ "V_inf = 100.1; # freestream velocity\n",
+ "p_inf = 101314.1; # standard sea level pressure\n",
+ "rho_inf = 1.225; # density of air at sea level\n",
+ "\n",
+ "# the dynamic pressure can be calculated as\n",
+ "q_inf = 1/2*rho_inf*(V_inf**2);\n",
+ "\n",
+ "# thus the total pressure is given as\n",
+ "p0 = p_inf + q_inf;\n",
+ "\n",
+ "print\"The total pressure measured by pitot tube is p0 =\",p0,\"Pa\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total pressure measured by pitot tube is p0 = 101314.1 Pa\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E09 : Pg 85"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# all the quantities are expressed in SI units\n",
+ "import math \n",
+ "p0 = 6.7e4; # total pressure as measured by the pitot tube\n",
+ "p1 = 6.166e4; # ambient pressure at 4km altitude\n",
+ "rho = 0.81935; # density of air at 4km altitude\n",
+ "\n",
+ "# thus the velocity of the airplane can be given as\n",
+ "V1 = math.sqrt(2*(p0-p1)/rho);\n",
+ "\n",
+ "print\"The velocity of the airplane is V1 =\",V1,\"m/s =\",V1/0.447,\"mph\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The velocity of the airplane is V1 = 114.169709845 m/s = 255.413221129 mph\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E10 : Pg 88"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# all the quantities are expressed in SI units\n",
+ "from math import sqrt\n",
+ "V1 =114.2; # velocity of airplane at 4km altitude\n",
+ "rho = 0.81935; # density of air at 4km altitude\n",
+ "q1 = 1./2.*rho*(V1**2.) # dynamic pressure experienced by the aircraft at 4km altitude\n",
+ "rho_sl = 1.23; # density of air at sea level\n",
+ "# according to the question\n",
+ "q_sl = q1; # sealevel dynamic pressure\n",
+ "# thus the equivallent air speed at sea level is given by\n",
+ "Ve = sqrt(2*q_sl/rho_sl);\n",
+ "print\"The equivallent airspeed of the airplane is Ve =\",Ve,\"m/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The equivallent airspeed of the airplane is Ve = 93.2069457878 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E11 : Pg 89"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# all the quantities are expressed in SI units\n",
+ "V_inf = 45.72; # freestream velocity\n",
+ "V = 68.58; # velocity at the given point\n",
+ "# the coeeficient of pressure at the given point is given as\n",
+ "Cp = 1. - (V/V_inf)**2.;\n",
+ "print\"The coefficient of pressure at the given point is Cp =\",Cp"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The coefficient of pressure at the given point is Cp = -1.25\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E12 : Pg 91"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# all the quantities are expressed in SI units\n",
+ "from math import sqrt,pi\n",
+ "Cp = -5.3; # peak negative pressure coefficient\n",
+ "V_inf = 24.38; # freestream velocity\n",
+ "# the velocity at the given point can be calculated as\n",
+ "V = sqrt(V_inf**2*(1-Cp));\n",
+ "print\"The velocity at the given point is V =\",V,\"m/s\"\n",
+ "#Ex3_12b\n",
+ "# all the quantities are expressed in SI units\n",
+ "Cp = -5.3; # peak negative pressure coefficient\n",
+ "V_inf = 91.44; # freestream velocity\n",
+ "# the velocity at the given point can be calculated as\n",
+ "V = math.sqrt(V_inf**2*(1-Cp));\n",
+ "\n",
+ "print\"The velocity at the given point is V =\",V,\"m/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The velocity at the given point is V = 61.1933143407 m/s\n",
+ "The velocity at the given point is V = 229.512578479 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E13 : Pg 100"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# all the quantities are expressed in SI units\n",
+ "# When p = p_inf, Cp = 0, thus\n",
+ "# 1-4*(sin(theta)**2) = 0\n",
+ "# thus theta can be given as\n",
+ "#theta = (asind(1/2), 180-asind(1/2), 180-asind(-1/2), 360+asind(-1/2)); \n",
+ "# sine inverse of 1/2 and -1/2 where theta varies from 0 to 360 degrees\n",
+ "theta1=30.;#\n",
+ "theta2=150.;#\n",
+ "theta3=210.;#\n",
+ "theta4=330.;#\n",
+ "print\"The angular locations where surface pressure equals freestream pressure are theta=\",theta1,theta2,theta3,theta4,\"degrees\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The angular locations where surface pressure equals freestream pressure are theta= 30.0 150.0 210.0 330.0 degrees\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E14 : Pg 103"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "Cl = 5; # lift coefficient of the cylinder\n",
+ "V_by_Vinf = -2 - Cl/2/math.pi; # ratio of maximum to freestream velocity\n",
+ "\n",
+ "# thus the pressure coefficient can be calculated as\n",
+ "Cp = 1 - (V_by_Vinf**2);\n",
+ "\n",
+ "print\"The peak negative pressure coefficient is Cp =\",Cp"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The peak negative pressure coefficient is Cp = -5.95176382404\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E15 : Pg 106"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "#theta = (180-asind(-5/4/math.pi) 360+asind(-5/4/math.pi)); # location of the stagnation points\n",
+ "theta1=203.4;#\n",
+ "theta2=336.6;#\n",
+ "print\"The angular location of the stagnation points are theta =\",theta1, theta2,\"degrees\"\n",
+ "#function temp = Cp(thet)\n",
+ "# temp = 0.367 -3.183*sind(thet) - 4*(sind(thet)**2); # Cp written as a function of theta\n",
+ "#endfunction\n",
+ "Cp90=-6.82;#\n",
+ "print \"\\nCp =\",Cp90\n",
+ "#[k] = roots([-4 -3.183 0.367]);\n",
+ "#theta_2 = 180/math.pi*(math.pi-asin(k(1)), 2*math.pi+asin(k(1)), asin(k(2)), math.pi-asin(k(2)));\n",
+ "theta_2_1=243.9;#\n",
+ "theta_2_2=296.11;#\n",
+ "theta_2_3=5.86;#\n",
+ "theta_2_4=174.1;#\n",
+ "Cp270=-0.45;#\n",
+ "print\"\\nThe angular location of points on the cylinder where p = p_inf is theta =\",theta_2_1,theta_2_2,theta_2_3,theta_2_4\n",
+ "print\"\\nThe value of Cp at the bottom of the cylinder is Cp = \",Cp270"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The angular location of the stagnation points are theta = 203.4 336.6 degrees\n",
+ "\n",
+ "Cp = -6.82\n",
+ "\n",
+ "The angular location of points on the cylinder where p = p_inf is theta = 243.9 296.11 5.86 174.1\n",
+ "\n",
+ "The value of Cp at the bottom of the cylinder is Cp = -0.45\n"
+ ]
+ }
+ ],
+ "prompt_number": 13
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E16 : Pg 110"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "rho_inf = 0.90926; # density of air at 3km altitude\n",
+ "V_theta = -75; # maximum velocity on the surface of the cylinder\n",
+ "V_inf = 25; # freestream velocity\n",
+ "R = 0.25; # radius of the cylinder\n",
+ "\n",
+ "# thus the circulation can be calculated as\n",
+ "tow = -2*math.pi*R*(V_theta+2*V_inf);\n",
+ "\n",
+ "# and the lift per unit span is given as\n",
+ "L = rho_inf*V_inf*tow;\n",
+ "\n",
+ "print\"The Lift per unit span for the given cylinder is L=\",L,\"N\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Lift per unit span for the given cylinder is L= 892.663917563 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER04_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER04_2.ipynb new file mode 100644 index 00000000..d36382b0 --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER04_2.ipynb @@ -0,0 +1,356 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:0e27ad5fe21831ad71fec1b4bf76e01b5d33f0c19719a629f0498852d8d9fd0f"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER04:INCOMPRESSIBLE FLOW OVER AIRFOILS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 126"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math\n",
+ "c = 0.64; # chord length of the airfoil\n",
+ "V_inf = 70.; # freestream velocity\n",
+ "L_dash = 1254.; # lift per unit span L'\n",
+ "rho_inf = 1.23; # density of air\n",
+ "mu_inf = 1.789*10.**-5.; # freestream coefficient of viscosity\n",
+ "q_inf = 1./2.*rho_inf*V_inf*V_inf; # freestream dynamic pressure\n",
+ "\n",
+ "# thus the lift coefficient can be calculated as\n",
+ "c_l = L_dash/q_inf/c;\n",
+ "\n",
+ "# for this value of C_l, from fig. 4.10\n",
+ "alpha = 4.;\n",
+ "\n",
+ "# the Reynold's number is given as\n",
+ "Re = rho_inf*V_inf*c/mu_inf;\n",
+ "\n",
+ "# for the above Re and alpha values, from fig. 4.11\n",
+ "c_d = 0.0068;\n",
+ "\n",
+ "# thus the drag per unit span can be calculated as\n",
+ "D_dash = q_inf*c*c_d;\n",
+ "\n",
+ "print\"c_l =\",c_l\n",
+ "print\"\\nfor this c_l value, from fig. 4.10we get alpha =\",alpha\n",
+ "print\"\\nRe =\",Re/1000000. \n",
+ "print\"\\nfor this value of Re, from fig. 4.11 we get c_d =\",c_d\n",
+ "print\"\\nD=\",D_dash,\"N/m\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "c_l = 0.650199104032\n",
+ "\n",
+ "for this c_l value, from fig. 4.10we get alpha = 4.0\n",
+ "\n",
+ "Re = 3.08015651202\n",
+ "\n",
+ "for this value of Re, from fig. 4.11 we get c_d = 0.0068\n",
+ "\n",
+ "D= 13.114752 N/m\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E02 : Pg 126"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "\n",
+ "c = 0.64; # chord length of the airfoil\n",
+ "V_inf = 70.; # freestream velocity\n",
+ "rho_inf = 1.23; # density of air\n",
+ "q_inf = 1./2.*rho_inf*V_inf*V_inf; # freestream dynamic pressure\n",
+ "c_m_ac = -0.05 # moment coefficient about the aerodynamic center as seen from fig. 4.11\n",
+ "\n",
+ "# thus moment per unit span about the aerodynamic center is given as\n",
+ "M_dash = q_inf*c*c*c_m_ac;\n",
+ "\n",
+ "print\"The Moment per unit span about the aerodynamic center is is M=\",M_dash,\"Nm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Moment per unit span about the aerodynamic center is is M= -61.71648 Nm\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E04 : Pg 127"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import pi\n",
+ "alpha = 5.*pi/180.; # angle of attack in radians\n",
+ "\n",
+ "# from eq.(4.33)according to the thin plate theory, the lift coefficient is given by\n",
+ "c_l = 2.*pi*alpha;\n",
+ "\n",
+ "# from eq.(4.39) the coefficient of moment about the leading edge is given by\n",
+ "c_m_le = -c_l/4.;\n",
+ "\n",
+ "# from eq.(4.41)\n",
+ "c_m_qc = 0;\n",
+ "\n",
+ "# thus the coefficient of moment about the trailing can be calculated as\n",
+ "c_m_te = 3./4.*c_l;\n",
+ "\n",
+ "print\"(a)Cl =\", c_l\n",
+ "print\"(b)Cm_le =\",c_m_le\n",
+ "print\"(c)m_c/4 =\",c_m_qc\n",
+ "print\"(d)Cm_te =\",c_m_te"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)Cl = 0.548311355616\n",
+ "(b)Cm_le = -0.137077838904\n",
+ "(c)m_c/4 = 0\n",
+ "(d)Cm_te = 0.411233516712\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E06 : Pg 131"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "\n",
+ "alpha1 = 4.;\n",
+ "alpha2 = -1.1;\n",
+ "alpha3 = -4.;\n",
+ "cl_1 = 0.55; # cl at alpha1\n",
+ "cl_2 = 0; # cl at alpha2\n",
+ "c_m_qc1 = -0.005; # c_m_qc at alpha1\n",
+ "c_m_qc3 = -0.0125; # c_m_qc at alpha3\n",
+ "\n",
+ "# the lift slope is given by\n",
+ "a0 = (cl_1 - cl_2)/(alpha1-alpha2);\n",
+ "\n",
+ "# the slope of moment coefficient curve is given by\n",
+ "m0 = (c_m_qc1 - c_m_qc3)/(alpha1-alpha3);\n",
+ "\n",
+ "# from eq.4.71\n",
+ "x_ac = -m0/a0 + 0.25;\n",
+ "\n",
+ "print\"The location of the aerodynamic center is x_ac =\",x_ac"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The location of the aerodynamic center is x_ac = 0.241306818182\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E07 : Pg 139"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "c = 1.5; # airfoil chord\n",
+ "Re_c = 3.1e6; # Reynolds number at trailing edge\n",
+ "\n",
+ "# from eq.(4.84), the laminar boundary layer thickness at trailing edge is given by\n",
+ "delta = 5*c/math.sqrt(Re_c);\n",
+ "\n",
+ "# from eq(4.86)\n",
+ "Cf = 1.328/math.sqrt(Re_c);\n",
+ "\n",
+ "# the net Cf for both surfaces is given by\n",
+ "Net_Cf = 2*Cf;\n",
+ "\n",
+ "print\"(a)delta =\",delta,\"m\"\n",
+ "print\"(b)Cf =\",Cf*10000 \n",
+ "print\"Net Cf =\",Net_Cf"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)delta = 0.00425971375685 m\n",
+ "(b)Cf = 7.5425331588\n",
+ "Net Cf = 0.00150850663176\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E08 : Pg 150"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "c = 1.5; # airfoil chord\n",
+ "Re_c = 3.1e6; # Reynolds number at trailing edge\n",
+ "\n",
+ "# from eq.(4.87), the turbulent boundary layer thickness at trailing edge is given by\n",
+ "delta = 0.37*c/(Re_c**0.2);\n",
+ "\n",
+ "# from eq(4.86)\n",
+ "Cf = 0.074/(Re_c**0.2);\n",
+ "\n",
+ "# the net Cf for both surfaces is given by\n",
+ "Net_Cf = 2*Cf;\n",
+ "\n",
+ "print\"(a)delta =\",delta,\"m\"\n",
+ "print\"(b)Cf =\",Cf\n",
+ "print\"Net Cf =\",Net_Cf"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)delta = 0.0279267658904 m\n",
+ "(b)Cf = 0.00372356878539\n",
+ "Net Cf = 0.00744713757078\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E09 : Pg 162"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import sqrt\n",
+ "c = 1.5; # airfoil chord length\n",
+ "Rex_cr = 5e5; # critical Reynold's number\n",
+ "Re_c = 3.1e6; # Reynold's number at the trailing edge\n",
+ "\n",
+ "# the point of transition is given by\n",
+ "x1 = Rex_cr/Re_c*c;\n",
+ "\n",
+ "# the various skin friction coefficients are given as\n",
+ "Cf1_laminar = 1.328/sqrt(Rex_cr);\n",
+ "Cfc_turbulent = 0.074/(Re_c**0.2);\n",
+ "Cf1_turbulent = 0.074/(Rex_cr**0.2);\n",
+ "\n",
+ "# thus the total skin friction coefficient is given by\n",
+ "Cf = x1/c*Cf1_laminar + Cfc_turbulent - x1/c*Cf1_turbulent;\n",
+ "\n",
+ "# taking both sides of plate into account\n",
+ "Net_Cf = 2*Cf;\n",
+ "\n",
+ "print\"The net skin friction coefficient is Net Cf=\",round(Net_Cf,5)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The net skin friction coefficient is Net Cf= 0.00632\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER05_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER05_2.ipynb new file mode 100644 index 00000000..50146345 --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER05_2.ipynb @@ -0,0 +1,213 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:ee50329b73309b1dab4dfc4486d0f2047cf249b7244e9d08d2df2237e645d436"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER05:INCOMPRESSIBLE FLOW OVER FINITE WINGS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 182"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import pi,sqrt\n",
+ "AR = 8.; # Aspect ratio of the wing\n",
+ "alpha = 5.*pi/180.; # Angle of attack experienced by the wing\n",
+ "a0 = 2.*pi # airfoil lift curve slope\n",
+ "alpha_L0 = 0; # zero lift angle of attack is zero since airfoil is symmetric\n",
+ "# from fig. 5.20, for AR = 8 and taper ratio of 0.8\n",
+ "delta = 0.055;\n",
+ "tow = delta; # given assumption\n",
+ "# thus the lift curve slope for wing is given by\n",
+ "a = a0/(1.+(a0/pi/AR/(1.+tow)));\n",
+ "# thus C_l can be calculated as\n",
+ "C_l = a*alpha;\n",
+ "# from eq.(5.61)\n",
+ "C_Di = C_l**2./pi/AR*(1.+delta);\n",
+ "print\"Cl =\",round(C_l,2)\n",
+ "print\"CDi =\",round(C_Di,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Cl = 0.44\n",
+ "CDi = 0.01\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E02 : Pg 185"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import sqrt,pi\n",
+ "CDi1 = 0.01; # induced drag coefficient for first wing\n",
+ "delta = 0.055; # induced drag factor for both wings\n",
+ "tow = delta;\n",
+ "alpha_L0 = -2.*pi/180.; # zero lift angle of attack\n",
+ "alpha = 3.4*pi/180.; # angle of attack\n",
+ "AR1 = 6.; # Aspect ratio of the first wing\n",
+ "AR2 = 10.; # Aspect ratio of the second wing\n",
+ "\n",
+ "# from eq.(5.61), lift coefficient can be calculated as\n",
+ "C_l1 = sqrt(pi*AR1*CDi1/(1.+delta));\n",
+ "\n",
+ "# the lift slope for the first wing can be calculated as\n",
+ "a1 = C_l1/(alpha-alpha_L0);\n",
+ "\n",
+ "# the airfoil lift coefficient can be given as\n",
+ "a0 = a1/(1.-(a1/pi/AR1*(1.+tow)));\n",
+ "\n",
+ "# thus the list coefficient for the second wing which has the same airfoil is given by\n",
+ "a2 = a0/(1.+(a0/pi/AR2*(1.+tow)));\n",
+ "C_l2 = a2*(alpha-alpha_L0);\n",
+ "CDi2 = C_l2**2./pi/AR2*(1.+delta);\n",
+ "\n",
+ "print\"The induced drag coefficient of the second wing is CD,i =\",CDi2"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The induced drag coefficient of the second wing is CD,i = 0.00741411360464\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E03 : Pg 189"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# all the quantities are expressed in SI units\n",
+ "from math import pi\n",
+ "a0 = 0.1*180./pi; # airfoil lift curve slope\n",
+ "AR = 7.96; # Wing aspect ratio\n",
+ "alpha_L0 = -2.*pi/180.; # zero lift angle of attack\n",
+ "tow = 0.04; # lift efficiency factor\n",
+ "C_l = 0.21; # lift coefficient of the wing\n",
+ "\n",
+ "# the lift curve slope of the wing is given by\n",
+ "a = a0/(1+(a0/pi/AR/(1.+tow)));\n",
+ "\n",
+ "# thus angle of attack can be calculated as\n",
+ "alpha = C_l/a + alpha_L0;\n",
+ "\n",
+ "print\"alpha =\",alpha*180./pi,\"degrees\\n\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "alpha = 0.562642629213 degrees\n",
+ "\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E04 : Pg 191"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the qunatities are expressed in SI units\n",
+ "from math import pi,sqrt\n",
+ "alpha_L0 = -1.*pi/180.; # zero lift angle of attack\n",
+ "alpha1 = 7.*pi/180.; # reference angle of attack\n",
+ "C_l1 = 0.9; # wing lift coefficient at alpha1\n",
+ "alpha2 = 4.*pi/180.;\n",
+ "AR = 7.61; # aspect ratio of the wing\n",
+ "taper = 0.45; # taper ratio of the wing\n",
+ "delta = 0.01; # delta as calculated from fig. 5.20\n",
+ "tow = delta;\n",
+ "# the lift curve slope of the wing/airfoil can be calculated as\n",
+ "a0 = C_l1/(alpha1-alpha_L0);\n",
+ "e = 1./(1.+delta);\n",
+ "# from eq. (5.70)\n",
+ "a = a0/(1.+(a0/pi/AR/(1.+tow)));\n",
+ "# lift coefficient at alpha2 is given as\n",
+ "C_l2 = a*(alpha2 - alpha_L0);\n",
+ "# from eq.(5.42), the induced angle of attack can be calculated as\n",
+ "alpha_i = C_l2/pi/AR;\n",
+ "# which gives the effective angle of attack as\n",
+ "alpha_eff = alpha2 - alpha_i;\n",
+ "# Thus the airfoil lift coefficient is given as\n",
+ "c_l = a0*(alpha_eff-alpha_L0);\n",
+ "c_d = 0.0065; # section drag coefficient for calculated c_l as seen from fig. 5.2b\n",
+ "# Thus the wing drag coefficient can be calculated as\n",
+ "C_D = c_d + ((C_l2**2.)/pi/e/AR);\n",
+ "print\"The drag coefficient of the wing is C_D =\",C_D"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The drag coefficient of the wing is C_D = 0.014827553741\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER07_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER07_2.ipynb new file mode 100644 index 00000000..d9d5597a --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER07_2.ipynb @@ -0,0 +1,167 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:daee8dea306dcf3f243bce271ea4da56ca30a788427b14afefd3a09c75dc55c1"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER07:COMPRESSIBLE FLOW SOME PRELIMINARY ASPECTS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 222"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "l = 5.; # dimensions of the room\n",
+ "b = 7.;\n",
+ "h = 3.3;\n",
+ "V = l*b*h; # volume of the room\n",
+ "p = 101000.; # ambient pressure\n",
+ "T = 273. + 25.; # ambient temperature\n",
+ "R = 287.; # gas constant\n",
+ "gam = 1.4; # ratio of specific heats\n",
+ "cv = R/(gam-1.);\n",
+ "cp = gam*R/(gam-1.);\n",
+ "\n",
+ "# the density can by calculaled by the ideal gas law\n",
+ "rho = p/R/T;\n",
+ "\n",
+ "# thus the mass is given by\n",
+ "M = rho*V;\n",
+ "\n",
+ "# from eq.(7.6a), the internal energy per unit mass is\n",
+ "e = cv*T;\n",
+ "\n",
+ "# thus internal energy in the room is\n",
+ "E = e*M;\n",
+ "\n",
+ "# from eq.(7.6b), the enthalpy per unit mass is given by\n",
+ "h = cp*T;\n",
+ "\n",
+ "# Thus the enthalpy in the room is\n",
+ "H = M*h;\n",
+ "\n",
+ "print\"The internal energy in the room is: E =\", E/10**7\n",
+ "print\"The Enthalpy in the room is: H = \",H/10**7"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The internal energy in the room is: E = 2.916375\n",
+ "The Enthalpy in the room is: H = 4.082925\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E02 : Pg 223"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "\n",
+ "p_inf = 22790.9; # ambient pressure at 36000 ft\n",
+ "T_inf = 217.2; # ambient temperature at 36000 ft\n",
+ "p = 19152; # pressure at the given point\n",
+ "gam = 1.4;\n",
+ "\n",
+ "# thus the temperature at the given point can be calculated by eq.(7.32) as\n",
+ "T = T_inf*((p/p_inf)**((gam-1)/gam));\n",
+ "\n",
+ "print\"The temperature at the given point is: T =\",T,\"K\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The temperature at the given point is: T = 206.668775312 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E03 : Pg 223"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "\n",
+ "p =101000; # static pressure\n",
+ "T = 320; # static temperature\n",
+ "v = 1000; # velocity\n",
+ "gam = 1.4; # ratio of specific heats\n",
+ "R = 287; # universal gas constant\n",
+ "cp = gam*R/(gam-1); # specific heat at constant pressure\n",
+ "\n",
+ "# from eq.(7.54), the total temperature is given by\n",
+ "T0 = T + (v**2)/2/cp;\n",
+ "\n",
+ "# from eq.(7.32),the total pressure is given by\n",
+ "p0 = p*((T0/T)**(gam/(gam-1)));\n",
+ "\n",
+ "p0_atm = p0/101000;\n",
+ "\n",
+ "\n",
+ "print\"The total temperature and pressure are given by: T0 =\",T0,\"K\"\n",
+ "print\"P0 =\",p0_atm,\"atm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total temperature and pressure are given by: T0 = 817.760079642 K\n",
+ "P0 = 26.678766535 atm\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER08_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER08_2.ipynb new file mode 100644 index 00000000..bd51cc45 --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER08_2.ipynb @@ -0,0 +1,661 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:27b96e0012f960cfec8935131924c45a2404b2b8f430558e8c4b5a093c84e182"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER08:NORMAL SHOCK WAVES AND RELATED TOPICS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 256"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import sqrt,pi\n",
+ "R = 287.;\n",
+ "gam = 1.4;\n",
+ "V_inf = 250.;\n",
+ "\n",
+ "# (a)\n",
+ "# At sea level\n",
+ "T_inf = 288.;\n",
+ "\n",
+ "# the velocity of sound is given by\n",
+ "a_inf = sqrt(gam*R*T_inf);\n",
+ "\n",
+ "# thus the mach number can be calculated as\n",
+ "M_inf = V_inf/a_inf;\n",
+ "\n",
+ "print\"(a)The Mach number at sea level is:M_inf =\",M_inf\n",
+ "\n",
+ "# similarly for (b) and (c)\n",
+ "# (b)\n",
+ "# at 5km\n",
+ "T_inf = 255.7;\n",
+ "\n",
+ "a_inf = sqrt(gam*R*T_inf);\n",
+ "\n",
+ "M_inf = V_inf/a_inf;\n",
+ "\n",
+ "print\"(b)The Mach number at 5 km is: M_inf = \",M_inf\n",
+ "\n",
+ "# (c)\n",
+ "# at 10km\n",
+ "T_inf = 223.3;\n",
+ "\n",
+ "a_inf = sqrt(gam*R*T_inf);\n",
+ "\n",
+ "M_inf = V_inf/a_inf;\n",
+ "\n",
+ "print\"(c)The Mach number at 10 km is: M_inf =\",M_inf"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The Mach number at sea level is:M_inf = 0.73491785465\n",
+ "(b)The Mach number at 5 km is: M_inf = 0.779955236945\n",
+ "(c)The Mach number at 10 km is: M_inf = 0.834623638772\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E02 : Pg 256"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "T = 320; # static temperature\n",
+ "V = 1000; # velocity\n",
+ "gam = 1.4; # ratio of specific heats\n",
+ "R = 287; # universal gas constant\n",
+ "\n",
+ "# the speed of sound is given by\n",
+ "a = math.sqrt(gam*R*T);\n",
+ "\n",
+ "# the mach number can be calculated as\n",
+ "M = V/a;\n",
+ "\n",
+ "print\"The Mach number is:\\nM =\",M"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Mach number is:\n",
+ "M = 2.78881717658\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E03 : Pg 257"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "\n",
+ "gam = 1.4; # ratio of specific heats\n",
+ "\n",
+ "# (a)\n",
+ "M = 2; # Mach number\n",
+ "\n",
+ "# the ratio of kinetic energy to internal energy is given by\n",
+ "ratio = gam*(gam-1)*M*M/2;\n",
+ "\n",
+ "print\"(a)The ratio of kinetic energy to internal energy is:\",ratio\n",
+ "\n",
+ "# similarly for (b)\n",
+ "# (b)\n",
+ "M = 20;\n",
+ "\n",
+ "ratio = gam*(gam-1)*M*M/2;\n",
+ "\n",
+ "print\"\\n(b)The ratio of kinetic energy to internal energy is:\",ratio"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The ratio of kinetic energy to internal energy is: 1.12\n",
+ "\n",
+ "(b)The ratio of kinetic energy to internal energy is: 112.0\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E04 : Pg 259"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "\n",
+ "M = 2.79; # Mach number\n",
+ "T = 320; # static temperature from ex. 7.3\n",
+ "p = 1; # static pressure in atm\n",
+ "gam = 1.4;\n",
+ "\n",
+ "# from eq. (8.40)\n",
+ "T0 = T*(1+((gam-1)/2*M*M));\n",
+ "\n",
+ "# from eq. (8.42)\n",
+ "p0 = p*((1+((gam-1)/2*M*M))**(gam/(gam-1)));\n",
+ "\n",
+ "print\"The total temperature and pressure are:\\nT0 =\",T0,\"K\",\"\\nP0 =\",p0,\"atm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total temperature and pressure are:\n",
+ "T0 = 818.1824 K \n",
+ "P0 = 26.7270201929 atm\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E05 : Pg 260"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "M = 3.5; # Mach number\n",
+ "T = 180; # static temperature from ex. 7.3\n",
+ "p = 0.3; # static pressure in atm\n",
+ "gam = 1.4;\n",
+ "R = 287;\n",
+ "\n",
+ "# from eq. (8.40)\n",
+ "T0 = T*(1+((gam-1)/2*M*M));\n",
+ "\n",
+ "# from eq. (8.42)\n",
+ "p0 = p*((1+((gam-1)/2*M*M))**(gam/(gam-1)));\n",
+ "\n",
+ "a = math.sqrt(gam*R*T);\n",
+ "V = a*M;\n",
+ "\n",
+ "# the values at local sonic point are given by\n",
+ "T_star = T0*2/(gam+1);\n",
+ "a_star = math.sqrt(gam*R*T_star);\n",
+ "M_star = V/a_star;\n",
+ "\n",
+ "print\"T0 =\",T0,\"K\",\"\\nP0 =\",p0,\"atm\",\"\\nT* =\",T_star,\"k\",\"\\na* =\",a_star,\"m/s\",\"\\nM* =\",M_star"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "T0 = 621.0 K \n",
+ "P0 = 22.8816894716 atm \n",
+ "T* = 517.5 k \n",
+ "a* = 455.995065763 m/s \n",
+ "M* = 2.06418738617\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E06 : Pg 263"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "\n",
+ "p_inf = 1;\n",
+ "p1 = 0.7545;\n",
+ "M_inf = 0.6;\n",
+ "gam = 1.4;\n",
+ "\n",
+ "# from eq. (8.42)\n",
+ "p0_inf = p_inf*((1+((gam-1)/2*M_inf*M_inf))**(gam/(gam-1)));\n",
+ "\n",
+ "p0_1 = p0_inf;\n",
+ "\n",
+ "# from eq. (8.42)\n",
+ "ratio = p0_1/p1;\n",
+ "\n",
+ "# from appendix A, for this ratio, the Mach number is\n",
+ "M1 = 0.9;\n",
+ "\n",
+ "print\"The mach number at the given point is:\\nM1 =\",M1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The mach number at the given point is:\n",
+ "M1 = 0.9\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E07 : Pg 268"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "T_inf = 288; # freestream temperature\n",
+ "p_inf = 1; # freestream pressure\n",
+ "p1 = 0.7545; # pressure at point 1\n",
+ "M = 0.9; # mach number at point 1\n",
+ "gam = 1.4; # ratio of specific heats\n",
+ "R=1.;#\n",
+ "# for isentropic flow, from eq. (7.32)\n",
+ "T1 = T_inf*((p1/p_inf)**((gam-1)/gam));\n",
+ "\n",
+ "# the speed of sound at that point is thus\n",
+ "a1 = math.sqrt(gam*R*T1);\n",
+ "\n",
+ "# thus, the velocity can be given as\n",
+ "V1 = M*a1;\n",
+ "\n",
+ "print\"The velocity at the given point is:\\nV1 =\",V1,\"m/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The velocity at the given point is:\n",
+ "V1 = 17.3590326624 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E08 : Pg 268"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "u1 = 680; # velocity upstream of shock\n",
+ "T1 = 288; # temperature upstream of shock\n",
+ "p1 = 1; # pressure upstream of shock\n",
+ "gam = 1.4; # ratio of specific heats\n",
+ "R = 287; # universal gas constant\n",
+ "\n",
+ "# the speed of sound is given by\n",
+ "a1 = math.sqrt(gam*R*T1)\n",
+ "\n",
+ "# thus the mach number is\n",
+ "M1 = 2;\n",
+ "\n",
+ "# from Appendix B, for M = 2, the relations between pressure and temperature are given by\n",
+ "pressure_ratio = 4.5; # ratio of pressure accross shock\n",
+ "temperature_ratio = 1.687; # ratio of temperature accross shock\n",
+ "M2 = 0.5774; # mach number downstream of shock\n",
+ "\n",
+ "# thus the values downstream of the shock can be calculated as\n",
+ "p2 = pressure_ratio*p1;\n",
+ "T2 = temperature_ratio*T1;\n",
+ "a2 = math.sqrt(gam*R*T2);\n",
+ "u2 = M2*a2;\n",
+ "\n",
+ "print\"p2 =\",p2,\"atm\",\"\\nT2 =\",T2,\"K\",\"\\nu2 =\",u2,\"m/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "p2 = 4.5 atm \n",
+ "T2 = 485.856 K \n",
+ "u2 = 255.114727639 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E09 : Pg 271"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "\n",
+ "p1 = 1; # ambient pressure upstream of shock\n",
+ "\n",
+ "\n",
+ "# (a)\n",
+ "# for M = 2;\n",
+ "p0_1 = 7.824*p1; # total pressure upstream of shock\n",
+ "pressure_ratio = 0.7209; # ratio of total pressure accross the shock\n",
+ "p0_2 = pressure_ratio*p0_1; # total pressure downstream of shock\n",
+ "\n",
+ "# thus the total loss of pressure is given by\n",
+ "pressure_loss = p0_1 - p0_2;\n",
+ "\n",
+ "print\"The total pressure loss is:\\n(a)P0_loss=\",pressure_loss,\"atm\"\n",
+ "\n",
+ "# similarly\n",
+ "# (b)\n",
+ "# for M = 4;\n",
+ "p0_1 = 151.8*p1;\n",
+ "pressure_ratio = 0.1388;\n",
+ "p0_2 = pressure_ratio*p0_1;\n",
+ "\n",
+ "# thus the total loss of pressure is given by\n",
+ "pressure_loss = p0_1 - p0_2;\n",
+ "\n",
+ "print\"\\n(b)P0_loss =\",pressure_loss,\"atm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total pressure loss is:\n",
+ "(a)P0_loss= 2.1836784 atm\n",
+ "\n",
+ "(b)P0_loss = 130.73016 atm\n"
+ ]
+ }
+ ],
+ "prompt_number": 9
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E10 : Pg 272"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "\n",
+ "M_inf = 2.; # freestream mach number\n",
+ "p_inf = 2.65e4; # freestream pressure\n",
+ "T_inf = 223.3; # freestream temperature\n",
+ "\n",
+ "# from Appendix A, for M = 2\n",
+ "p0_inf = 7.824*p_inf; # freestream total pressure\n",
+ "T0_inf = 1.8*T_inf; # freestream total temperature\n",
+ "\n",
+ "# from Appendix B, for M = 2\n",
+ "p0_1 = 0.7209*p0_inf; # total pressure downstream of the shock\n",
+ "T0_1 = T0_inf; # total temperature accross the shock is conserved\n",
+ "\n",
+ "# since the flow downstream of the shock is isentropic\n",
+ "p0_2 = p0_1;\n",
+ "T0_2 = T0_1;\n",
+ "\n",
+ "# from Appendix A, for M = 0.2 at point 2\n",
+ "p2 = p0_2/1.028;\n",
+ "T2 = T0_2/1.008;\n",
+ "\n",
+ "p2_atm = p2/102000;\n",
+ "\n",
+ "print\"The pressure at point 2 is:p2 =\",p2_atm,\"atm\","
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pressure at point 2 is:p2 = 1.42546466011 atm\n"
+ ]
+ }
+ ],
+ "prompt_number": 10
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E11 : Pg 273"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "\n",
+ "M_inf = 10; # freestream mach number\n",
+ "p_inf = 2.65e4; # freestream pressure\n",
+ "T_inf = 223.3; # freestream temperature\n",
+ "\n",
+ "# from Appendix A, for M = 2\n",
+ "p0_inf = 0.4244e5*p_inf; # freestream total pressure\n",
+ "T0_inf = 21*T_inf; # freestream total temperature\n",
+ "\n",
+ "# from Appendix B, for M = 2\n",
+ "p0_1 = 0.003045*p0_inf; # total pressure downstream of shock\n",
+ "T0_1 = T0_inf; # total temperature downstream of shock is conserved\n",
+ "\n",
+ "# since the flow downstream of the shock is isentropic\n",
+ "p0_2 = p0_1;\n",
+ "T0_2 = T0_1;\n",
+ "\n",
+ "# from Appendix A, for M = 0.2 at point 2\n",
+ "p2 = p0_2/1.028;\n",
+ "T2 = T0_2/1.008;\n",
+ "\n",
+ "p2_atm = p2/102000;\n",
+ "\n",
+ "\n",
+ "print\"The pressure at point 2 is: p2 =\",p2_atm,\"atm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pressure at point 2 is: p2 = 32.6599307622 atm\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E13 : Pg 274"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "\n",
+ "p1 = 4.66e4; # ambient pressure\n",
+ "M = 8; # mach number\n",
+ "\n",
+ "# from Appendix B, for M = 8\n",
+ "p0_2 = 82.87*p1; # total pressure downstream of the shock\n",
+ "\n",
+ "# since the flow is isentropic downstream of the shock, total pressure is conserved\n",
+ "ps_atm = p0_2/101300; # pressure at the stagnation point\n",
+ "\n",
+ "print\"The pressure at the nose is:\\np_s =\",ps_atm,\"atm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The pressure at the nose is:\n",
+ "p_s = 38.1218361303 atm\n"
+ ]
+ }
+ ],
+ "prompt_number": 11
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E14 : Pg 274"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressedin SI units\n",
+ "import math \n",
+ "p1 = 2527.3; # ambient pressure at the altitude of 25 km\n",
+ "T1 = 216.66; # ambient temperature at the altitude of 25 km\n",
+ "p0_1 = 38800; # total pressure\n",
+ "gam = 1.4; # ratio of specific heats\n",
+ "R = 287; # universal gas constant\n",
+ "pressure_ratio = p0_1/p1; # ratio of total to static pressure\n",
+ "\n",
+ "# for this value of pressure ratio, mach number is\n",
+ "M1 = 3.4;\n",
+ "\n",
+ "# the speed of sound is given by\n",
+ "a1 = math.sqrt(gam*R*T1)\n",
+ "\n",
+ "# thus the velocity can be calculated as\n",
+ "V1 = M1*a1;\n",
+ "\n",
+ "print\"The Velocity of the airplane is:\\nV1 =\",V1,\"m/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The Velocity of the airplane is:\n",
+ "V1 = 1003.16703558 m/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 12
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER09_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER09_2.ipynb new file mode 100644 index 00000000..b67bd97d --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER09_2.ipynb @@ -0,0 +1,565 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:e1a44d7b77c7f7e6a9ca5409eaf2278826643afe70e534d7db5afca9213157d9"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER09:OBLIGUE SHOCK AND EXPANSION WAVES"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 302"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math\n",
+ "M = 2.; # mach number\n",
+ "h = 16000.; # altitude of the plane\n",
+ "\n",
+ "# the mach angle can be calculated from eq.(9.1) as\n",
+ "mue = math.asin(1./M); # mach angle\n",
+ "\n",
+ "d = h/math.tan(mue);\n",
+ "\n",
+ "print\"The plane is ahead of the bystander by a distance of:\\nd =\",d/1000.,\"km\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The plane is ahead of the bystander by a distance of:\n",
+ "d = 27.7128129211 km\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E02 : Pg 302"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import pi, sin,cos\n",
+ "M1 = 2.; # mach number\n",
+ "p1 = 1.; # ambient pressure\n",
+ "T1 = 288.; # ambient temperature\n",
+ "theta = 20.*pi/180.; # flow deflection\n",
+ "\n",
+ "# from figure 9.9, for M = 2, theta = 20\n",
+ "b = 53.4*pi/180.; # beta\n",
+ "Mn_1 = M1*sin(b); # upstream mach number normal to shock\n",
+ "\n",
+ "# for this value of Mn,1 = 1.60, from Appendix B we have\n",
+ "Mn_2 = 0.6684; # downstream mach number normal to shock\n",
+ "M2 = Mn_2/sin(b-theta); # mach number downstream of shock\n",
+ "p2 = 2.82*p1;\n",
+ "T2 = 1.388*T1;\n",
+ "\n",
+ "# for M = 2, from appendix A we have\n",
+ "p0_2 = 0.8952*7.824*p1;\n",
+ "T0_1 = 1.8*T1;\n",
+ "T0_2 = T0_1;\n",
+ "\n",
+ "print\"M2 =\",M2,\"\\np2 =\",p2,\"atm\",\"\\nT2 =\",T2,\"K\",\"\\np0,2 =\",p0_2,\"atm\",\"\\nT0,2 =\",T0_2,\"K\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "M2 = 1.214211418 \n",
+ "p2 = 2.82 atm \n",
+ "T2 = 399.744 K \n",
+ "p0,2 = 7.0040448 atm \n",
+ "T0,2 = 518.4 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E03 : Pg 305"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import pi,sin\n",
+ "b = 30.*pi/180.; # oblique shock wave angle\n",
+ "M1 = 2.4; # upstream mach number\n",
+ "\n",
+ "# from figure 9.9, for these value of M and beta, we have\n",
+ "theta = 6.5*pi/180.;\n",
+ "\n",
+ "Mn_1 = M1*sin(b); # upstream mach number normal to shock\n",
+ "\n",
+ "# from Appendix B\n",
+ "pressure_ratio = 1.513;\n",
+ "temperature_ratio = 1.128;\n",
+ "Mn_2 = 0.8422;\n",
+ "\n",
+ "M2 = Mn_2/sin(b-theta);\n",
+ "\n",
+ "print\"theta =\",theta*180./pi,\"degrees\",\"\\np2/p1 =\",pressure_ratio,\"\\nT2/T1 =\",temperature_ratio,\"\\nM2 =\",M2"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "theta = 6.5 degrees \n",
+ "p2/p1 = 1.513 \n",
+ "T2/T1 = 1.128 \n",
+ "M2 = 2.11210524521\n"
+ ]
+ }
+ ],
+ "prompt_number": 16
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E04 : Pg 309"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import pi,sin\n",
+ "b = 35.*pi/180.; # oblique shock wave angle\n",
+ "pressure_ratio = 3.; # upstream and downstream pressure ratio\n",
+ "\n",
+ "# from appendix B\n",
+ "Mn_1 = 1.64;\n",
+ "M1 = Mn_1/sin(b);\n",
+ "\n",
+ "print\"The upstream mach number is:\\nM =\",M1"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The upstream mach number is:\n",
+ "M = 2.85925274482\n"
+ ]
+ }
+ ],
+ "prompt_number": 17
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E05 : Pg 309"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import pi,sin\n",
+ "M1 = 3.;\n",
+ "b = 40.*pi/180.;\n",
+ "\n",
+ "# for case 1, for M = 3, from Appendix B, we have\n",
+ "p0_ratio_case1 = 0.3283;\n",
+ "\n",
+ "# for case 2\n",
+ "Mn_1 = M1*sin(b);\n",
+ "\n",
+ "# from Appendix B\n",
+ "p0_ratio1 = 0.7535;\n",
+ "Mn_2 = 0.588;\n",
+ "\n",
+ "# from fig. 9.9, for M1 = 3 and beta = 40, we have\n",
+ "theta = 22.*pi/180.;\n",
+ "M2 = Mn_2/sin(b-theta);\n",
+ "\n",
+ "# from appendix B for M = 1.9; we have\n",
+ "p0_ratio2 = 0.7674;\n",
+ "p0_ratio_case2 = p0_ratio1*p0_ratio2;\n",
+ "\n",
+ "ratio = p0_ratio_case2/p0_ratio_case1;\n",
+ "\n",
+ "print\"Ans =\",ratio"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Ans = 1.76130338105\n"
+ ]
+ }
+ ],
+ "prompt_number": 18
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E06 : Pg 310"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import pi,sin,tan\n",
+ "M1 = 5.;\n",
+ "theta = 15.*pi/180.;\n",
+ "gam = 1.4;\n",
+ "\n",
+ "# for these values of M and theta, from fig. 9.9\n",
+ "b = 24.2*pi/180;\n",
+ "Mn_1 = M1*sin(b);\n",
+ "\n",
+ "# from Appendix B, for Mn,1 = 2.05, we have\n",
+ "p_ratio = 4.736;\n",
+ "\n",
+ "# hence\n",
+ "c_d = 4.*tan(theta)/gam/(M1**2.)*(p_ratio-1.);\n",
+ "\n",
+ "print\"The drag coefficient is given by:\\ncd =\",c_d"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The drag coefficient is given by:\n",
+ "cd = 0.114406649477\n"
+ ]
+ }
+ ],
+ "prompt_number": 19
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E07 : Pg 311"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import pi,sin,tan\n",
+ "M1 = 3.5;\n",
+ "theta1 = 10.*pi/180.;\n",
+ "gam = 1.4;\n",
+ "p1 = 101300.;\n",
+ "T1 = 288.;\n",
+ "b=1.;#\n",
+ "# for these values of M and theta, from fig. 9.9\n",
+ "b1 = 24.*pi/180.;\n",
+ "Mn_1 = M1*sin(b);\n",
+ "\n",
+ "# from Appendix B, for Mn,1 = 2.05, we have\n",
+ "Mn_2 = 0.7157;\n",
+ "p_ratio1 = 2.32;\n",
+ "T_ratio1 = 1.294;\n",
+ "M2 = Mn_2/sin(b1-theta1);\n",
+ "\n",
+ "# now\n",
+ "theta2 = 10.*pi/180.;\n",
+ "\n",
+ "# from fig. 9.9\n",
+ "b2 = 27.3*pi/180.;\n",
+ "phi = b2 - theta2;\n",
+ "\n",
+ "# from Appendix B\n",
+ "p_ratio2 = 1.991;\n",
+ "T_ratio2 = 1.229;\n",
+ "Mn_3 = 0.7572;\n",
+ "M3 = Mn_3/sin(b2-theta2);\n",
+ "\n",
+ "# thus\n",
+ "p3 = p_ratio1*p_ratio2*p1;\n",
+ "T3 = T_ratio1*T_ratio2*T1;\n",
+ "\n",
+ "print\"p3 =\",p3/1e5,\"x 10**5 N/m2\",\"\\nT3 =\",T3,\"K\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "p3 = 4.67916856 x 10**5 N/m2 \n",
+ "T3 = 458.013888 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E08 : Pg 312"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import pi,sin,tan\n",
+ "M1 = 1.5; # upstream mach number\n",
+ "theta = 15.*pi/180.; # deflection angle\n",
+ "p1 = 1.; # ambient pressure in atm\n",
+ "T1 = 288.; # ambient temperature\n",
+ "\n",
+ "# from appendix C, for M1 = 1.5 we have\n",
+ "v1 = 11.91*pi/180.;\n",
+ "\n",
+ "# from eq.(9.43)\n",
+ "v2 = v1 + theta;\n",
+ "\n",
+ "# for this value of v2, from appendix C\n",
+ "M2 = 2.;\n",
+ "\n",
+ "# from Appendix A for M1 = 1.5 and M2 = 2.0, we have\n",
+ "p2 = 1./7.824*1.*3.671*p1;\n",
+ "T2 = 1./1.8*1.*1.45*T1;\n",
+ "p0_1 = 3.671*p1;\n",
+ "p0_2 = p0_1;\n",
+ "T0_1 = 1.45*T1;\n",
+ "T0_2 = T0_1;\n",
+ "\n",
+ "# from fig. 9.25, we have\n",
+ "fml = 41.81; # Angle of forward Mach line\n",
+ "rml = 30. - 15.; # Angle of rear Mach line\n",
+ "\n",
+ "print\"p2 =\",p2,\"atm\",\"\\nT2 =\",T2,\"K\",\"\\np0,2 =\",p0_2,\"atm\",\"\\nT0,2 =\",T0_2,\"K\",\"\\nAngle of forward Mach line =\",fml,\"degrees\",\"\\nAngle of rear Mach line =\",rml,\"degrees\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "p2 = 0.469197341513 atm \n",
+ "T2 = 232.0 K \n",
+ "p0,2 = 3.671 atm \n",
+ "T0,2 = 417.6 K \n",
+ "Angle of forward Mach line = 41.81 degrees \n",
+ "Angle of rear Mach line = 15.0 degrees\n"
+ ]
+ }
+ ],
+ "prompt_number": 22
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E09 : Pg 312"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import pi\n",
+ "M1 = 10.; # upstream mach number\n",
+ "theta = 15.*pi/180.; # deflection angle\n",
+ "p1 = 1.; # ambient pressure in atm\n",
+ "# from appendix C, for M1 = 10 we have\n",
+ "v1 = 102.3*pi/180.;\n",
+ "# in region 2\n",
+ "v2 = v1 - theta;\n",
+ "# for this value of v2, from appendix C\n",
+ "M2 = 6.4;\n",
+ "# from Appendix A for M1 = 10 and M2 = 6.4, we have\n",
+ "p2 = 1./(2355.)*1.*42440.*p1;\n",
+ "print\"M2 =\",M2,\"\\np2 =\",p2,\"atm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "M2 = 6.4 \n",
+ "p2 = 18.0212314225 atm\n"
+ ]
+ }
+ ],
+ "prompt_number": 23
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E10 : Pg 315"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "M1 = 10; # upstream mach number\n",
+ "theta = 15*math.pi/180; # deflection angle\n",
+ "p1 = 1; # ambient pressure in atm\n",
+ "\n",
+ "# from fig 9.9, for M1 = 10 and theta = 15 we have\n",
+ "b = 20*math.pi/180;\n",
+ "Mn_1 = M1*math.sin(b);\n",
+ "\n",
+ "# from Appendix B, for Mn,1 = 3.42\n",
+ "Mn_2 = 0.4552;\n",
+ "M2 = Mn_2/math.sin(b-theta);\n",
+ "p2 = 13.32*p1;\n",
+ "\n",
+ "# from Appendix A, for M1 = 10\n",
+ "p0_2 = 0.2322*42440*p1;\n",
+ "\n",
+ "print\"M2 =\",M2,\"\\np2 =\",p2,\"atm\",\"\\np0,2 =\",p0_2/1e3,\"x 10**3 atm\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "M2 = 5.22283426943 \n",
+ "p2 = 13.32 atm \n",
+ "p0,2 = 9.854568 x 10**3 atm\n"
+ ]
+ }
+ ],
+ "prompt_number": 24
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E11 : Pg 316"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "M1 = 3.; # upstream mach number\n",
+ "theta = 5.*math.pi/180.; # deflection angle\n",
+ "alpha = theta; # angle of attack\n",
+ "gam = 1.4;\n",
+ "\n",
+ "# from appendix C, for M1 = 3 we have\n",
+ "v1 = 49.76*math.pi/180.;\n",
+ "\n",
+ "# from eq.(9.43)\n",
+ "v2 = v1 + theta;\n",
+ "\n",
+ "# for this value of v2, from appendix C\n",
+ "M2 = 3.27;\n",
+ "\n",
+ "# from Appendix A for M1 = 3 and M2 = 3.27, we have\n",
+ "p_ratio1 = 36.73/55.;\n",
+ "\n",
+ "# from fig. 9.9, for M1 = 3 and theta = 5\n",
+ "b = 23.1*math.pi/180.;\n",
+ "Mn_1 = M1*math.sin(b);\n",
+ "\n",
+ "# from Appendix B\n",
+ "p_ratio2 = 1.458;\n",
+ "\n",
+ "# thus\n",
+ "c_l = 2./gam/(M1**2.)*(p_ratio2-p_ratio1)*math.cos(alpha);\n",
+ "\n",
+ "c_d = 2./gam/(M1**2.)*(p_ratio2-p_ratio1)*math.sin(alpha);\n",
+ "\n",
+ "print\"The lift and drag coefficients are given by:\\ncl =\",c_l,\"\\ncd =\",c_d"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The lift and drag coefficients are given by:\n",
+ "cl = 0.124948402826 \n",
+ "cd = 0.0109315687729\n"
+ ]
+ }
+ ],
+ "prompt_number": 25
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER10_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER10_2.ipynb new file mode 100644 index 00000000..5e2e846a --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER10_2.ipynb @@ -0,0 +1,329 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:50b271f93e8a365fc7786fed67e8c1b9727566cca589daf5682afce2ce0beb0c"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER10:COMPRESSIBLE FLOW THROUGH NOZZLES DIFFUSERS AND WIND TUNNELS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 345"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in Si units\n",
+ "area_ratio = 10.25; # exit to throat area ratio\n",
+ "p0 = 5; # reservoir pressure in atm\n",
+ "T0 = 333.3; # reservoir temperature\n",
+ "\n",
+ "# from appendix A, for an area ratio of 10.25\n",
+ "Me = 3.95; # exit mach number\n",
+ "pe = 0.007*p0; # exit pressure\n",
+ "Te = 0.2427*T0; # exit temperature\n",
+ "\n",
+ "print\"Me =\",Me\n",
+ "print\"pe =\",pe,\"atm\"\n",
+ "print\"Te =\",Te,\"K\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Me = 3.95\n",
+ "pe = 0.035 atm\n",
+ "Te = 80.89191 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E02 : Pg 346"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in Si units\n",
+ "\n",
+ "area_ratio = 2.; # exit to throat area ratio\n",
+ "p0 = 1.; # reservoir pressure in atm\n",
+ "T0 = 288.; # reservoir temperature\n",
+ "\n",
+ "# (a)\n",
+ "# since M = 1 at the throat\n",
+ "Mt = 1.;\n",
+ "pt = 0.528*p0; # pressure at throat\n",
+ "Tt = 0.833*T0; # temperature at throat\n",
+ "\n",
+ "# from appendix A for supersonic flow, for an area ratio of 2\n",
+ "Me = 2.2; # exit mach number\n",
+ "pe = 1./10.69*p0; # exit pressure\n",
+ "Te = 1./1.968*T0; # exit temperature\n",
+ "\n",
+ "print\"At throat: Mt =\",Mt\n",
+ "print\"\\nAt throat: pt =\",pt,\"atm\"\n",
+ "print\"\\nAt throat: Tt = \",Tt,\"K\"\n",
+ "print\"\\nAt throat: For supersonic exit:\",Me\n",
+ "print\"\\nAt throat: pe =\",pe,\"atm\"\n",
+ "print\"\\nAt throat: Te = \",Te,\"K\"\n",
+ "\n",
+ "# (b)\n",
+ "# from appendix A for subonic flow, for an area ratio of 2\n",
+ "Me = 0.3; # exit mach number\n",
+ "pe = 1/1.064*p0; # exit pressure\n",
+ "Te = 1/1.018*T0; # exit temperature\n",
+ "\n",
+ "print\"\\nFor subrsonic exit:\",Me\n",
+ "print\"\\npe=\",pe,\"atm\"\n",
+ "print\"\\nTe=\",Te,\"K\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "At throat: Mt = 1.0\n",
+ "\n",
+ "At throat: pt = 0.528 atm\n",
+ "\n",
+ "At throat: Tt = 239.904 K\n",
+ "\n",
+ "At throat: For supersonic exit: 2.2\n",
+ "\n",
+ "At throat: pe = 0.0935453695042 atm\n",
+ "\n",
+ "At throat: Te = 146.341463415 K\n",
+ "\n",
+ "For subrsonic exit: 0.3\n",
+ "\n",
+ "pe= 0.93984962406 atm\n",
+ "\n",
+ "Te= 282.907662083 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E03 : Pg 346"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in Si units\n",
+ "\n",
+ "area_ratio = 2.; # exit to throat area ratio\n",
+ "p0 = 1.; # reservoir pressure in atm\n",
+ "T0 = 288.; # reservoir temperature\n",
+ "pe = 0.973; # exit pressure in atm\n",
+ "\n",
+ "p_ratio = p0/pe; # ratio of reservoir to exit pressure\n",
+ "\n",
+ "# from appendix A for subsonic flow, for an pressure ratio of 1.028\n",
+ "Me = 0.2; # exit mach number\n",
+ "area_ratio_exit_to_star = 2.964; # A_exit/A_star\n",
+ "\n",
+ "# thus\n",
+ "area_ratio_throat_to_star = area_ratio_exit_to_star/area_ratio; # A_exit/A_star\n",
+ "\n",
+ "# from appendix A for subsonic flow, for an area ratio of 1.482\n",
+ "Mt = 0.44; # throat mach number\n",
+ "\n",
+ "print\"Me =\",Me\n",
+ "print\"Mt =\",Mt"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Me = 0.2\n",
+ "Mt = 0.44\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E04 : Pg 352"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "p0 = 30.*101000.; # reservoir pressure\n",
+ "T0 = 3500.; # reservoir temperature\n",
+ "R = 520.; # specific gas constant\n",
+ "gam = 1.22; # ratio of specific heats\n",
+ "A_star = 0.4; # rocket nozzle throat area\n",
+ "pe = 5529.; # rocket nozzle exit pressure equal to ambient pressure at 20 km altitude\n",
+ "\n",
+ "# (a)\n",
+ "# the density of air in the reservoir can be calculated as\n",
+ "rho0 = p0/R/T0;\n",
+ "\n",
+ "# from eq.(8.46)\n",
+ "rho_star = rho0*(2/(gam+1))**(1/(gam-1));\n",
+ "\n",
+ "# from eq.(8.44)\n",
+ "T_star = T0*2/(gam+1);\n",
+ "a_star = math.sqrt(gam*R*T_star);\n",
+ "u_star = a_star;\n",
+ "m_dot = rho_star*u_star*A_star;\n",
+ "\n",
+ "# rearranging eq.(8.42)\n",
+ "Me = math.sqrt(2/(gam-1)*(((p0/pe)**((gam-1)/gam)) - 1));\n",
+ "Te = T0/(1+(gam-1)/2*Me*Me);\n",
+ "ae = math.sqrt(gam*R*Te);\n",
+ "ue = Me*ae;\n",
+ "\n",
+ "# thus the thrust can be calculated as\n",
+ "T = m_dot*ue;\n",
+ "T_lb = T*0.2247;\n",
+ "\n",
+ "# (b)\n",
+ "# rearranging eq.(10.32)\n",
+ "Ae = A_star/Me*((2/(gam+1)*(1+(gam-1)/2*Me*Me))**((gam+1)/(gam-1)/2));\n",
+ "\n",
+ "print\"(a)The thrust of the rocket is:T =\" ,T/1e6, \"N\"\n",
+ "print\"\\n(b)The nozzle exit area is\",T_lb \n",
+ "\n",
+ "print\"\\nAe =\",Ae, \"m2\"\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The thrust of the rocket is:T = 2.1702872295 N\n",
+ "\n",
+ "(b)The nozzle exit area is 487663.540469\n",
+ "\n",
+ "Ae = 16.7097500627 m2\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E05 : Pg 353"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "p0 = 30.*101000.; # reservoir pressure\n",
+ "T0 = 3500.; # reservoir temperature\n",
+ "R = 520.; # specific gas constant\n",
+ "gam = 1.22; # ratio of specific heats\n",
+ "A_star = 0.4; # rocket nozzle throat area\n",
+ "\n",
+ "# the mass flow rate using the closed form analytical expression\n",
+ "# from problem 10.5 can be given as\n",
+ "m_dot = p0*A_star*math.sqrt(gam/R/T0*((2/(gam+1))**((gam+1)/(gam-1))));\n",
+ "\n",
+ "print\"The mass flow rate is: m_dot =\",m_dot, \"kg/s\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The mass flow rate is: m_dot = 586.100122081 kg/s\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E06 : Pg 356"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "M = 2.; # Mach number\n",
+ "# for this value M, for a normal shock, from Appendix B\n",
+ "p0_ratio = 0.7209;\n",
+ "# thus\n",
+ "area_ratio = 1./p0_ratio;\n",
+ "print\"The diffuser throat to nozzle throat area ratio is: =\",area_ratio"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The diffuser throat to nozzle throat area ratio is: = 1.38715494521\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER11_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER11_2.ipynb new file mode 100644 index 00000000..a745bed3 --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER11_2.ipynb @@ -0,0 +1,89 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:803218956e8d07c2bbc2005621cfab4517eff6a55bb3c468628e715c71e6bf8d"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER11:SUBSONIC COMPRESSIBLE FLOW OVER AIRFOILS LINEAR THEOREY"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 382"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "Cp_incompressible = -0.3; # Cp for incompressible flow\n",
+ "M = 0.6; # Mach number\n",
+ "# Thus from eq.(11.52)\n",
+ "Cp_compressible = Cp_incompressible/math.sqrt(1-M**2);\n",
+ "print\"(a)The Cp after compressibility corrections is:\",Cp_compressible,\"Cp\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The Cp after compressibility corrections is: -0.375 Cp\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E02 : Pg 383"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "cl_incompressible = 2*math.pi; # lift curve slope\n",
+ "M_inf = 0.7; # Mach number\n",
+ "# from eq.(11.52)\n",
+ "cl_compressible = cl_incompressible/math.sqrt(1-M_inf**2); # compressible lift curve slope\n",
+ "print\"(a)The cl after compressibility corrections is: cl =\",cl_compressible,\"alpha\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)The cl after compressibility corrections is: cl = 8.7982192499 alpha\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER12_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER12_2.ipynb new file mode 100644 index 00000000..23eb47c4 --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER12_2.ipynb @@ -0,0 +1,177 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:759b2b8dbe680f1a1114b02efa5fa66ff3cc710d36fd5424f5c21b97ca922dbb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER12:LINEARIZED SUPERSONIC FLOW"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 395"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import pi,sqrt\n",
+ "alpha = 5*pi/180; # angle of attack\n",
+ "M_inf = 3; # freestream mach number\n",
+ "\n",
+ "# from eq.(12.23)\n",
+ "c_l = 4*alpha/sqrt(M_inf**2 - 1);\n",
+ "\n",
+ "# from eq.(12.24)\n",
+ "c_d = 4*alpha**2/sqrt(M_inf**2 - 1);\n",
+ "\n",
+ "print\"The cl and cd according to the linearized theory are:cl =\", round(c_l,2)\n",
+ "print\"The cl and cd according to the linearized theory are:cd =\",round(c_d,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The cl and cd according to the linearized theory are:cl = 0.12\n",
+ "The cl and cd according to the linearized theory are:cd = 0.01\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E02 : Pg 395"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import sqrt,pi\n",
+ "M_inf = 2.; # freestream mach number\n",
+ "rho_inf = 0.3648; # freestream density at 11 km altitude\n",
+ "T_inf = 216.78; # freestream temperature at 11 km altitude\n",
+ "gam = 1.4; # ratio of specific heats\n",
+ "R = 287.; # specific gas constant\n",
+ "m = 9400.; # mass of the aircraft\n",
+ "g = 9.8; # acceleratio due to gravity\n",
+ "W = m*g; # weight of the aircraft\n",
+ "S = 18.21; # wing planform area\n",
+ "# thus\n",
+ "a_inf = sqrt(gam*R*T_inf);\n",
+ "V_inf = M_inf*a_inf;\n",
+ "q_inf = 1./2.*rho_inf*V_inf**2.;\n",
+ "\n",
+ "# thus the aircraft lift coefficient is given as\n",
+ "C_l = W/q_inf/S;\n",
+ "\n",
+ "alpha = 180./pi*C_l/4.*sqrt(M_inf**2. - 1.);\n",
+ "\n",
+ "print\"The angle of attack of the wing is:\",alpha,\"degrees\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The angle of attack of the wing is: 1.97493716351 degrees\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E03 : Pg 400"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "# All the quantities are expressed in SI units\n",
+ "from math import sqrt,pi\n",
+ "# (a)\n",
+ "M_inf = 2.; # freestream mach number\n",
+ "rho_inf = 0.3648; # freestream density at 11 km altitude\n",
+ "T_inf = 216.78; # freestream temperature at 11 km altitude\n",
+ "gam = 1.4; # ratio of specific heats\n",
+ "R = 287.; # specific gas constant\n",
+ "m = 9400.; # mass of the aircraft\n",
+ "g = 9.8; # acceleratio due to gravity\n",
+ "W = m*g; # weight of the aircraft\n",
+ "S = 18.21; # wing planform area\n",
+ "c = 2.2; # chord length of the airfoil\n",
+ "alpha = 0.035; # angle of attack as calculated in ex. 12.2\n",
+ "T0 = 288.16; # ambient temperature at sea level\n",
+ "mue0 = 1.7894e-5; # reference viscosity at sea level\n",
+ "\n",
+ "# thus\n",
+ "a_inf = sqrt(gam*R*T_inf);\n",
+ "V_inf = M_inf*a_inf;\n",
+ "\n",
+ "# according to eq.(15.3), the viscosity at the given temperature is\n",
+ "mue_inf = mue0*(T_inf/T0)**1.5*(T0+110.)/(T_inf+110.);\n",
+ "\n",
+ "# thus the Reynolds number can be given by\n",
+ "Re = rho_inf*V_inf*c/mue_inf;\n",
+ "\n",
+ "# from fig.(19.1), for these values of Re and M, the skin friction coefficient is\n",
+ "Cf = 2.15*10**-3;\n",
+ "\n",
+ "# thus, considering both sides of the flat plate\n",
+ "net_Cf = 2.*Cf;\n",
+ "\n",
+ "# (b)\n",
+ "c_d = 4.*alpha**2./sqrt(M_inf**2. - 1.);\n",
+ "\n",
+ "print\"(a) Net Cf = \",net_Cf*1e3\n",
+ "print\"(b) cd =\",c_d*1e3"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a) Net Cf = 4.3\n",
+ "(b) cd = 2.82901631903\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER14_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER14_2.ipynb new file mode 100644 index 00000000..b03fae71 --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER14_2.ipynb @@ -0,0 +1,107 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:b76a333651e4030c76adde3b4d2c960c2cac224a46eefd1efa17c855082ed983"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER14:ELEMENTS OF HYPERSONIC FLOW"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 440"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import sqrt,pi,sin,cos\n",
+ "M1 = 8.; # mach number\n",
+ "alpha = 15.*pi/180.; # anlge of attack\n",
+ "theta= alpha;\n",
+ "gam = 1.4;\n",
+ "# (a)\n",
+ "# for M = 8\n",
+ "v1 = 95.62*pi/180.;\n",
+ "v2 = v1 + theta;\n",
+ "# from Appendix C\n",
+ "M2 = 14.32;\n",
+ "# from Appendix A, for M1 = 8 and M2 = 14.32\n",
+ "p_ratio = 0.9763e4/0.4808e6;\n",
+ "# from eq.(11.22)\n",
+ "Cp2 = 2/gam/M1**2*(p_ratio - 1);\n",
+ "# for M1 = 8 and theta = 15\n",
+ "b = 21*pi/180;\n",
+ "Mn_1 = M1*sin(b);\n",
+ "# for this value of Mn,1, from appendix B\n",
+ "p_ratio2 = 9.443;\n",
+ "# thus\n",
+ "Cp3 = 2./gam/M1**2.*(p_ratio2 - 1.);\n",
+ "c_n = Cp3 - Cp2;\n",
+ "c_l = c_n*cos(alpha);\n",
+ "c_d = c_n*sin(alpha);\n",
+ "L_by_D = c_l/c_d;\n",
+ "print\"The exact results from the shock-expansion theory are:\"\n",
+ "print\"Cp2 =\",Cp2\n",
+ "print\"Cp3 = \",Cp3\n",
+ "print\" cl =\",c_l\n",
+ "print\"cd =\",c_d\n",
+ "print\"L/D =\",L_by_D\n",
+ "# (b)\n",
+ "# from Newtonian theory, by eq.(14.9)\n",
+ "Cp3 = 2.*sin(alpha)**2;\n",
+ "Cp2 = 0;\n",
+ "c_l = (Cp3 - Cp2)*cos(alpha);\n",
+ "c_d = (Cp3 - Cp2)*sin(alpha);\n",
+ "L_by_D = c_l/c_d;\n",
+ "print\"\\n(b) The results from Newtonian theory are:\"\n",
+ "print\"Cp2 =\",Cp2\n",
+ "print\"Cp3 =\",Cp3\n",
+ "print\"cl =\",c_l\n",
+ "print\"cd =\",c_d\n",
+ "print\"L/D =\",L_by_D"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The exact results from the shock-expansion theory are:\n",
+ "Cp2 = -0.0218681754368\n",
+ "Cp3 = 0.188459821429\n",
+ " cl = 0.203161244164\n",
+ "cd = 0.054436891307\n",
+ "L/D = 3.73205080757\n",
+ "\n",
+ "(b) The results from Newtonian theory are:\n",
+ "Cp2 = 0\n",
+ "Cp3 = 0.133974596216\n",
+ "cl = 0.129409522551\n",
+ "cd = 0.0346751770605\n",
+ "L/D = 3.73205080757\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER16_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER16_2.ipynb new file mode 100644 index 00000000..2a096c3c --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER16_2.ipynb @@ -0,0 +1,139 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:67c16377790a35dc31b3b4a75eb5638e34a5bd4be38717164d79dfa0fbaa671b"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER16:SOME SPECIAL CASES COUETTE AND POISEUILLE FLOWS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 524"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "mue = 1.7894*10**5; # coefficient of viscosity\n",
+ "ue = 60.96; # velocity of upper plate\n",
+ "D = 2.54*10**4; # distance between the 2 plates\n",
+ "T_w = 288.3; # temperature of the plates\n",
+ "Pr = 0.71; # Prandlt number\n",
+ "cp = 1004.5; # specific heat at constant pressure\n",
+ "\n",
+ "# (a)\n",
+ "# from eq.(16.6)\n",
+ "u = ue/2;\n",
+ "\n",
+ "# (b)\n",
+ "# from eq.(16.9)\n",
+ "tow_w = mue*ue/D;\n",
+ "\n",
+ "# (c)\n",
+ "# from eq.(16.34)\n",
+ "T = T_w + Pr*ue**2/8/cp;\n",
+ "\n",
+ "# (d)\n",
+ "# from eq.(16.35)\n",
+ "q_w_dot = mue/2*ue**2/D;\n",
+ "\n",
+ "# (e)\n",
+ "# from eq.(16.40)\n",
+ "T_aw = T_w + Pr/cp*ue**2/2;\n",
+ "\n",
+ "print\"(a)u =\",u,\"m/s\"\n",
+ "print\"(b)tow_w =\",tow_w,\"N/m2\"\n",
+ "print\"(c)T =\",T,\"K\"\n",
+ "print\"(d)q_w_dot =\",q_w_dot,\"Nm-1s-1\"\n",
+ "print\"(e)Taw =\",\"K\",T_aw\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "(a)u = 30.48 m/s\n",
+ "(b)tow_w = 429.456 N/m2\n",
+ "(c)T = 288.628328315 K\n",
+ "(d)q_w_dot = 13089.81888 Nm-1s-1\n",
+ "(e)Taw = K 289.613313258\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E02 : Pg 524"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import sqrt\n",
+ "mue = 1.7894*10**5; # coefficient of viscosity\n",
+ "Me = 3.; # mach number of upper plate\n",
+ "D = 2.54*10**4; # distance between the 2 plates\n",
+ "pe = 101000.; # ambient pressure\n",
+ "Te = 288.; # temperature of the plates\n",
+ "Tw = Te;\n",
+ "gam = 1.4; # ratio of specific heats\n",
+ "R = 287; # specific gas constant\n",
+ "Pr = 0.71; # Prandlt number\n",
+ "cp = 1004.5; # specific heat at constant pressure\n",
+ "tow_w = 72.; # shear stress on the lower wall\n",
+ "# the velocity of the upper plate is given by\n",
+ "ue = Me*sqrt(gam*R*Te);\n",
+ "# the density at both plates is\n",
+ "rho_e = pe/R/Te;\n",
+ "# the coefficient of skin friction is given by\n",
+ "cf = 2.*tow_w/rho_e/ue**2.;\n",
+ "# from eq.(16.92)\n",
+ "C_H = cf/2/Pr;\n",
+ "# from eq.(16.82)\n",
+ "h_aw = cp*Te + Pr*ue**2/2;\n",
+ "h_w = cp*Tw;\n",
+ "q_w_dot = rho_e*ue*(h_aw-h_w)*C_H;\n",
+ "print\"The heat transfer is given by:q_w_dot =\",q_w_dot/1e4,\"W/m2\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The heat transfer is given by:q_w_dot = 3.67387998933 W/m2\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER18_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER18_2.ipynb new file mode 100644 index 00000000..9db85084 --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER18_2.ipynb @@ -0,0 +1,227 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:1212acad0ef08178fcbea2bab37906941543ef565feec1c8224ba9b0069420a4"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER18:LAMINAR BOUNDARY LAYERS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 595"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import sqrt\n",
+ "p_inf = 101000.; # freestream pressure\n",
+ "T_inf = 288.; # freestream temperature\n",
+ "c = 2.; # chord length of the plate\n",
+ "S = 40.; # planform area of the plate\n",
+ "mue_inf=1.7894*10.**5.; # coefficient of viscosity at sea level\n",
+ "gam=1.4; # ratio of specific heats\n",
+ "R=287.; # specific gas constant\n",
+ "# the freestream density is\n",
+ "rho_inf = p_inf/R/T_inf;\n",
+ "# the speed of sound is\n",
+ "a_inf = sqrt(gam*R*T_inf);\n",
+ "# (a)\n",
+ "V_inf = 100.;\n",
+ "# thus the mach number can be calculated as\n",
+ "M_inf = V_inf/a_inf;\n",
+ "# the Reynolds number at the trailing is given as\n",
+ "Re_c = rho_inf*V_inf*c/mue_inf;\n",
+ "# from eq.(18.22)\n",
+ "Cf = 1.328/sqrt(Re_c);\n",
+ "# the friction drag on one surface of the plate is given by\n",
+ "D_f = 1./2.*rho_inf*V_inf**2.*S*Cf;\n",
+ "# the total drag generated due to both surfaces is\n",
+ "D = 2.*D_f;\n",
+ "print\"The total frictional drag is:(a)D =\",D,\"N\"\n",
+ "# (b)\n",
+ "V_inf = 1000.;\n",
+ "# thus the mach number can be calculated as\n",
+ "M_inf = V_inf/a_inf;\n",
+ "# the Reynolds number at the trailing is given as\n",
+ "Re_c = rho_inf*V_inf*c/mue_inf;\n",
+ "# from eq.(18.22)\n",
+ "Cf = 1.2/sqrt(Re_c);\n",
+ "# the friction drag on one surface of the plate is given by\n",
+ "D_f = 1./2.*rho_inf*V_inf**2.*S*Cf;\n",
+ "# the total drag generated due to both surfaces is\n",
+ "D = 2.*D_f;\n",
+ "print\"(b) D =\",D,\"N\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total frictional drag is:(a)D = 17563872.6566 N\n",
+ "(b) D = 501884115.614 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E02 : Pg 596"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import sqrt\n",
+ "Pr = 0.71; # Prandlt number of air at standard conditions\n",
+ "Pr_star = Pr;\n",
+ "Te = 288.; # temperature of the upper plate\n",
+ "ue = 1000.; # velocity of the upper plate\n",
+ "Me = 2.94; # Mach number of flow on the upper plate\n",
+ "p_star = 101000.;\n",
+ "R = 287.; # specific gas constant\n",
+ "T0 = 288.; # reference temperature at sea level\n",
+ "mue0 = 1.7894*10**-5; # reference viscosity at sea level\n",
+ "c = 2.; # chord length of the plate\n",
+ "S = 40.; # plate planform area\n",
+ "\n",
+ "# recovery factor for a boundary layer is given by eq.(18.47) as\n",
+ "r = sqrt(Pr);\n",
+ "\n",
+ "# rearranging eq.(16.49), we get for M = 2.94\n",
+ "T_aw = Te*(1+r*(2.74-1));\n",
+ "\n",
+ "# from eq.(18.53)\n",
+ "T_star = Te*(1 + 0.032*Me**2. + 0.58*(T_aw/Te-1.));\n",
+ "\n",
+ "# from the equation of state\n",
+ "rho_star = p_star/R/T_star;\n",
+ "\n",
+ "# from eq.(15.3)\n",
+ "mue_star = mue0*(T_star/T0)**1.5*(T0+110.)/(T_star+110.);\n",
+ "\n",
+ "# thus\n",
+ "Re_c_star = rho_star*ue*c/mue_star;\n",
+ "\n",
+ "# from eq.(18.22)\n",
+ "Cf_star = 1.328/sqrt(Re_c_star);\n",
+ "\n",
+ "# hence, the frictional drag on one surface of the plate is\n",
+ "D_f = 1./2.*rho_star*ue**2.*S*Cf_star;\n",
+ "\n",
+ "# thus, the total frictional drag is given by\n",
+ "D = 2.*D_f;\n",
+ "\n",
+ "print\"The total frictional drag is: D =\",D,\"N\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total frictional drag is: D = 4978.09594496 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E03 : Pg 600"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "from math import sqrt\n",
+ "Pr = 0.71; # Prandlt number of air at standard conditions\n",
+ "Pr_star = Pr;\n",
+ "Te = 288.; # temperature of the upper plate\n",
+ "ue = 1000.; # velocity of the upper plate\n",
+ "Me = 2.94; # Mach number of flow on the upper plate\n",
+ "p_star = 101000.;\n",
+ "R = 287.; # specific gas constant\n",
+ "gam = 1.4; # ratio of specific heats\n",
+ "T0 = 288.; # reference temperature at sea level\n",
+ "mue0 = 1.7894*10**-5; # reference viscosity at sea level\n",
+ "c = 2.; # chord length of the plate\n",
+ "S = 40.; # plate planform area\n",
+ "\n",
+ "# recovery factor for a boundary layer is given by eq.(18.47) as\n",
+ "r = sqrt(Pr);\n",
+ "\n",
+ "# from ex.(8.2)\n",
+ "T_aw = Te*2.467;\n",
+ "T_w = T_aw;\n",
+ "\n",
+ "# from the Meador-Smart equation\n",
+ "T_star = Te*(0.45 + 0.55*T_w/Te + 0.16*r*(gam-1)/2*Me**2.);\n",
+ "\n",
+ "# from the equation of state\n",
+ "rho_star = p_star/R/T_star;\n",
+ "\n",
+ "# from eq.(15.3)\n",
+ "mue_star = mue0*(T_star/T0)**1.5*(T0+110)/(T_star+110.);\n",
+ "\n",
+ "# thus\n",
+ "Re_c_star = rho_star*ue*c/mue_star;\n",
+ "\n",
+ "# from eq.(18.22)\n",
+ "Cf_star = 1.328/sqrt(Re_c_star);\n",
+ "\n",
+ "# hence, the frictional drag on one surface of the plate is\n",
+ "D_f = 1./2.*rho_star*ue**2.*S*Cf_star;\n",
+ "\n",
+ "# thus, the total frictional drag is given by\n",
+ "D = 2.*D_f;\n",
+ "\n",
+ "print\"The total frictional drag is: D =\",D,\"N\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total frictional drag is: D = 5014.11379241 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER19_2.ipynb b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER19_2.ipynb new file mode 100644 index 00000000..70789740 --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./CHAPTER19_2.ipynb @@ -0,0 +1,184 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:2b59bbbb37d54ad48d02f3d32b2d6696ff728d497e73c762891fa7cf7f659dfb"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "CHAPTER19:TURBULENT BOUNDARY LAYERS"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E01 : Pg 612"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "# (a)\n",
+ "from math import sqrt\n",
+ "Re_c = 1.36e7; # as obtained from ex. 18.1a\n",
+ "rho_inf = 1.22; # freestream air denstiy\n",
+ "S = 40.; # plate planform area\n",
+ "# hence, from eq.(19.2)\n",
+ "Cf = 0.074/Re_c**0.2;\n",
+ "V_inf = 100.;\n",
+ "# hence, for one side of the plate\n",
+ "D_f = 1./2.*rho_inf*V_inf**2.*S*Cf;\n",
+ "# the total drag on both the surfaces is\n",
+ "D = 2.*D_f;\n",
+ "print\"The total frictional drag is: (a)D =\",D,\"N\"\n",
+ "# (b)\n",
+ "Re_c = 1.36e8; # as obtained from ex. 18.1b\n",
+ "# hence, from fig 19.1 we have\n",
+ "Cf = 1.34*10.**-3.;\n",
+ "V_inf = 1000.;\n",
+ "# hence, for one side of the plate\n",
+ "D_f = 1./2.*rho_inf*V_inf**2.*S*Cf;\n",
+ "# the total drag on both the surfaces is\n",
+ "D = 2.*D_f;\n",
+ "print\"(b) D =\",D,\"N\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total frictional drag is: (a)D = 1351.89748485 N\n",
+ "(b) D = 65392.0 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E02 : Pg 612"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "# from ex 18.2\n",
+ "from math import sqrt\n",
+ "Re_c_star = 3.754e7; # Reynolds number at the trailing edge of the plate\n",
+ "rho_star = 0.574;\n",
+ "ue = 1000.; # velocity of the upper plate\n",
+ "S = 40.; # plate planform area\n",
+ "# from eq.(19.3) we have\n",
+ "Cf_star = 0.074/Re_c_star**0.2;\n",
+ "# hence, for one side of the plate\n",
+ "D_f = 1./2.*rho_star*ue**2.*S*Cf_star;\n",
+ "# the total drag on both the surfaces is\n",
+ "D = 2.*D_f;\n",
+ "print\"The total frictional drag is:D =\",D,\"N\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total frictional drag is:D = 51916.421508 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example E03 : Pg 615"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "# All the quantities are expressed in SI units\n",
+ "import math \n",
+ "Me = 2.94; # mach number of the flow over the upper plate\n",
+ "ue = 1000.;\n",
+ "Te = 288.; # temperature of the upper plate\n",
+ "ue = 1000.; # velocity of the upper plate\n",
+ "S = 40.; # plate planform area\n",
+ "Pr = 0.71; # Prandlt number of air at standard condition\n",
+ "gam = 1.4; # ratio of specific heats\n",
+ "\n",
+ "# the recovery factor is given as\n",
+ "r = Pr**(1./3.);\n",
+ "\n",
+ "# for M = 2.94\n",
+ "T_aw = Te*(1.+r*(2.74-1.));\n",
+ "T_w = T_aw; # since the flat plate has an adiabatic wall\n",
+ "\n",
+ "# from the Meador-Smart equation\n",
+ "T_star = Te*(0.5*(1.+T_w/Te) + 0.16*r*(gam-1.)/2.*Me**2.);\n",
+ "\n",
+ "# from the equation of state\n",
+ "p_star=1.\n",
+ "R=1.\n",
+ "rho_star = p_star/R/T_star;\n",
+ "\n",
+ "# from eq.(15.3)\n",
+ "mue0=1.\n",
+ "T0=1.\n",
+ "c=1.\n",
+ "mue_star = mue0*(T_star/T0)**1.5*(T0+110.)/(T_star+110.);\n",
+ "\n",
+ "# thus\n",
+ "Re_c_star = rho_star*ue*c/mue_star;\n",
+ "\n",
+ "# from eq.(18.22)\n",
+ "Cf_star = 0.02667/Re_c_star**0.139;\n",
+ "\n",
+ "# hence, the frictional drag on one surface of the plate is\n",
+ "D_f = 1./2.*rho_star*ue**2.*S*Cf_star;\n",
+ "\n",
+ "# thus, the total frictional drag is given by\n",
+ "D = 2.*D_f;\n",
+ "\n",
+ "print\"The total frictional drag is:D =\",D,\"N\""
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The total frictional drag is:D = 4967.70450221 N\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./screenshots/Screenshot02_2.png b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./screenshots/Screenshot02_2.png Binary files differnew file mode 100644 index 00000000..e38c28d3 --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./screenshots/Screenshot02_2.png diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./screenshots/Screenshot04_2.png b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./screenshots/Screenshot04_2.png Binary files differnew file mode 100644 index 00000000..7ef80327 --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./screenshots/Screenshot04_2.png diff --git a/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./screenshots/Screenshot08_2.png b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./screenshots/Screenshot08_2.png Binary files differnew file mode 100644 index 00000000..d1376f9c --- /dev/null +++ b/Fundamentals_Of_Aerodynamics_by_J._D._Anderson_Jr./screenshots/Screenshot08_2.png diff --git a/sample_notebooks/Vaibhav Vajani/chapter2_1.ipynb b/sample_notebooks/Vaibhav Vajani/chapter2_1.ipynb new file mode 100644 index 00000000..40066b00 --- /dev/null +++ b/sample_notebooks/Vaibhav Vajani/chapter2_1.ipynb @@ -0,0 +1,1360 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2: Determinants and Matrices" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.1, page no. 55" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Determinant of A is: a*b*c - a*f**2 - b*g**2 - c*h**2 + 2*f*g*h\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "a = sympy.Symbol('a')\n", + "h = sympy.Symbol('h')\n", + "g = sympy.Symbol('g')\n", + "b = sympy.Symbol('b')\n", + "f = sympy.Symbol('f')\n", + "c = sympy.Symbol('c')\n", + "A = sympy.Matrix([[a,h,g],[h,b,f],[g,f,c]])\n", + "\n", + "print \"Determinant of A is: \", A.det()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2, page no. 55" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false, + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Determinanat of a is: 88.0\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.array([[0,1,2,3],[1,0,3,0],[2,3,0,1],[3,0,1,2]])\n", + "print \"Determinant of a is:\",numpy.linalg.det(A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.3, page no. 56" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-a**3*b**2*c + a**3*b*c**2 + a**2*b**3*c - a**2*b*c**3 + a**2*b - a**2*c - a*b**3*c**2 + a*b**2*c**3 - a*b**2 + a*c**2 + b**2*c - b*c**2\n" + ] + } + ], + "source": [ + "import numpy\n", + "import sympy\n", + "\n", + "a = sympy.Symbol('a');\n", + "b = sympy.Symbol('b');\n", + "c = sympy.Symbol('c');\n", + "A = sympy.Matrix([[a,a**2,a**3-1],[b,b**2,b**3-1],[c,c**2,c**3-1]])\n", + "\n", + "print A.det()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.4, page no. 57" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Determinanat of a is: -24.0\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.array([[21,17,7,10],[24,22,6,10],[6,8,2,3],[6,7,1,2]])\n", + "print \"Determinanat of a is:\",numpy.linalg.det(A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "imp" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a: x**y*log(x)\n", + "b: x**y*y*log(x)/x + x**y/x\n", + "c: x**y*y**2*log(x)/x**2 - x**y*y*log(x)/x**2 + 2*x**y*y/x**2 - x**y/x**2\n", + "d: x**y*y/x\n", + "e: x**y*y*log(x)/x + x**y/x\n", + "f: x**y*y**2*log(x)/x**2 - x**y*y*log(x)/x**2 + 2*x**y*y/x**2 - x**y/x**2\n", + "Clearly c = f\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "x = sympy.Symbol('x');\n", + "y = sympy.Symbol('y')\n", + "u = x**y\n", + "a = sympy.diff(u, y)\n", + "b = sympy.diff(a, x)\n", + "c = sympy.diff(b, x)\n", + "d = sympy.diff(u, x)\n", + "e = sympy.diff(d, y)\n", + "f = sympy.diff(e, x)\n", + "print \"a: \", a\n", + "print \"b: \", b\n", + "print \"c: \", c\n", + "print \"d: \", d\n", + "print \"e: \", e\n", + "print \"f: \", f\n", + "print \"Clearly c = f\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.17, page no. 65" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A*B=\n", + "[[ 5 9 13]\n", + " [-1 2 4]\n", + " [-2 2 4]]\n", + "\n", + "B*A=\n", + "[[-1 12 11]\n", + " [-1 7 8]\n", + " [-2 -1 5]]\n", + "Clearly AB is not equal to BA\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.array([[1,3,0],[-1,2,1],[0,0,2]])\n", + "B = numpy.array([[2,3,4],[1,2,3],[-1,1,2]])\n", + "ma = numpy.matrix(A)\n", + "mb = numpy.matrix(B)\n", + "print \"A*B=\"\n", + "print ma*mb\n", + "print \"\"\n", + "print \"B*A=\"\n", + "print mb*ma\n", + "print \"Clearly AB is not equal to BA\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.18, page no. 65" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "AB=C−−>B=inv(A)∗C\n", + "\n", + "[[ 1.00000000e+00 -1.77635684e-15 -8.88178420e-16]\n", + " [ -2.22044605e-16 2.00000000e+00 -1.11022302e-16]\n", + " [ 1.77635684e-15 0.00000000e+00 1.00000000e+00]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.matrix([[3,2,2],[1,3,1],[5,3,4]])\n", + "C = numpy.matrix([[3,4,2],[1,6,1],[5,6,4]])\n", + "print \"AB=C−−>B=inv(A)∗C\"\n", + "print \"\"\n", + "B = numpy.linalg.inv(A)*C \n", + "print B" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.19, page no. 66" + ] + }, + { + "cell_type": "code", + "execution_count": 48, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Aˆ3−4∗Aˆ2−3A+11*I=\n", + "\n", + "[[ 0. 0. 0.]\n", + " [ 0. 0. 0.]\n", + " [ 0. 0. 0.]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.array([[1,3,2],[2,0,-1],[1,2,3]])\n", + "I = numpy.eye(3)\n", + "A = numpy.matrix(A)\n", + "print \"Aˆ3−4∗Aˆ2−3A+11*I=\"\n", + "print \"\"\n", + "print A**3-4*A**2-3*A+11*I" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.20, page no. 67" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter the value of n: 3\n", + "Calculating A ^ n: \n", + "[[ 31 -75]\n", + " [ 12 -29]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "0\n", + "A = numpy.matrix([[11,-25],[4, -9]])\n", + "n = int(raw_input(\"Enter the value of n: \"))\n", + "print \"Calculating A ^ n: \"\n", + "print A**n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.23, page no. 70" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Inverse of A is: \n", + "[[ 3. 1. 1.5 ]\n", + " [-1.25 -0.25 -0.75]\n", + " [-0.25 -0.25 -0.25]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.matrix([[1,1,3],[1,3,-3],[-2,-4,-4]])\n", + "print \"Inverse of A is: \"\n", + "print numpy.linalg.inv(A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.24.1, page no. 71" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Rank of A is: 2\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.matrix([[1,2,3],[1,4,2],[2,6,5]])\n", + "print \"Rank of A is:\",numpy.linalg.matrix_rank(A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.24.2, page no. 71" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Rank of A is: 2\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.matrix([[0,1,-3,-1],[1,0,1,1],[3,1,0,2],[1,1,-2,0]])\n", + "print \"Rank of A is:\",numpy.linalg.matrix_rank(A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.25, page no. 72" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Inverse of A is: \n", + "[[ 3. 1. 1.5 ]\n", + " [-1.25 -0.25 -0.75]\n", + " [-0.25 -0.25 -0.25]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.matrix([[1,1,3],[1,3,-3],[-2,-4,-4]])\n", + "print \"Inverse of A is: \"\n", + "print numpy.linalg.inv(A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.26, page no. 73" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Rank of A is: 3\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.matrix([[2,3,-1,-1],[1,-1,-2,-4],[3,1,3,-2],[6,3,0,-7]])\n", + "r,p = numpy.linalg.eigh ( A )\n", + "print \"Rank of A is:\",numpy.linalg.matrix_rank(A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.28, page no. 75" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Inverse of A is: \n", + "[[ 1.4 0.2 -0.4]\n", + " [-1.5 0. 0.5]\n", + " [ 1.1 -0.2 -0.1]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.matrix([[1,1,1],[4,3,-1],[3,5,3]])\n", + "print \"Inverse of A is: \"\n", + "print numpy.linalg.inv(A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.31, page no. 78" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " The equations can be rewritten as AX=B where X=[ x1 ; x2 ; x3 ; x4 ] and \n", + "Determinant of A=\n", + "8.0\n", + "Inverse of A =\n", + "[[ 0.5 0.5 0.5 -0.5]\n", + " [-0.5 0. 0. 0.5]\n", + " [ 0. -0.5 0. 0.5]\n", + " [ 0. 0. -0.5 0.5]]\n", + "X= [[ 1.]\n", + " [-1.]\n", + " [ 2.]\n", + " [-2.]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "print \"The equations can be rewritten as AX=B where X=[ x1 ; x2 ; x3 ; x4 ] and \"\n", + "A = numpy.matrix([[1,-1,1,1],[1,1,-1,1],[1,1,1,-1],[1,1,1,1]])\n", + "B = numpy.matrix([[2],[-4],[4],[0]])\n", + "print \"Determinant of A=\"\n", + "print numpy.linalg.det(A)\n", + "print \"Inverse of A =\"\n", + "print numpy.linalg.inv(A)\n", + "print \"X=\",numpy.linalg.inv(A)*B" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.32, page no. 78" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The equations can be rewritten as AX=B where X=[x;y;z] and\n", + "Determinant of A=\n", + "-8.79296635503e-14\n", + "Since det(A)=0 , hence, this system of equation will have infinite solutions.. hence, the system is consistent\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "print \"The equations can be rewritten as AX=B where X=[x;y;z] and\"\n", + "A = numpy.matrix([[5,3,7],[3,26,2],[7,2,10]])\n", + "B = numpy.matrix([[4],[9],[5]])\n", + "print \"Determinant of A=\"\n", + "print numpy.linalg.det(A)\n", + "print \"Since det(A)=0 , hence, this system of equation will have infinite solutions.. hence, the system is consistent\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.34.1, page no. 80" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Rank of A is 3\n", + "Equations have only a trivial solution : x=y=z=0\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.matrix([[1,2,3],[3,4,4],[7,10,12]])\n", + "p = numpy.linalg.matrix_rank(A)\n", + "print \"Rank of A is\",p\n", + "if p==3:\n", + " print \"Equations have only a trivial solution : x=y=z=0\"\n", + "else:\n", + " print \"Equations have infinite no . of solutions.\"" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 2.34.2, page no. 80" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Rank of A is 2\n", + "Equations have infinite no. of solutions.\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.matrix([[4,2,1,3],[6,3,4,7],[2,1,0,1]])\n", + "p = numpy.linalg.matrix_rank(A)\n", + "print \"Rank of A is\",p\n", + "if p ==4:\n", + " print \"Equations have only a trivial solution : x=y=z=0\"\n", + "else:\n", + " print \"Equations have infinite no. of solutions.\"" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 2.38, page no. 83" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The given equations can be written as Y=AX where\n", + "Determinant of A is -1.0\n", + "Since, its non−singular, hence transformation is regular\n", + "Inverse of A is\n", + "[[ 2. -2. -1.]\n", + " [-4. 5. 3.]\n", + " [ 1. -1. -1.]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "print \"The given equations can be written as Y=AX where\"\n", + "A = numpy.matrix([[2,1,1],[1,1,2],[1,0,-2]])\n", + "print \"Determinant of A is\",numpy.linalg.det ( A )\n", + "print \"Since, its non−singular, hence transformation is regular\"\n", + "print\"Inverse of A is\"\n", + "print numpy.linalg.inv ( A )" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.39, page no. 84" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[[-0.66666667 0.33333333 0.66666667]\n", + " [ 0.66666667 0.66666667 0.33333333]\n", + " [ 0.33333333 -0.66666667 0.66666667]]\n", + "A transpose is equal to\n", + "[[-0.66666667 0.66666667 0.33333333]\n", + " [ 0.33333333 0.66666667 -0.66666667]\n", + " [ 0.66666667 0.33333333 0.66666667]]\n", + "A∗(transpose of A)=\n", + "[[ 1. 0. 0.]\n", + " [ 0. 1. 0.]\n", + " [ 0. 0. 1.]]\n", + "Hence, A is orthogonal\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.matrix([[-2./3,1./3,2./3],[2./3,2./3,1./3],[1./3,-2./3,2./3]])\n", + "print A\n", + "print \"A transpose is equal to\"\n", + "print A.transpose()\n", + "print \"A∗(transpose of A)=\"\n", + "print A*A.transpose()\n", + "print \"Hence, A is orthogonal\"" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 2.42, page no. 87" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Let R represents the matrix of transformation and P represents a diagonal matrix whose values are the eigenvalues of A. then\n", + "R is normalised. let U represents unnormalised version of r\n", + "Two eigen vectors are the two columns of U\n", + "[[ 4. 1.]\n", + " [ 0. 0.]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "import math\n", + "\n", + "A = numpy.matrix([[5,4],[1,2]])\n", + "print \"Let R represents the matrix of transformation and P represents a diagonal matrix whose values are the eigenvalues of A. then\"\n", + "P,R= numpy.linalg.eig(A)\n", + "U = numpy.zeros([2, 2])\n", + "print \"R is normalised. let U represents unnormalised version of r\"\n", + "U[0,0]= R[0,0]*math.sqrt(17)\n", + "U[0,1]= R[0,1]*math.sqrt(17)\n", + "U[0,1]= R[1,1]*math.sqrt(2)\n", + "print \"Two eigen vectors are the two columns of U\"\n", + "print U" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Examle 2.43, page no. 88" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Let Rrepresents the matrix of transformation and Prepresents a diagonalmatrix whose values are the eigenvalues of A. then\n", + "R is normalised. let U represents unnormalised version of r\n", + "[-2. 3. 6.]\n", + "Three eigen vectors are the three columns of U\n", + "[[ -2.82842712 5.19615242 14.69693846]\n", + " [ 0. 0. 0. ]\n", + " [ 0. 0. 0. ]]\n" + ] + } + ], + "source": [ + "import numpy,math\n", + "\n", + "A = numpy.matrix([[1,1,3],[1,5,1],[3,1,1]])\n", + "U = numpy.zeros([3,3])\n", + "print \"Let Rrepresents the matrix of transformation and Prepresents a diagonalmatrix whose values are the eigenvalues of A. then\"\n", + "R,P = numpy.linalg.eig(A)\n", + "print \"R is normalised. let U represents unnormalised version of r\"\n", + "print R\n", + "U[0,0] = R[0]*math.sqrt(2) \n", + "U[0,1] = R[1]*math.sqrt(3)\n", + "U[0,2] = R[2]*math.sqrt(6)\n", + "print \"Three eigen vectors are the three columns of U\"\n", + "print U" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.44, page no. 89" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Let Rrepresents the matrix of transformation and Prepresents a diagonalmatrix whose values are the eigenvalues of A. then\n", + "R is normalised. let U represents unnormalised version of r\n", + "[ 3. 2. 5.]\n", + "Three eigen vectors are the three columns of U\n", + "[[ 3. 2. 18.70828693]\n", + " [ 0. 0. 0. ]\n", + " [ 0. 0. 0. ]]\n" + ] + } + ], + "source": [ + "import numpy,math\n", + "\n", + "A = numpy.matrix([[3,1,4],[0,2,6],[0,0,5]])\n", + "U = numpy.zeros([3,3])\n", + "print \"Let Rrepresents the matrix of transformation and Prepresents a diagonalmatrix whose values are the eigenvalues of A. then\"\n", + "R,P = numpy.linalg.eig(A)\n", + "print \"R is normalised. let U represents unnormalised version of r\"\n", + "print R\n", + "U[0,0] = R[0]*math.sqrt(1) \n", + "U[0,1] = R[1]*math.sqrt(1)\n", + "U[0,2] = R[2]*math.sqrt(14)\n", + "print \"Three eigen vectors are the three columns of U\"\n", + "print U" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.45, page no. 90" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Eigen values of A are\n", + "(array([-1., 5.]), matrix([[-0.89442719, -0.70710678],\n", + " [ 0.4472136 , -0.70710678]]))\n", + "Let\n", + "Hence, the characteristic equation is ( x−a ) ( x−b)\n", + "[-8 -5]\n", + "Aˆ2−4∗A−5∗ I=\n", + "[[ 0. 0.]\n", + " [ 0. 0.]]\n", + "Inverse of A=\n", + "[[-0.6 0.8]\n", + " [ 0.4 -0.2]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly([0])\n", + "A = numpy.matrix([[1,4],[2,3]])\n", + "I = numpy.eye(2)\n", + "print \"Eigen values of A are\"\n", + "print numpy.linalg.eig(A)\n", + "print \"Let\"\n", + "a = -1;\n", + "b = 5;\n", + "print \"Hence, the characteristic equation is ( x−a ) ( x−b)\"\n", + "print ( x - a ) *( x - b )\n", + "\n", + "print \"Aˆ2−4∗A−5∗ I=\"\n", + "print A**2-4*A-5* I\n", + "print \"Inverse of A=\"\n", + "print numpy.linalg.inv ( A )" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.46, page no. 91" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Egenvalues of A are\n", + "(array([ 4.25683813, 0.40327935, -4.66011748]), matrix([[ 0.10296232, -0.91299477, -0.48509974],\n", + " [-0.90473047, 0.40531299, 0.37306899],\n", + " [ 0.41335402, 0.04649661, 0.79088417]]))\n", + "Let\n", + "Hence, the characteristic equation is ( x−a ) ( x−b) ( x−c )\n", + "[-10.99999905 8.00000095]\n", + "Inverse of A=\n", + "[[ 3. 1. 1.5 ]\n", + " [-1.25 -0.25 -0.75]\n", + " [-0.25 -0.25 -0.25]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly([0])\n", + "A = numpy.matrix([[1,1,3],[1,3,-3],[-2,-4,-4]])\n", + "print \"Egenvalues of A are\"\n", + "print numpy.linalg.eig(A)\n", + "print \"Let\"\n", + "a =4.2568381\n", + "b =0.4032794\n", + "c = -4.6601175\n", + "print \"Hence, the characteristic equation is ( x−a ) ( x−b) ( x−c )\"\n", + "p = (x-a)*(x-b)*(x-c)\n", + "print p\n", + "print \"Inverse of A=\"\n", + "print numpy.linalg.inv(A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.47, page no. 91" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Eigenvalues of A are\n", + "(array([ 3., 1., 1.]), matrix([[ 0.70710678, -0.70710678, -0.40824829],\n", + " [ 0. , 0. , 0.81649658],\n", + " [ 0.70710678, 0.70710678, -0.40824829]]))\n", + "Let\n", + "Hence, the characteristic equation is (x−a)(x−b)(x−c)=\n", + "[ 0 -3]\n", + "Aˆ8−5∗Aˆ7+7∗Aˆ6−3∗Aˆ5+Aˆ4−5∗Aˆ3+8∗Aˆ2−2∗A+I =\n", + "[[ 8. 5. 5.]\n", + " [ 0. 3. 0.]\n", + " [ 5. 5. 8.]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly([0])\n", + "A = numpy.matrix([[2,1,1],[0,1,0],[1,1,2]])\n", + "I = numpy.eye(3)\n", + "print \"Eigenvalues of A are\"\n", + "print numpy.linalg.eig(A)\n", + "print \"Let\"\n", + "a =1\n", + "b =1\n", + "c =3\n", + "print \"Hence, the characteristic equation is (x−a)(x−b)(x−c)=\"\n", + "p = (x-a)*(x-b)*(x-c)\n", + "print p\n", + "print \"Aˆ8−5∗Aˆ7+7∗Aˆ6−3∗Aˆ5+Aˆ4−5∗Aˆ3+8∗Aˆ2−2∗A+I =\"\n", + "print A**8-5*A**7+7*A**6-3*A**5+A**4-5*A**3+8*A**2-2*A+I" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 2.48, page no. 93" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "R is matrix of transformation and D is a diagonal matrix\n", + "[-1.65544238 -0.21075588 2.86619826]\n", + "[[-0.87936655 -0.34661859 -0.32645063]\n", + " [ 0.11410244 0.51222983 -0.85123513]\n", + " [-0.46227167 0.78579651 0.41088775]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.matrix([[-1,2,-2],[1,2,1],[-1,-1,0]])\n", + "print \"R is matrix of transformation and D is a diagonal matrix\"\n", + "[R,D]= numpy.linalg.eigh(A)\n", + "print R\n", + "print D" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.49, page no. 93" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "R is matrix of transformation and D is a diagonal matrix\n", + "R is normalised, let P denotes unnormalised version of R . Then \n", + "[ 3. 2. 5.]\n", + "[[ 4.24264069 3.46410162 12.24744871]\n", + " [ 0. 0. 0. ]\n", + " [ 0. 0. 0. ]]\n", + "A^4= [[ 81 65 1502]\n", + " [ 0 16 1218]\n", + " [ 0 0 625]]\n" + ] + } + ], + "source": [ + "import numpy,math\n", + "\n", + "A = numpy.matrix([[3,1,4],[0,2,6],[0,0,5]])\n", + "P = numpy.zeros([3,3])\n", + "print \"R is matrix of transformation and D is a diagonal matrix\"\n", + "R,D = numpy.linalg.eig(A)\n", + "print \"R is normalised, let P denotes unnormalised version of R . Then \"\n", + "print R\n", + "P[0,0] = R[0]*math.sqrt(2) \n", + "P[0,1] = R[1]*math.sqrt(3)\n", + "P[0,2] = R[2]*math.sqrt(6)\n", + "print P\n", + "print \"A^4= \",A**4" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.50, page no. 94" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "3∗xˆ2+5∗yˆ2+3∗zˆ2−2∗y∗z+2∗z∗x−2∗x∗y\n", + "The matrix of the given quadratic form is\n", + "Let R represents the matrix of transformation and Prepresents a diagonal matrix whose values are the eigenvalues of A. then\n", + "So, canonical form is 2∗xˆ2+3∗yˆ2+6∗zˆ2\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "print \"3∗xˆ2+5∗yˆ2+3∗zˆ2−2∗y∗z+2∗z∗x−2∗x∗y\"\n", + "print \"The matrix of the given quadratic form is\"\n", + "A = numpy.matrix([[3,-1,1],[-1,5,-1],[1,-1,3]])\n", + "print \"Let R represents the matrix of transformation and Prepresents a diagonal matrix whose values are the eigenvalues of A. then\"\n", + "[R,P] = numpy.linalg.eig(A)\n", + "print \"So, canonical form is 2∗xˆ2+3∗yˆ2+6∗zˆ2\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.51, page no. 95" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2∗x1∗x2+2∗x1∗x3−2∗x2∗x3\n", + "The matrix of the given quadratic form is\n", + "Let R represents the matrix of transformation and P represents a diagonal matrix whose values are the eigenvalues of A. then\n", + "so, canonical form is −2∗xˆ2+yˆ2+ zˆ2\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "print \"2∗x1∗x2+2∗x1∗x3−2∗x2∗x3\"\n", + "print \"The matrix of the given quadratic form is\"\n", + "A = numpy.matrix([[0,1,1],[1,0,-1],[1,-1,0]])\n", + "print \"Let R represents the matrix of transformation and P represents a diagonal matrix whose values are the eigenvalues of A. then\"\n", + "[R,P] = numpy.linalg.eig(A)\n", + "print \"so, canonical form is −2∗xˆ2+yˆ2+ zˆ2\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.52, page no. 96" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A∗= [[ 2.-1.j -5.-0.j]\n", + " [ 3.-0.j 0.-1.j]\n", + " [-1.-3.j 4.+2.j]]\n", + "AA∗= [[ 24.+0.j -20.+2.j]\n", + " [-20.-2.j 46.+0.j]]\n", + "Clearly, AA∗ is hermitian matrix\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "'''\n", + "A=[2+%i 3 -1+3*%i;-5 %i 4-2*%i]\n", + "'''\n", + "\n", + "A = numpy.matrix([[2+1j,3,-1+3*1j],[-5,1j,4-2*1j]])\n", + "#A = A.getH()\n", + "print \"A∗=\", A.getH()\n", + "print \"AA∗=\", A*(A.getH())\n", + "print \"Clearly, AA∗ is hermitian matrix\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.53, page no. 97" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " A∗= [[ 0.-0.j 0.-0.j]\n", + " [-0.-0.j 0.-0.j]]\n", + "AA∗= [[ 0.+0.j 0.+0.j]\n", + " [ 0.+0.j 0.+0.j]]\n", + "A∗A= [[ 0.+0.j 0.+0.j]\n", + " [ 0.+0.j 0.+0.j]]\n" + ] + } + ], + "source": [ + "import numpy \n", + "\n", + "A = numpy.matrix([[(1/2)*(1+1j),(1/2)*(-1+1j)],[(1/2)*(1+1j),(1/2)*(1-1j)]])\n", + "print \"A∗=\", A.getH()\n", + "print \"AA∗=\", A*(A.getH())\n", + "print \"A∗A=\", (A.getH())*A" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.54, page no. 97" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "I−A=\n", + "inverse of (I+A)=\n", + "[[ 0.16666667+0.j -0.16666667-0.33333333j]\n", + " [ 0.16666667-0.33333333j 0.16666667+0.j ]]\n", + "((I−A)(inverse(I+A)))∗((I−A)(inverse(I+A)))=\n", + "[[ 1.11111111e-01-0.44444444j -2.77555756e-17+0.88888889j]\n", + " [ -2.77555756e-17+0.88888889j 1.11111111e-01+0.44444444j]]\n", + "((I−A)(inverse(I+A)))((I−A)(inverse(I+A)))∗=\n", + "[[ 1.11111111e-01+0.44444444j 1.11022302e-16+0.88888889j]\n", + " [ 1.11022302e-16+0.88888889j 1.11111111e-01-0.44444444j]]\n", + "Clearly, the product is an identity matrix.hence, it is a unitary matrix\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.matrix([[0,1+2*1j],[-1+2*1j,0]])\n", + "I = numpy.eye(2)\n", + "print \"I−A=\"\n", + "I-A\n", + "print \"inverse of (I+A)=\"\n", + "print numpy.linalg.inv(I+A)\n", + "print \"((I−A)(inverse(I+A)))∗((I−A)(inverse(I+A)))=\"\n", + "print (((I-A)*(numpy.linalg.inv(I+A))).T)*((I-A)*(numpy.linalg.inv(I+A)))\n", + "print \"((I−A)(inverse(I+A)))((I−A)(inverse(I+A)))∗=\"\n", + "print ((I-A)*(numpy.linalg.inv(I+A)))*(((I-A)*(numpy.linalg.inv(I+A))).T)\n", + "print \"Clearly, the product is an identity matrix.hence, it is a unitary matrix\"" + ] + } + ], + "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.11+" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} |