From e1a99f22a1f0191d26327539950a9dfb5bc34c68 Mon Sep 17 00:00:00 2001 From: Trupti Kini Date: Tue, 17 May 2016 23:30:26 +0600 Subject: Added(A)/Deleted(D) following books A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/CHAPTER11_3.ipynb A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/CHAPTER12_3.ipynb A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/CHAPTER15_3.ipynb A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/CHAPTER16_3.ipynb A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/CHAPTER17_3.ipynb A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/CHAPTER20_3.ipynb A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/CHAPTER21_3.ipynb A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/CHAPTER3_3.ipynb A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/CHAPTER4_3.ipynb A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/CHAPTER5_3.ipynb A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/CHAPTER7_3.ipynb A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/screenshots/HeatTransfer(3)_3.png A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/screenshots/cycleWorkEff(4)_3.png A A_textbook_of_Internal_Combustion_Engines_by_R._K._Rajput/screenshots/volumetric_Eff(7)_3.png A Advance_Semiconductor_Devices_by_K._C._Nandi/README.txt A Strength_Of_Materials_by_S_S_Bhavikatti/chapter_no.10_4.ipynb A Strength_Of_Materials_by_S_S_Bhavikatti/chapter_no.1_4.ipynb A Strength_Of_Materials_by_S_S_Bhavikatti/chapter_no.2_4.ipynb A Strength_Of_Materials_by_S_S_Bhavikatti/chapter_no.3_4.ipynb A Strength_Of_Materials_by_S_S_Bhavikatti/chapter_no.4_4.ipynb A Strength_Of_Materials_by_S_S_Bhavikatti/chapter_no.5_4.ipynb A Strength_Of_Materials_by_S_S_Bhavikatti/chapter_no.6_4.ipynb A Strength_Of_Materials_by_S_S_Bhavikatti/chapter_no.7_4.ipynb A Strength_Of_Materials_by_S_S_Bhavikatti/chapter_no.8_4.ipynb A Strength_Of_Materials_by_S_S_Bhavikatti/chapter_no.9_4.ipynb A Strength_Of_Materials_by_S_S_Bhavikatti/screenshots/B.M.D_1_3.JPG A Strength_Of_Materials_by_S_S_Bhavikatti/screenshots/S.F.D_1_3.jpg A Strength_Of_Materials_by_S_S_Bhavikatti/screenshots/S.F.D_2_3.jpg A sample_notebooks/AshishKumar/Chapter2.ipynb A "sample_notebooks/Mohd. Arif/Chapter4.ipynb" A sample_notebooks/RavirajJadeja/Chapter2.ipynb A "sample_notebooks/Vaibhav Vajani/chapter1_2.ipynb" A sample_notebooks/pratikgandhi/Chapter1.ipynb --- sample_notebooks/AshishKumar/Chapter2.ipynb | 444 +++++ sample_notebooks/Mohd. Arif/Chapter4.ipynb | 513 +++++ sample_notebooks/RavirajJadeja/Chapter2.ipynb | 698 +++++++ sample_notebooks/Vaibhav Vajani/chapter1_2.ipynb | 582 ++++++ sample_notebooks/pratikgandhi/Chapter1.ipynb | 2189 ++++++++++++++++++++++ 5 files changed, 4426 insertions(+) create mode 100644 sample_notebooks/AshishKumar/Chapter2.ipynb create mode 100644 sample_notebooks/Mohd. Arif/Chapter4.ipynb create mode 100644 sample_notebooks/RavirajJadeja/Chapter2.ipynb create mode 100644 sample_notebooks/Vaibhav Vajani/chapter1_2.ipynb create mode 100644 sample_notebooks/pratikgandhi/Chapter1.ipynb (limited to 'sample_notebooks') diff --git a/sample_notebooks/AshishKumar/Chapter2.ipynb b/sample_notebooks/AshishKumar/Chapter2.ipynb new file mode 100644 index 00000000..8d9af0c5 --- /dev/null +++ b/sample_notebooks/AshishKumar/Chapter2.ipynb @@ -0,0 +1,444 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 2 Switched communication systems" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.2, page no 125" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "maximum auxillary current is:10.00 mA\n", + "\n", + "MMF in the auxillary winding is:2.00AT \n", + "\n", + "MMF in main winding is:40.00 AT \n", + "\n", + "net MMF required in main winding is:44.00 AT \n", + "\n", + "operating current needed is:4.40 mA \n", + "\n", + "working voltage is:2.84 volts \n", + "\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "#given\n", + "Io=4*10**-3 #rqueired operating current\n", + "N1=10000 #no of turns in the main winding\n", + "R1=645 #resistence of the main winding in ohms\n", + "N2=200 #no of turns in auxillary winding\n", + "B=2 #spacing bias\n", + "Iaux=B/N2 #maximum auxillary current\n", + "print \"maximum auxillary current is:%0.2f mA\\n\"%(Iaux*1e3)\n", + "MMFaux=N2*Iaux #MMF in the auxillary winding\n", + "print \"MMF in the auxillary winding is:%0.2fAT \\n\"%(MMFaux)\n", + "MMFop=Io*N1 #operating MFF in main winding\n", + "print \"MMF in main winding is:%0.2f AT \\n\"%(MMFop)\n", + "MMFnet=MMFop+(0.1*MMFop) #net MMF required in main winding\n", + "print \"net MMF required in main winding is:%0.2f AT \\n\"%(MMFnet)\n", + "Iop=MMFnet/N1 #operating current needed\n", + "print \"operating current needed is:%0.2f mA \\n\"%(Iop*1e3)\n", + "V=Iop*R1 #working voltage in volts\n", + "print \"working voltage is:%0.2f volts \\n\"%(V)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.3,page no 125" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Busy hour calling rate is:1.20 \n", + "\n", + "Rate of traffic flow is 250.00 traffic unit \n" + ] + } + ], + "source": [ + "#given\n", + "C=6000#Tatol no of call in busy hour\n", + "SC=5000#no of subscribers\n", + "CR=C/SC#busy hour calling rate\n", + "print \"Busy hour calling rate is:%0.2f \\n\"%(CR)\n", + "T=2.5/60#avarage duration of calls in hours\n", + "\n", + "A=C*T#rate of traffic flow\n", + "print \"Rate of traffic flow is %0.2f traffic unit \"%(A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.4,page no 126" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "maxixmum current is 33.33 mamps \n", + "\n", + "operate lag is 1.83 msec \n", + "\n", + "release lag is 2.85 msec \n", + "\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from math import log\n", + "#given\n", + "L=3#relay inductance in henry\n", + "R=1500#relay resistance in ohm\n", + "Io=20e-3#oparating current in amps\n", + "Ir=8e-3#release current in amps\n", + "\n", + "V=50#supply volatage in volts\n", + "Im=V/R#maxixmum current in amps\n", + "print \"maxixmum current is %0.2f mamps \\n\"%(Im*1e3)\n", + "to=(L/R)*log(1/(1-(Io/Im)))#operate lag in sec\n", + "print \"operate lag is %0.2f msec \\n\"%(to*1000)\n", + "tr=(L/R)*log(Im/Ir)#release lag in sec\n", + "print \"release lag is %0.2f msec \\n\"%(tr*1000)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.4.1,page no 126" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(a)\n", + "periods per character is:150.00 msec\n", + "\n", + "period per element is:20.00 msec\n", + "\n", + "speed is:50.00 bauds\n", + "\n", + "\n", + "(b)\n", + "periods per character is:100.00 msec\n", + "\n", + "period per element is:13.33 msec\n", + "\n", + "speed is 75.00 bauds\n", + "\n", + "\n", + "(c)\n", + "periods per character is:100.00 msec\n", + "\n", + "period per element is:10.00 msec\n", + "\n", + "speed is 100.00 bauds\n", + "\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "#given\n", + "#a\n", + "C_S1=20/3#speed in characters per second\n", + "P_C1=1/C_S1#periods per character\n", + "print \"(a)\\nperiods per character is:%0.2f msec\\n\"%(P_C1*1e3)\n", + "E_C1=7.5#elements per character\n", + "P_E1=P_C1/E_C1#period per element\n", + "print \"period per element is:%0.2f msec\\n\"%(P_E1*1e3)\n", + "Sb1=1/P_E1#speed in bauds\n", + "print \"speed is:%0.2f bauds\\n\\n\"%(Sb1)\n", + "#b\n", + "C_S2=10#speed in characters per second\n", + "P_C2=1/C_S2#periods per character\n", + "print \"(b)\\nperiods per character is:%0.2f msec\\n\"%(P_C2*1e3)\n", + "E_C2=7.5#elements per character\n", + "P_E2=P_C2/E_C2#period per element\n", + "print \"period per element is:%0.2f msec\\n\"%(P_E2*1e3)\n", + "Sb2=1/P_E2#speed in bauds\n", + "print \"speed is %0.2f bauds\\n\\n\"%( Sb2)\n", + "#c\n", + "C_S3=10#speed in characters per second\n", + "P_C3=1/C_S3#periods per character\n", + "print \"(c)\\nperiods per character is:%0.2f msec\\n\"%(P_C3*1e3)\n", + "E_C3=10#elements per character\n", + "P_E3=P_C3/E_C3#period per element\n", + "print \"period per element is:%0.2f msec\\n\"%(P_E3*1e3)\n", + "Sb3=1/P_E3#speed in bauds\n", + "print \"speed is %0.2f bauds\\n\"%(Sb3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.5,page no 127" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "total inductance is 0.05 H \n", + "\n", + "maximum current is 10.00 mA \n", + "\n", + "operating current is 5.00 mA \n", + "\n", + "operate lag is 0.35 msec \n", + "\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "#given\n", + "N=1000#no of turns\n", + "L1=5e-8#inductance per turn\n", + "L=N**2*L1#total inductance\n", + "print \"total inductance is %0.2f H \\n\"%(L)\n", + "R=100#resistance of winding in ohm\n", + "MMF=5#operating MMF in amp. turn\n", + "V=1#voltage of received signal in volts\n", + "Im=V/R#maximum current\n", + "print \"maximum current is %0.2f mA \\n\"%(Im*1e3)\n", + "Io=MMF/N#operating current\n", + "print \"operating current is %0.2f mA \\n\"%(Io*1e3)\n", + "to=(L/R)*log(1/(1-(Io/Im)))#operate lag\n", + "print \"operate lag is %0.2f msec \\n\"%(to*1e3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.6,page no 128" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Busy hour calling rate is:1.60 \n", + "\n", + "Rate of traffic flow is 693.33 traffic unit \n" + ] + } + ], + "source": [ + "#given\n", + "S=10000#no of subscribers\n", + "C=16000#Tatol no of call in busy hour\n", + "CR=C/S#busy hour calling rate\n", + "print \"Busy hour calling rate is:%0.2f \\n\"%(CR)\n", + "T=2.6#avarage duration of calls in min\n", + "\n", + "A=C*(T/60)#rate of traffic flow\n", + "print \"Rate of traffic flow is %0.2f traffic unit \"%(A)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.7,page no 135" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "duration of each element is:10.00 msec\n", + "\n", + "speed is 100.00 bauds\n", + "\n", + "total possible combinations are:128.00\n" + ] + } + ], + "source": [ + "#given\n", + "N=7#no of character elements\n", + "E_C=10#elements per character (1+7+1+1)\n", + "To=100e-3#duration of one character\n", + "Te=To/E_C#duration of each element\n", + "print \"duration of each element is:%0.2f msec\\n\"%(Te*1e3)\n", + "Sb=1/Te#speed in bauds\n", + "print \"speed is %0.2f bauds\\n\"%(Sb)\n", + "C=2**N#total possible combinations\n", + "print \"total possible combinations are:%0.2f\"%(C)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.8,page no 129" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total no of call in busy hour is:1500.00 calls per Hour\n", + "\n", + "Busy hour calling rate is:1.50 \n", + "\n", + "grade of service is: 0.02\n" + ] + } + ], + "source": [ + "#given\n", + "S=1000#no of subscribers\n", + "T=2.4/60#avarage duration of calls in hours\n", + "A=60#rate of traffic flow\n", + "C=A/T#Tatol no of call in busy hour\n", + "print \"Total no of call in busy hour is:%0.2f calls per Hour\\n\"%(C)\n", + "CR=C/S#busy hour calling rate\n", + "print \"Busy hour calling rate is:%0.2f \\n\"%(CR)\n", + "SCL=30#no of call lost per hour\n", + "\n", + "B=SCL/(C+SCL)#grade of service\n", + "print \"grade of service is: %0.2f\"%(B)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 2.9,page no 129" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "grade of service is: 2.00e-03\n", + "\n", + "traffic lost is: 1.80e-03\n" + ] + } + ], + "source": [ + "from math import factorial\n", + "#given\n", + "N=5#no of switches\n", + "A=0.9#traffic offered \n", + "#grade of service B=(A**N/N!)/(1+A+A**2/2!+A**3/3!+...+A**N/N!)\n", + "#here\n", + "B=(A**N/factorial(N))/(1+A+(A**2/factorial(2))+(A**3/factorial(3))+(A**4/factorial(4))+(A**5/factorial(5)))\n", + "print \"grade of service is: %0.2e\\n\"%(B)\n", + "Tl=A*B#traffic lost\n", + "print \"traffic lost is: %0.2e\"%(Tl)" + ] + } + ], + "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.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/Mohd. Arif/Chapter4.ipynb b/sample_notebooks/Mohd. Arif/Chapter4.ipynb new file mode 100644 index 00000000..ac35f0f7 --- /dev/null +++ b/sample_notebooks/Mohd. Arif/Chapter4.ipynb @@ -0,0 +1,513 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 : Truncation Errors and the Taylor Series" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example: 4.1 Page No:79" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of f at x=0 : 1.2\n", + "The value of f at x=1 due to zero order approximation : 1.2\n", + "Truncation error : -1.0\n", + "----------------------------------------------\n", + "The value of first derivative of f at x=0 : -0.4\n", + "The value of f at x=1 due to first order approximation : 0.8\n", + "Truncation error : -0.6\n", + "----------------------------------------------\n", + "The value of second derivative of f at x=0 : -1.8\n", + "The value of f at x=1 due to second order approximation : -0.1\n", + "Truncation error : 0.3\n", + "----------------------------------------------\n", + "The value of third derivative of f at x=0 : -0.9\n", + "The value of f at x=1 due to third order approximation : -0.25\n", + "Truncation error : 0.45\n", + "----------------------------------------------\n", + "The value of fourth derivative of f at x=0 : -2.4\n", + "The value of f at x=1 due to fourth order approximation : -0.35\n", + "Truncation error : 0.55\n", + "----------------------------------------------\n" + ] + } + ], + "source": [ + "from math import factorial\n", + "from scipy.misc import derivative\n", + "def f(x):\n", + " y=-0.1*x**4-0.15*x**3-0.5*x**2-0.25*x+1.2#\n", + " return y\n", + "xi=0#\n", + "xf=1#\n", + "h=xf-xi#\n", + "fi=f(xi)##function value at xi\n", + "ffa=f(xf)##actual function value at xf\n", + "\n", + "#for n=0, i.e, zero order approximation\n", + "ff=fi#\n", + "Et_1=ffa-ff##truncation error at x=1\n", + "print \"The value of f at x=0 :\",fi\n", + "print \"The value of f at x=1 due to zero order approximation :\",ff\n", + "print \"Truncation error :\",Et_1\n", + "print \"----------------------------------------------\"\n", + "\n", + "#for n=1, i.e, first order approximation\n", + "def f1(x):\n", + " y=derivative(f,x)\n", + " return y\n", + "f1i=f1(xi)##value of first derivative of function at xi\n", + "f1f=fi+f1i*h##value of first derivative of function at xf\n", + "Et_2=ffa-f1f##truncation error at x=1\n", + "print \"The value of first derivative of f at x=0 :\",f1i\n", + "print \"The value of f at x=1 due to first order approximation :\",f1f\n", + "print \"Truncation error :\",Et_2\n", + "print \"----------------------------------------------\"\n", + "\n", + "\n", + "#for n=2, i.e, second order approximation\n", + "def f2(x):\n", + " y=derivative(f1,x)\n", + " return y\n", + "f2i=f2(xi)##value of second derivative of function at xi\n", + "f2f=f1f+f2i*(h**2)/factorial(2)##value of second derivative of function at xf\n", + "Et_3=ffa-f2f##truncation error at x=1\n", + "print \"The value of second derivative of f at x=0 :\",f2i\n", + "print \"The value of f at x=1 due to second order approximation :\",f2f\n", + "print \"Truncation error :\",Et_3\n", + "print \"----------------------------------------------\"\n", + "\n", + "#for n=3, i.e, third order approximation\n", + "def f3(x):\n", + " y=derivative(f2,x)\n", + " return y\n", + "f3i=f3(xi)##value of third derivative of function at xi\n", + "f3f=f2f+f3i*(h**3)/factorial(3)##value of third derivative of function at xf\n", + "Et_4=ffa-f3f##truncation error at x=1\n", + "print \"The value of third derivative of f at x=0 :\",f3i\n", + "print \"The value of f at x=1 due to third order approximation :\",f3f\n", + "print \"Truncation error :\", Et_4\n", + "print \"----------------------------------------------\"\n", + "\n", + "#for n=4, i.e, fourth order approximation\n", + "def f4(x):\n", + " y=derivative(f3,x)\n", + " return y\n", + "f4i=f4(xi)##value of fourth derivative of function at xi\n", + "f4f=f3f+f4i*(h**4)/factorial(4)##value of fourth derivative of function at xf\n", + "Et_5=ffa-f4f##truncation error at x=1\n", + "print \"The value of fourth derivative of f at x=0 :\",f4i\n", + "print \"The value of f at x=1 due to fourth order approximation :\",f4f\n", + "print \"Truncation error :\",Et_5\n", + "print \"----------------------------------------------\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.2: Page No:82" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of f at x=1 due to zero order approximation : 0.707106781187\n", + "% relative error : -41.4213562373\n", + "----------------------------------------------\n", + "The value of f at x=1 due to first order approximation : 0.551333569463\n", + "% relative error : -10.2667138927\n", + "----------------------------------------------\n", + "The value of f at x=1 due to second order approximation : 0.534175415889\n", + "% relative error : -6.83508317772\n", + "----------------------------------------------\n", + "The value of f at x=1 due to third order approximation : 0.535435376789\n", + "% relative error : -7.08707535775\n", + "----------------------------------------------\n", + "The value of f at x=1 due to fourth order approximation : 0.535504768061\n", + "% relative error : -7.10095361216\n", + "----------------------------------------------\n", + "The value of f at x=1 due to fifth order approximation : 0.535501917392\n", + "% relative error : -7.10038347839\n", + "----------------------------------------------\n", + "The value of f at x=1 due to sixth order approximation : 0.535501819651\n", + "% relative error : -7.10036393016\n", + "----------------------------------------------\n" + ] + } + ], + "source": [ + "from math import pi,cos,factorial\n", + "from scipy.misc import derivative\n", + "def f(x):\n", + " y=cos(x)\n", + " return y\n", + "xi=pi/4#\n", + "xf=pi/3#\n", + "h=xf-xi#\n", + "fi=f(xi)##function value at xi\n", + "ffa=f(xf)##actual function value at xf\n", + "\n", + "#for n=0, i.e, zero order approximation\n", + "ff=fi#\n", + "et1=(ffa-ff)*100/ffa##percent relative error at x=1\n", + "print \"The value of f at x=1 due to zero order approximation :\",ff\n", + "print \"% relative error :\",et1\n", + "print \"----------------------------------------------\"\n", + "\n", + "#for n=1, i.e, first order approximation\n", + "def f1(x):\n", + " y=derivative(f,x)\n", + " return y\n", + "f1i=f1(xi)##value of first derivative of function at xi\n", + "f1f=fi+f1i*h##value of first derivative of function at xf\n", + "et2=(ffa-f1f)*100/ffa##% relative error at x=1\n", + "print \"The value of f at x=1 due to first order approximation :\",f1f\n", + "print \"% relative error :\",et2\n", + "print \"----------------------------------------------\"\n", + "\n", + "\n", + "#for n=2, i.e, second order approximation\n", + "def f2(x):\n", + " y=derivative(f1,x)\n", + " return y\n", + "f2i=f2(xi)##value of second derivative of function at xi\n", + "f2f=f1f+f2i*(h**2)/factorial(2)##value of second derivative of function at xf\n", + "et3=(ffa-f2f)*100/ffa##% relative error at x=1\n", + "print \"The value of f at x=1 due to second order approximation :\",f2f\n", + "print \"% relative error :\",et3\n", + "print \"----------------------------------------------\"\n", + "\n", + "\n", + "#for n=3, i.e, third order approximation\n", + "def f3(x):\n", + " y=derivative(f2,x)\n", + " return y\n", + "f3i=f3(xi)##value of third derivative of function at xi\n", + "f3f=f2f+f3i*(h**3)/factorial(3)##value of third derivative of function at xf\n", + "et4=(ffa-f3f)*100/ffa##% relative error at x=1\n", + "print \"The value of f at x=1 due to third order approximation :\",f3f\n", + "print \"% relative error :\",et4\n", + "print \"----------------------------------------------\"\n", + "\n", + "\n", + "#for n=4, i.e, fourth order approximation\n", + "def f4(x):\n", + " y=derivative(f3,x)\n", + " return y\n", + "f4i=f4(xi)##value of fourth derivative of function at xi\n", + "f4f=f3f+f4i*(h**4)/factorial(4)##value of fourth derivative of function at xf\n", + "et5=(ffa-f4f)*100/ffa##% relative error at x=1\n", + "print \"The value of f at x=1 due to fourth order approximation :\",f4f\n", + "print \"% relative error :\",et5\n", + "print \"----------------------------------------------\"\n", + "\n", + "\n", + "#for n=5, i.e, fifth order approximation\n", + "f5i=(f4(1.1*xi)-f4(0.9*xi))/(2*0.1)##value of fifth derivative of function at xi (central difference method)\n", + "f5f=f4f+f5i*(h**5)/factorial(5)##value of fifth derivative of function at xf\n", + "et6=(ffa-f5f)*100/ffa##% relative error at x=1\n", + "print \"The value of f at x=1 due to fifth order approximation :\",f5f\n", + "print \"% relative error :\",et6\n", + "print \"----------------------------------------------\"\n", + "\n", + "\n", + "#for n=6, i.e, sixth order approximation\n", + "def f6(x):\n", + " y=derivative(f5,x)\n", + " return y\n", + "f6i=(f4(1.1*xi)-2*f4(xi)+f4(0.9*xi))/(0.1**2)##value of sixth derivative of function at xi (central difference method)\n", + "f6f=f5f+f6i*(h**6)/factorial(6)##value of sixth derivative of function at xf\n", + "et6=(ffa-f6f)*100/ffa##% relative error at x=1\n", + "print \"The value of f at x=1 due to sixth order approximation :\",f6f\n", + "print \"% relative error :\", et6\n", + "print \"----------------------------------------------\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.3 : Page No:85" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Input value of m:4\n", + "Input value of h:5\n", + "\n", + "Remainder: 21 \n", + "The value by first order approximation: 1275\n", + "True Value at x2: 1296\n" + ] + } + ], + "source": [ + "from math import pi,cos,factorial\n", + "m=input(\"Input value of m:\")\n", + "h=input(\"Input value of h:\")\n", + "def f(x):\n", + " y=x**m\n", + " return y\n", + "x1=1#\n", + "x2=x1+h#\n", + "fx1=f(x1)#\n", + "fx2=fx1+m*(fx1**(m-1))*h#\n", + "if m==1:\n", + " R=0#\n", + "elif m==2 :\n", + " R=2*(h**2)/factorial(2)#\n", + " \n", + "elif m==3:\n", + " R=(6*(x1)*(h**2)/factorial(2))+(6*(h**3)/factorial(3))#\n", + " \n", + "elif m==4:\n", + " R=(12*(x1**2)*(h**2)/factorial(2))+(24*(x1)*(h**3)/factorial(3))+(24*(h**4)/factorial(4))\n", + " \n", + "print \"\\nRemainder:\",fx2,\"\\nThe value by first order approximation:\",R\n", + "print \"True Value at x2:\",f(x2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4: Page No:92" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Input h:1.232323\n", + "For h= 1.232323\n", + "and percent error= -2.70944264922 Derivative at x by forward difference method= 114.60931875\n", + "and percent error= -0.178591334206 Derivative at x by backward difference method= 85.854151746\n", + "and percent error= -1.44401699172 Derivative at x by central difference method= 14.3775835022\n" + ] + } + ], + "source": [ + "from scipy.misc import derivative\n", + "def f(x):\n", + " y=-0.1*(x**4)-0.15*(x**3)-0.5*(x**2)-0.25*(x)+1.2\n", + " return y\n", + "x=0.5#\n", + "h=input(\"Input h:\")\n", + "x1=x-h#\n", + "x2=x+h#\n", + "#forward difference method\n", + "fdx1=(f(x2)-f(x))/h##derivative at x\n", + "et1=abs((fdx1-derivative(f,x))/derivative(f,x))*100#\n", + "#backward difference method\n", + "fdx2=(f(x)-f(x1))/h##derivative at x\n", + "et2=abs((fdx2-derivative(f,x))/derivative(f,x))*100#\n", + "#central difference method\n", + "fdx3=(f(x2)-f(x1))/(2*h)##derivative at x\n", + "et3=abs((fdx3-derivative(f,x))/derivative(f,x))*100#\n", + "print \"For h=\",h\n", + "print \"and percent error=\",fdx1,\"Derivative at x by forward difference method=\",et1\n", + "print \"and percent error=\",fdx2,\"Derivative at x by backward difference method=\",et2\n", + "print \"and percent error=\",fdx3,\"Derivative at x by central difference method=\",et3" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.5: Page No: 95" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true value is between : 15.4275 and 15.8225\n" + ] + } + ], + "source": [ + "from scipy.misc import derivative\n", + "def f(x):\n", + " y=x**3\n", + " return y\n", + "x=2.5#\n", + "delta=0.01#\n", + "deltafx=abs(derivative(f,x))*delta#\n", + "fx=f(x)#\n", + "print \"true value is between : \",fx-deltafx,\"and\",fx+deltafx" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.6: Page No: 96" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of y is between: 0.528721343471 and 0.596278656529\n", + "ymin is calculated at lower extremes of F, L, E, I values as = 0.524066539965\n", + "ymax is calculated at higher extremes of F, L, E, I values as = 0.602846335915\n" + ] + } + ], + "source": [ + "def f(F,L,E,I):\n", + " y=(F*(L**4))/(8*E*I)\n", + " return y\n", + "Fbar=50##lb/ft\n", + "Lbar=30##ft\n", + "Ebar=1.5*(10**8)##lb/ft**2\n", + "Ibar=0.06##ft**4\n", + "deltaF=2##lb/ft\n", + "deltaL=0.1##ft\n", + "deltaE=0.01*(10**8)##lb/ft**2\n", + "deltaI=0.0006##ft**4\n", + "ybar=(Fbar*(Lbar**4))/(8*Ebar*Ibar)#\n", + "def f1(F):\n", + " y=(F*(Lbar**4))/(8*Ebar*Ibar)\n", + " return y\n", + "def f2(L):\n", + " y=(Fbar*(L**4))/(8*Ebar*Ibar)\n", + " return y\n", + "def f3(E):\n", + " y=(Fbar*(Lbar**4))/(8*E*Ibar)\n", + " return y\n", + "def f4(I):\n", + " y=(Fbar*(Lbar**4))/(8*Ebar*I)\n", + " return y\n", + "\n", + "deltay=abs(derivative(f1,Fbar))*deltaF+abs(derivative(f2,Lbar))*deltaL+abs(derivative(f3,Ebar))*deltaE+abs(derivative(f4,Ibar))*deltaI#\n", + "\n", + "print \"The value of y is between:\",ybar-deltay,\"and\",ybar+deltay\n", + "ymin=((Fbar-deltaF)*((Lbar-deltaL)**4))/(8*(Ebar+deltaE)*(Ibar+deltaI))#\n", + "ymax=((Fbar+deltaF)*((Lbar+deltaL)**4))/(8*(Ebar-deltaE)*(Ibar-deltaI))#\n", + "print \"ymin is calculated at lower extremes of F, L, E, I values as =\",ymin\n", + "print \"ymax is calculated at higher extremes of F, L, E, I values as =\",ymax" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.7 : Page No:98" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The condition number of function for x = 0.18201112073 is : 1.72787595947\n", + "The condition number of function for x = 0.0160083243793 is : 1.58650429006\n" + ] + } + ], + "source": [ + "from math import pi,tan\n", + "from scipy.misc import derivative\n", + "def f(x):\n", + " y=tan(x)\n", + " return y\n", + "x1bar=(pi/2)+0.1*(pi/2)#\n", + "x2bar=(pi/2)+0.01*(pi/2)#\n", + "#computing condition number for x1bar\n", + "condnum1=x1bar*derivative(f,x1bar)/f(x1bar)#\n", + "print \"The condition number of function for x =\",condnum1,\"is :\",x1bar\n", + "if abs(condnum1)>1:\n", + " print \"Function is ill-conditioned for x =\",x1bar\n", + "\n", + "#computing condition number for x2bar\n", + "condnum2=x2bar*derivative(f,x2bar)/f(x2bar)#\n", + "print \"The condition number of function for x =\",condnum2,\"is :\",x2bar\n", + "if abs(condnum2)>1:\n", + " print \"Function is ill-conditioned for x =\",x2bar" + ] + } + ], + "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.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/sample_notebooks/RavirajJadeja/Chapter2.ipynb b/sample_notebooks/RavirajJadeja/Chapter2.ipynb new file mode 100644 index 00000000..a3cca260 --- /dev/null +++ b/sample_notebooks/RavirajJadeja/Chapter2.ipynb @@ -0,0 +1,698 @@ + + + + + +Chapter2_1 + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+

2: Crystal Structures

+
+
+
+
+
+
+
+
+

Example number 2.1, Page number 2.23

+
+
+
+
+
+
In [3]:
+
+
+
#importing modules
+import math
+from __future__ import division
+
+#Variable declaration
+M=60.2;     #molecular weight
+Na=6.023*10**26;    #avagadro number(kg/mole)
+n=4;    
+rho=6250;           #density(kg/m**3)
+
+#Calculation
+a=(n*M/(rho*Na))**(1/3);     #lattice constant(m)
+
+#Result
+print "lattice constant is",round(a*10**10),"*10**-10 m"
+
+ +
+
+
+ +
+
+ + +
+
+
lattice constant is 4.0 *10**-10 m
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example number 2.2, Page number 2.23

+
+
+
+
+
+
In [7]:
+
+
+
#importing modules
+import math
+from __future__ import division
+
+#Variable declaration
+M=63.5;     #molecular weight
+Na=6.023*10**26;    #avagadro number(kg/mole)
+n=4;    
+r=1.278*10**-8;     #atomic radius(cm)
+
+#Calculation
+a=2*math.sqrt(2)*r;   #lattice constant(m)
+rho=n*M/(a**3*Na);    #density(kg/cm**3)
+
+#Result
+print "density is",round(rho*10**3,2),"gm/cm**3"
+print "answer in the book varies due to rounding off errors"
+
+ +
+
+
+ +
+
+ + +
+
+
density is 8.93 gm/cm**3
+answer in the book varies due to rounding off errors
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example number 2.3, Page number 2.24

+
+
+
+
+
+
In [10]:
+
+
+
#importing modules
+import math
+from __future__ import division
+
+#Variable declaration
+pf_BCC=math.pi*math.sqrt(3)/8;    #packing factor for BCC
+pf_FCC=math.pi/(3*math.sqrt(2));     #packing factor of FCC
+
+#Calculation
+r=pf_BCC/pf_FCC;     #ratio of densities
+
+#Result
+print "ratio of densities is",round(r,2)
+
+ +
+
+
+ +
+
+ + +
+
+
ratio of densities is 0.92
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example number 2.4, Page number 2.24

+
+
+
+
+
+
In [14]:
+
+
+
#importing modules
+import math
+from __future__ import division
+
+#Variable declaration
+M=55.85;     #molecular weight
+Na=6.02*10**26;    #avagadro number(kg/mole)
+n=2;    
+rho=7860;           #density(kg/m**3)
+
+#Calculation
+a=(n*M/(rho*Na))**(1/3);     #lattice constant(m)
+
+#Result
+print "lattice constant is",round(a*10**10,4),"angstrom"
+
+ +
+
+
+ +
+
+ + +
+
+
lattice constant is 2.8687 angstrom
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example number 2.5, Page number 2.24

+
+
+
+
+
+
In [19]:
+
+
+
#importing modules
+import math
+from __future__ import division
+
+#Variable declaration
+M=58.5;     #molecular weight
+Na=6.02*10**26;    #avagadro number(kg/mole)
+n=4;    
+rho=2189;           #density(kg/m**3)
+
+#Calculation
+a=(n*M/(rho*Na))**(1/3);     #lattice constant(m)
+
+#Result
+print "lattice constant is",round(a*10**10,1),"angstrom"
+
+ +
+
+
+ +
+
+ + +
+
+
lattice constant is 5.6 angstrom
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example number 2.6, Page number 2.25

+
+
+
+
+
+
In [23]:
+
+
+
#importing modules
+import math
+from __future__ import division
+
+#Variable declaration
+M=6.94;     #molecular weight
+Na=6.02*10**26;    #avagadro number(kg/mole)
+n=2;    
+rho=530;           #density(kg/m**3)
+
+#Calculation
+a=(n*M/(rho*Na))**(1/3);     #lattice constant(m)
+
+#Result
+print "lattice constant is",round(a*10**10,3),"angstrom"
+
+ +
+
+
+ +
+
+ + +
+
+
lattice constant is 3.517 angstrom
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example number 2.7, Page number 2.25

+
+
+
+
+
+
In [29]:
+
+
+
#importing modules
+import math
+from __future__ import division
+
+#Variable declaration
+r1=1.258*10**-10;     #radius(m)
+r2=1.292*10**-10;     #radius(m)
+
+#Calculation
+a_bcc=4*r1/math.sqrt(3);
+v=a_bcc**3;
+V1=v/2;
+a_fcc=2*math.sqrt(2)*r2;
+V2=a_fcc**3/4;
+V=(V1-V2)*100/V1;           #percent volume change is",V,"%"
+
+#Result
+print "percent volume change is",round(V,3),"%"
+print "answer in the book varies due to rounding off errors"
+
+ +
+
+
+ +
+
+ + +
+
+
percent volume change is 0.493 %
+answer in the book varies due to rounding off errors
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example number 2.8, Page number 2.26

+
+
+
+
+
+
In [31]:
+
+
+
#importing modules
+import math
+from __future__ import division
+
+#Variable declaration
+a=0.356*10**-9;       #cube edge(m)
+w=12;    #atomic weight
+Na=6.02*10**26;    #avagadro number(kg/mole)
+
+#Calculation
+n=8/(a**3);     #number of atoms/m**3
+m=w/Na;      #mass(kg)
+rho=m*n;     #density of diamond(kg/m**3)
+
+#Result
+print "number of atoms/m**3 is",round(n/10**29,2),"*10**29"
+print "density of diamond is",round(rho,2),"kg/m**3"
+print "answer in the book is wrong"
+
+ +
+
+
+ +
+
+ + +
+
+
number of atoms/m**3 is 1.77 *10**29
+density of diamond is 3534.47 kg/m**3
+answer in the book is wrong
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example number 2.9, Page number 2.26

+
+
+
+
+
+
In [1]:
+
+
+
#importing modules
+import math
+from __future__ import division
+from sympy import Symbol
+
+#Variable declaration
+r=Symbol('r')
+
+#Calculation
+a=4*r/math.sqrt(2);
+R=(4*r/(2*math.sqrt(2)))-r;       #maximum radius of sphere
+
+#Result
+print "maximum radius of sphere is",round(R/r,3),"r"
+
+ +
+
+
+ +
+
+ + +
+
+
maximum radius of sphere is 0.414 r
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example number 2.10, Page number 2.26

+
+
+
+
+
+
In [2]:
+
+
+
#importing modules
+import math
+from __future__ import division
+from sympy import Symbol
+
+#Variable declaration
+r=Symbol('r')
+
+#Calculation
+a=4*r/math.sqrt(3);
+R=(a/2)-r;           #radius of largest sphere
+
+#Result
+print "radius of largest sphere is",round(R/r,3),"r"
+
+ +
+
+
+ +
+
+ + +
+
+
radius of largest sphere is 0.155 r
+
+
+
+ +
+
+ +
+
+
+ + diff --git a/sample_notebooks/Vaibhav Vajani/chapter1_2.ipynb b/sample_notebooks/Vaibhav Vajani/chapter1_2.ipynb new file mode 100644 index 00000000..46f134dd --- /dev/null +++ b/sample_notebooks/Vaibhav Vajani/chapter1_2.ipynb @@ -0,0 +1,582 @@ + + + + + +chapter1_2 + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+

Chapter 01: The Foundations: Logic and Proofs

+
+
+
+
+
+
+
+
+

Example 01:Page 02

+
+
+
+
+
+
In [1]:
+
+
+
print "The following sentences are Propositions" #Proposition should be a declarative sentence or should result in either a YES or a NO.
+
+print "1.  Washington D.C is the capital of the United States of America\n2.  Toronto is the capital of Canada\n3.  1+1=2.\n4.  2+2=3." #Since these statements are declarative and they answer the question YES or NO they are called propositions.
+
+ +
+
+
+ +
+
+ + +
+
+
The following sentences are Propositions
+1.  Washington D.C is the capital of the United States of America
+2.  Toronto is the capital of Canada
+3.  1+1=2.
+4.  2+2=3.
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example 02:Page 02

+
+
+
+
+
+
In [2]:
+
+
+
print "1.  What time is it? \n2.  Read this carefully. \n3.  x+1=2.\n4.  x+y=Z."
+print"Sentences 1 and 2 are not propositions since they are not declarative.  Sentences 3 and 4 are neither true nor false and so they are not propositions."
+
+ +
+
+
+ +
+
+ + +
+
+
1.  What time is it? 
+2.  Read this carefully. 
+3.  x+1=2.
+4.  x+y=Z.
+Sentences 1 and 2 are not propositions since they are not declarative.  Sentences 3 and 4 are neither true nor false and so they are not propositions.
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example 03:Page 03

+
+
+
+
+
+
In [9]:
+
+
+
print "Propositon p=Michael's PC runs Linux."
+print "\n Negation of p is ~p : It is not the case that Michael's PC runs Linux."
+print "\n Negation of p is ~p : Michae's PC does not run."#Negation is opposite of the truth value of the proposition expressed with "it is not the case that" or with "not".
+
+ +
+
+
+ +
+
+ + +
+
+
Propositon p=Michael's PC runs Linux.
+
+ Negation of p is ~p : It is not the case that Michael's PC runs Linux.
+
+ Negation of p is ~p : Michae's PC does not run.
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example 04:Page 03

+
+
+
+
+
+
In [10]:
+
+
+
print "Let p=Vandana's smartphone has at least 32GB of memory."
+print "The negation of p is ( ~p ) :It is not the case that Vandana's smartphone has at least 32GB of memory."
+print "Or in simple English ( ~p ): Vandana's smartphone does not have at least 32GB of memory."
+print "Or even more simple as ( ~p ): Vandana's smartphone has less than 32GB of memory."
+
+ +
+
+
+ +
+
+ + +
+
+
Let p=Vandana's smartphone has at least 32GB of memory.
+The negation of p is ( ~p ) :It is not the case that Vandana's smartphone has at least 32GB of memory.
+Or in simple English ( ~p ): Vandana's smartphone does not have at least 32GB of memory.
+Or even more simple as ( ~p ): Vandana's smartphone has less than 32GB of memory.
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example 05:Page 04

+
+
+
+
+
+
In [11]:
+
+
+
p="Rebecca's PC has more than 16GB free hard disk space"
+q="The processor in Rebecca's PC runs faster than 1GHz"
+print "Let p,q be two propositions"
+print "Let p=",p,"\n","Let q=",q
+print "Conjunction of p^q is : "+p+" and "+q #conjunction combines two propositons with "and"
+
+ +
+
+
+ +
+
+ + +
+
+
Let p,q be two propositions
+Let p= Rebecca's PC has more than 16GB free hard disk space 
+Let q= The processor in Rebecca's PC runs faster than 1GHz
+Conjunction of p^q is : Rebecca's PC has more than 16GB free hard disk space and The processor in Rebecca's PC runs faster than 1GHz
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example 06:Page 05

+
+
+
+
+
+
In [12]:
+
+
+
p="Rebecca's PC has more than 16GB free hard disk space"
+q="The processor in Rebecca's PC runs faster than 1GHz"
+print "Let p,q be two propositions"
+print "Let p=",p,"\n","Let q=",q
+print "Disjunction of p\/q is : "+p+" or "+q #unavailability of cup symbol.  So \/
+#Disjunction combines two propositons using OR 
+
+ +
+
+
+ +
+
+ + +
+
+
Let p,q be two propositions
+Let p= Rebecca's PC has more than 16GB free hard disk space 
+Let q= The processor in Rebecca's PC runs faster than 1GHz
+Disjunction of p\/q is : Rebecca's PC has more than 16GB free hard disk space or The processor in Rebecca's PC runs faster than 1GHz
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example 07:Page 07

+
+
+
+
+
+
In [14]:
+
+
+
p="Maria learns discrete mathematics"
+q="Maria will find a good job"
+print"Let p=",p,"\n","Let q=",q
+print"p->q is : "+"If "+p+" then "+q #p->q p implies q means If P then Q.
+print"p->q is also expressed as :",q," when ",p
+
+ +
+
+
+ +
+
+ + +
+
+
Let p= Maria learns discrete mathematics 
+Let q= Maria will find a good job
+p->q is : If Maria learns discrete mathematics then Maria will find a good job
+p->q is also expressed as : Maria will find a good job  when  Maria learns discrete mathematics
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example 01:Page 37

+
+
+
+
+
+
In [15]:
+
+
+
def p(x): #Function defined to check whether the given statements are true.
+    if(x>3):
+        print "p(",x,") which is the statement",x,">3, is true"
+    else:
+        print "p(",x,") which is the statement",x,">3, is false"
+p(4)#Fuction call 
+p(2)
+
+ +
+
+
+ +
+
+ + +
+
+
p( 4 ) which is the statement 4 >3, is true
+p( 2 ) which is the statement 2 >3, is false
+
+
+
+ +
+
+ +
+
+
+
+
+
+

Example 02:Page 38

+
+
+
+
+
+
In [17]:
+
+
+
x1="CS1" #Defining systems to check whether they are under attack through a function.
+x2="CS2"
+x3="MATH1"
+def A(x):
+    if(x=="CS1"):                #Since cs1 and Math1 are the two computers under attack
+        print "A(",x,") is true."
+    else:
+        if(x=="MATH1"):         #Since CS1 and MATH1 are the two computers under attack
+            print "A(",x,") is true."
+        else:
+           print"A(",x,") is false."
+print "Systems under attack are CS1 and MATH1.  The truth values for the same are calculated using functions."
+A(x1)#Function call 
+A(x2)
+A(x3)
+
+ +
+
+
+ +
+
+ + +
+
+
Systems under attack are CS1 and MATH1.  The truth values for the same are calculated using functions.
+A( CS1 ) is true.
+A( CS2 ) is false.
+A( MATH1 ) is true.
+
+
+
+ +
+
+ +
+
+
+ + diff --git a/sample_notebooks/pratikgandhi/Chapter1.ipynb b/sample_notebooks/pratikgandhi/Chapter1.ipynb new file mode 100644 index 00000000..8d47558e --- /dev/null +++ b/sample_notebooks/pratikgandhi/Chapter1.ipynb @@ -0,0 +1,2189 @@ + + + + + +Chapter1_1 + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+
+
+

Ch-1 : Introduction

+
+
+
+
+
+
+
+
+

exa 1.1 page 1

+
+
+
+
+
+
In [25]:
+
+
+
from __future__ import division
+import numpy as np
+B=100 #W(8Bulb)
+F=60 #W(2Fan)
+L=100 #W(2Light)
+LoadConnected=8*B+2*F+2*L #W
+print "(a) Connected Load = %0.2f W "%LoadConnected
+#12 midnight to 5am
+demand1=1*F #W
+#5am to 7am
+demand2=2*F+1*L #W
+#7am to 9am
+demand3=0 #W
+#9am to 6pm
+demand4=2*F #W
+#6pm to midnight
+demand5=2*F+4*B #W
+DEMAND=np.array([demand1,demand2, demand3, demand4, demand5])
+max_demand=max(DEMAND) 
+print "(b) Maximum demand = %0.2f W "%max_demand 
+df=max_demand/LoadConnected #demand factor
+print "(c) Demand factor = %0.3f"%df 
+E=demand1*5+demand2*2+demand3*2+demand4*9+demand5*6 #Wh
+E=E/1000 #kWh
+print "(d) Energy consumed during 24 hours = %0.2f kWh "%E
+Edash=LoadConnected*24/1000 #kWh
+print "(e) Energy consumed during 24 hours if all devices are used = %0.2f kWh"%Edash
+
+ +
+
+
+ +
+
+ + +
+
+
(a) Connected Load = 1120.00 W 
+(b) Maximum demand = 520.00 W 
+(c) Demand factor = 0.464
+(d) Energy consumed during 24 hours = 4.94 kWh 
+(e) Energy consumed during 24 hours if all devices are used = 26.88 kWh
+
+
+
+ +
+
+ +
+
+
+
+
+
+

exa 1.2 page 3

+
+
+
+
+
+
In [26]:
+
+
+
import numpy as np
+LoadA=2.5*1000 #W
+#12 midnight to 5am
+d1A=100 #W
+#5am to 6am
+d2A=1.1*1000 #W
+#6am to 8am
+d3A=200 #W
+#8am to 5pm
+d4A=0 #W
+#5pm to 12 midnight
+d5A=500 #W
+LoadB=3*1000 #W
+#11 pm to 7am
+d1B=0 #W
+#7 am to 8 am
+d2B=300 #W
+#8 am to 10 am
+d3B=1*1000 #W
+#10 am to 6 pm
+d4B=200 #W
+#6 pm to 11 pm
+d5B=600 #W
+DEMAND_A=np.array([d1A, d2A, d3A, d4A, d5A]) #W
+DEMAND_B=np.array([d1B, d2B, d3B, d4B, d5B]) #W
+max_demand_A=max(DEMAND_A) #W
+max_demand_B=max(DEMAND_B) #W
+df_A=max_demand_A/LoadA #demand factor
+df_B=max_demand_B/LoadB #demand factor
+print "Demand factor of consumer A & B are : %0.2f & %0.2f"%(df_A,df_B) 
+gd_factor=(max_demand_A+max_demand_B)/max_demand_A 
+print "Group diversity factor = %0.3f"%gd_factor
+E_A=d1A*5+d2A*1+d3A*2+d4A*9+d5A*7 #Wh
+E_B=d1B*8+d2B*1+d3B*2+d4B*8+d5B*5 #Wh
+E_A=E_A/1000 #kWh
+E_B=E_B/1000 #kWh
+print "Energy consumed by A & B during 24 hours = %0.2f & %0.2f kWh "%(E_A,E_B)
+Emax_A=max_demand_A*24/1000 #kWh
+Emax_B=max_demand_B*24/1000 #kWh
+print "Maximum energy consumer A & B can consume during 24 hours = %0.2f & %0.2f kWh "%(Emax_A,Emax_B)
+ratio_A=E_A/Emax_A 
+ratio_B=E_B/Emax_B 
+print "Ratio of actual energy to maximum energy of consumer A & B : %0.4f & %0.4f"%(ratio_A,ratio_B) 
+
+ +
+
+
+ +
+
+ + +
+
+
Demand factor of consumer A & B are : 0.44 & 0.33
+Group diversity factor = 1.909
+Energy consumed by A & B during 24 hours = 5.50 & 6.90 kWh 
+Maximum energy consumer A & B can consume during 24 hours = 26.40 & 24.00 kWh 
+Ratio of actual energy to maximum energy of consumer A & B : 0.2083 & 0.2875
+
+
+
+ +
+
+ +
+
+
+
+
+
+

exa 1.3 page 6

+
+
+
+
+
+
In [27]:
+
+
+
n1=600 #No. of apartments
+L1=5 #kW#Each Apartment Load
+n2=20 #No. of general purpose shops
+L2=2 #kW#Each Shop Load
+df=0.8 #demand factor
+#1 Floor mill
+L3=10 #kW#Load
+df3=0.7 #demand factor
+#1 Saw mill
+L4=5 #kW#Load
+df4=0.8 #demand factor
+#1 Laundry
+L5=20 #kW#Load
+df5=0.65 #demand factor
+#1 Cinema
+L6=80 #kW#Load
+df6=0.5 #demand factor
+#Street lights
+n7=200 #no. of tube lights
+L7=40 #W#Load of each light
+#Residential Load
+df8=0.5 #demand factor
+gdf_r=3 #group diversity factor
+pdf_r=1.25 #peak diversity factor
+#Commertial Load
+gdf_c=2 #group diversity factor
+pdf_c=1.6 #peak diversity factor
+#Solution :
+#Maximum demand of each apartment
+dmax_1a=L1*df8 #kW
+#Maximum demand of 600 apartment
+dmax_a=n1*dmax_1a/gdf_r #kW
+#demand of apartments at system peak time
+d_a_sp=dmax_a/pdf_r #kW
+#Maximum Commercial demand
+dmax_c=(n2*L2*df+L3*df3+L4*df4+L5*df5+L6*df6)/gdf_c #kW
+#Commercial demand at system peak time
+d_c_sp=dmax_c/pdf_c #kW
+#demand of street light at system peak time
+d_sl_sp=n7*L7/1000 #kW
+#Increase in system peak demand
+DI=d_a_sp+d_c_sp+d_sl_sp #kW
+print "Increase in system peak demand  %0.2f kW" %DI,
+
+ +
+
+
+ +
+
+ + +
+
+
Increase in system peak demand  438.00 kW
+
+
+
+ +
+
+ +
+
+
+
+
+
+

exa 1.4 page 12

+
+
+
+
+
+
In [28]:
+
+
+
#12 to 5 am
+L1=20 #MW
+t1=5 #hours
+#5 to 9 am
+L2=40 #MW
+t2=4 #hours
+#9 to 6 pm
+L3=80 #MW
+t3=9 #hours
+#6 to 10 pm
+L4=100 #MW
+t4=4 #hours
+#10 to 12 am
+L5=20 #MW
+t5=2 #hours
+#Energy Poduced in 24 hours
+E=L1*t1+L2*t2+L3*t3+L4*t4+L5*t5 #MWh
+print "Energy Supplied by the plant in 24 hours = %0.2f MWh" %E
+LF=E/24 #%#Load Factor
+print "Load Factor = %0.2f %% "%LF 
+
+ +
+
+
+ +
+
+ + +
+
+
Energy Supplied by the plant in 24 hours = 1420.00 MWh
+Load Factor = 59.17 % 
+
+
+
+ +
+
+ +
+
+
+
+
+
+

exa 1.5 page 13

+
+
+
+
+
+
In [29]:
+
+
+
from __future__ import division
+C=125 #MW#Installed Capacity
+#12 to 5 am
+L1=20 #MW
+t1=5 #hours
+#5 to 9 am
+L2=40 #MW
+t2=4 #hours
+#9 to 6 pm
+L3=80 #MW
+t3=9 #hours
+#6 to 10 pm
+L4=100 #MW
+t4=4 #hours
+#10 to 12 am
+L5=20 #MW
+t5=2 #hours
+#Energy Poduced in 24 hours
+E=L1*t1+L2*t2+L3*t3+L4*t4+L5*t5 #MWh
+LF=E/24 #%#Load Factor
+CF=LF/C #%#Capacity Factor
+print "Capacity Factor = %0.3f" %CF
+UF=100/C #%#Utilisation Factor
+print "Utilisation Factor = %.1f" %UF
+
+ +
+
+
+ +
+
+ + +
+
+
Capacity Factor = 0.473
+Utilisation Factor = 0.8
+
+
+
+ +
+
+ +
+
+
+
+
+
+

exa 1.6 page 13

+
+
+
+
+
+
In [30]:
+
+
+
%matplotlib inline
+from matplotlib.pyplot import plot, show, title, xlabel, ylabel, subplot
+from numpy import array
+import numpy as np
+#12 to 5 am & 10 to 12 am
+L1=20 #MW
+E1=L1*24 #MWh
+#5 to 9 am
+L2=40 #MW
+E2=E1+(L2-L1)*17 #MWh
+#9 to 6 pm
+L3=80 #MW
+E3=E2+(L3-L2)*13 #MWh
+#6 to 10 pm
+L4=100 #MW
+E4=E3+(L4-L3)*4 #MWh
+#Plotting Energy load curve
+L=np.array([0,L1,L2,L3,L4]) #MW
+E=np.array([0,E1,E2,E3,E4]) #Mwh
+subplot(2,1,1)
+plot(E,L)
+xlabel('Energy(MWh)') 
+ylabel('Load(MW)') 
+title('Energy Load Curve') 
+#Energy Supplied
+#Upto 5am
+t1=5 #hours
+E1=L1*t1 #MWh
+#Upto 9am
+t2=4 #hours
+E2=E1+L2*t2 #MWh
+#Upto 6pm
+t3=9 #hours
+E3=E2+L3*t3 #MWh
+#Upto 10pm
+t4=4 #hours
+E4=E3+L4*t4 #MWh
+#Upto 12pm
+t4=2 #hours
+E4=E3+L4*t4 #MWh
+#Plotting Mass curve
+T=[0,1,2,3,4] #MW
+E=[0,E1,E2,E3,E4] #Mwh
+subplot(2,1,2)
+plot(T,E)
+ylabel('Ener2y(MWh)') 
+xlabel('0-1: 12-5am 1-2: 5-9am 2-3: 9-6pm 3-4: 6-10pm above4: 10-12pm') 
+title('Mass Curve') 
+show()
+
+ +
+
+
+ +
+
+ + +
+ + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+
+

exa 1.7 page 14

+
+
+
+
+
+
In [31]:
+
+
+
dmax=40 #MW#Maximum demand
+CF=0.5 #Capacity Factor
+UF=0.8 #Utilisation Factor
+LF=CF/UF #/Load Factor
+print "(a) Load Factor : %0.3f"%LF 
+C=dmax/UF #MW#Plant Capacity
+print "(b) Plant Capacity = %0.2f MW "%C 
+RC=C-dmax #MW#Reserve Capacity
+print "(c) Reserve Capacity = %0.02f MW  "%RC 
+p=dmax*LF*24*365 #MWh#Annual Energy Production
+print "(d) Annual Energy Production = %0.2f MWh "%p 
+
+ +
+
+
+ +
+
+ + +
+
+
(a) Load Factor : 0.625
+(b) Plant Capacity = 50.00 MW 
+(c) Reserve Capacity = 10.00 MW  
+(d) Annual Energy Production = 219000.00 MWh 
+
+
+
+ +
+
+ +
+
+
+
+
+
+

exa 1.8 page 14

+
+
+
+
+
+
In [32]:
+
+
+
from __future__ import division
+%matplotlib inline
+from matplotlib.pyplot import plot, show, title, xlabel, ylabel, subplot
+#from numpy import array
+L1=50 #MW#Initial
+t1=5 #hours
+L2=50 #MW#5am
+t2=4 #hours
+L3=100 #MW#9am
+t3=9 #hours
+L4=100 #MW#6pm
+t4=2 #hours
+L5=150 #MW#8pm
+t5=2 #hours
+L6=80 #MW#10pm
+t6=2 #hours
+L7=50 #MW
+#Energy Required in 24 hours
+E=L1*t1+(L2+L3)/2*t2+(L3+L4)/2*t3+(L4+L5)/2*t4+(L5+L6)/2*t5+(L6+L1)/2*t6 #MWh
+print "Energy required in one day = %0.2f MWh "%E 
+DLF=E/L5/24*100 #%#Daily Load Factor
+print "Daily Load Factor = %0.2f %%" %DLF
+#Plotting load curve
+T=np.array([0,1,2,3,4,5,6]) #Slots
+L=np.array([L1,L2,L3,L4,L5,L6,L7]) #MW
+plot(T,L)
+ylabel('Load(MW)') 
+xlabel('0-1: 12-5am 1-2: 5-9am 2-3: 9-6pm 3-4: 6-8pm 4-5:8-10pm 5-6 :10-12pm') 
+title('Chronological Load Curve') 
+show()
+
+ +
+
+
+ +
+
+ + +
+
+
Energy required in one day = 2060.00 MWh 
+Daily Load Factor = 57.22 %
+
+
+
+ +
+ + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+
+

exa 1.9 page 15

+
+
+
+
+
+
In [33]:
+
+
+
%matplotlib inline
+from matplotlib.pyplot import plot, show, title, xlabel, ylabel, subplot
+print "load duration curve in fig1"
+print "the energy consumed upto different times is as "
+a=[0, 5 ,9 ,18, 20, 22, 24]  #time in matrix format
+b=[50, 50 ,100 ,100 ,150 ,80 ,50] #load in matrix format
+
+z = range(0,6)
+for x in range (0,6):
+   z[x]=((b[x]+b[x+1])/2)*(a[x+1]-a[x])
+
+et=0
+q = range(0,7)
+m = range(0,7)
+ett = range(0,6)
+for x in range(0,6):
+    et=et+z[x] 
+    A=a[(x)]
+    ett[x]=et 
+    q[x]=a[x+1]
+    print "\nfrom mid night upto %d,energy=%dMWh"%(A,et)
+n = sorted(range(len(b)), key=lambda k: b[k], reverse=True)
+m = sorted(b, reverse=True)
+print "energy curve in fig 2"
+t=[0, 3.88, 15.88 ,19.88, 23]
+k = range(0,6)
+for j in range(0,6):
+    k[j]=a[(j+1)]
+M =range(0,5)
+#rearranging for mass  curve
+for i in range(0,5):
+    M[i] = m[i]
+Q = range(0,6)
+for i in range(0,6):
+    Q[i] = q[i]
+    
+    
+subplot(121) 
+plot(t,M) 
+title("load duration")
+xlabel("hours")
+ylabel("MW")
+subplot(122) 
+plot(Q,ett) 
+title("energy curve")
+xlabel("time")
+ylabel("MWh")
+show()
+
+ +
+
+
+ +
+
+ + +
+
+
load duration curve in fig1
+the energy consumed upto different times is as 
+
+from mid night upto 0,energy=250MWh
+
+from mid night upto 5,energy=550MWh
+
+from mid night upto 9,energy=1450MWh
+
+from mid night upto 18,energy=1700MWh
+
+from mid night upto 20,energy=1930MWh
+
+from mid night upto 22,energy=2060MWh
+energy curve in fig 2
+
+
+
+ +
+ + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+
+

exa 1.10 page 15

+
+
+
+
+
+
In [34]:
+
+
+
from __future__ import division
+E=438*10**4 #kWh
+LF=20 #% annual
+CF=15 #%#Capacity Factor
+Lmax=E/(LF/100)/24/365 #kW
+Lmax=Lmax/1000 #MW
+C=Lmax/CF*LF #MW#Plant Capacity
+print "Plant Capacity = %0.2f MW "%C 
+RC=C-Lmax #MW#Reserve Capacity
+print "Reserve Capacity = %0.2f MW"%RC
+
+ +
+
+
+ +
+
+ + +
+
+
Plant Capacity = 3.33 MW 
+Reserve Capacity = 0.83 MW
+
+
+
+ +
+
+ +
+
+
+
+
+
+

exa 1.11 page 16

+
+
+
+
+
+
In [35]:
+
+
+
L1=10000 #kW
+L2=6000 #kW
+L3=8000 #kW
+L4=7000 #kW
+df=1.5 #diversity factor
+LF=65 #%#Load Factor
+Dinc=60 #%#Increase in maximum demand
+L=L1+L2+L3+L4 #kW#Sum 
+L=L/1000 #MW
+Dmax=L/df #MW
+print "Maximum demand on station = %0.3f MWh " %Dmax
+E=Dmax*365*24*LF/100 #MWh#Annual Energy
+print "Annual Energy Supplied = %0.0f MWh "%E 
+Din_max=Dinc/100*Dmax #MW
+C=Dmax+Din_max #MW
+print "Installed Capacity = %0.3f MW"%C
+
+ +
+
+
+ +
+
+ + +
+
+
Maximum demand on station = 20.667 MWh 
+Annual Energy Supplied = 117676 MWh 
+Installed Capacity = 33.067 MW
+
+
+
+ +
+
+ +
+
+
+
+
+
+

exa 1.12 page 16

+
+
+
+
+
+
In [36]:
+
+
+
%matplotlib inline
+from matplotlib.pyplot import plot, title, xlabel, ylabel, show
+#Arranging data for Load Duration Curve
+#week days 5-9pm load
+L1=350 #MW
+t1=4*5 #hours
+#week days 8-12am & 1-5pm load
+L2=250 #MW
+t2=t1+8*5 #hours
+#saturday & sunday 5-9pm load
+L3=200 #MW
+t3=t2+4*2 #hours
+#All days 150MW load
+L4=150 #MW
+t4=t3+6*5+15*2 #hours
+#All days 100MW load
+L5=100 #MW
+t5=t4+6*5+5*2 #hours
+A=31600 #Total Load Curve Area
+LF=A/L1/24/7*100 #%#Weekly load factor
+print "Weekly Load factor = %0.2f %%"%LF
+print "Load Duration Curve is shown in figure." 
+#Load Duration Curve
+L=[L1 ,L2, L3, L4, L5] #MW
+T=[t1 ,t2 ,t3 ,t4 ,t5] #hours
+plot(T,L) 
+title('Load Duration Curve')
+xlabel('Time(Hours)')
+ylabel('Load(MW)') 
+show()
+
+ +
+
+
+ +
+
+ + +
+
+
Weekly Load factor = 53.74 %
+Load Duration Curve is shown in figure.
+
+
+
+ +
+ + +
+ +
+ +
+ +
+
+ +
+
+
+
+
+
+

exa 1.13 page 17

+
+
+
+
+
+
In [37]:
+
+
+
LF=0.825 #Daily Load Factor
+ratio1=0.87 #daily peak load to monthly peak load
+ratio2=0.78 #monthly peak load to annually peak load
+LF_annual=LF*ratio1*ratio2 #Annual Load Factor
+print "Annual Load Factor : %0.4f" %LF_annual
+
+ +
+
+
+ +
+
+ + +
+
+
Annual Load Factor : 0.5598
+
+
+
+ +
+
+ +
+
+
+
+
+
+

exa 1.14 page 19

+
+
+
+
+
+
In [38]:
+
+
+
#Transformer1
+Lm=300 #kW
+df_m=0.6 #demand factor
+Lc=100 #kW#Commercial Load
+df_c=0.5 #demand factor
+#Transformer2
+Lr2=500 #kW#Residential Load
+df_Lr2=0.4 #demand factor
+#Transformer3
+Lr3=400 #kW
+df_Lr3=0.5 #demand factor
+#Diversity factors
+df1=2.3 
+df2=2.5 
+df3=2 
+DF=1.4 #Diversity factor between transformers
+#Solution :
+print "Part(a)" 
+Lp1=(Lm*df_m+Lc*df_c)/df1 #kW#Peak load on Transformer1
+print "Peak load on Transformer1 = %0.2f kW"%Lp1
+Lp2=Lr2*df_Lr2/df2 #kW#Peak load on Transformer2
+print "Peak load on Transformer2 = %0.2f kW"%Lp2 
+Lp3=Lr3*df_Lr3/df3 #kW#Peak load on Transformer3
+print "Peak load on Transformer3 = %0.2f kW "%Lp3 
+print "Part(b)" 
+LpF=(Lp1+Lp2+Lp3)/DF #Peak load on feeder
+print "Peak load on feeder = %0.2f kW "%LpF 
+
+ +
+
+
+ +
+
+ + +
+
+
Part(a)
+Peak load on Transformer1 = 100.00 kW
+Peak load on Transformer2 = 80.00 kW
+Peak load on Transformer3 = 100.00 kW 
+Part(b)
+Peak load on feeder = 200.00 kW 
+
+
+
+ +
+
+ +
+
+
+
+
+
+

exa 1.16 page 23

+
+
+
+
+
+
In [39]:
+
+
+
L=[20, 25, 30 ,25 ,35 ,20] #MW
+T=[6, 4, 2 ,4 ,4 ,4] #Hours
+Lmax=max(L) #MW
+print "(a) Maximum demand = %0.2f MW "%Lmax 
+E=L[0]*sum(T)+(L[1]-L[0])*T[1]+(L[2]-L[0])*T[2]+(L[3]-L[0])*T[3]+(L[4]-L[0])*T[4]+(L[5]-L[0])*T[5] #MWh
+E=E*1000 #kWh
+print "(b) Units generated per day = %0.e kWh "%E 
+Lavg=E/sum(T) #/kWh
+Lavg=Lavg/1000 #/MW
+print "(c) Average Load = %0.2f MW "%Lavg 
+LF=Lavg/Lmax*100 #%
+print "(d) Load Factor = %0.2f %%" %LF
+
+ +
+
+
+ +
+
+ + +
+
+
(a) Maximum demand = 35.00 MW 
+(b) Units generated per day = 6e+05 kWh 
+(c) Average Load = 25.00 MW 
+(d) Load Factor = 71.43 %
+
+
+
+ +
+
+ +
+
+
+
+
+
+

exa 1.17 page 24

+
+
+
+
+
+
In [40]:
+
+
+
from math import acos, sin
+pf=0.8 #power factor
+delf=1 #%#drop in frequency(delf/f)
+#delP=-2*(sind(theta))**2*delf
+theta=acos(pf) #degree
+delP_BY_delf=-2*sin(theta)**2 #increase in load wrt frequency
+print "1%% drop in frequency, Increased in Load = %0.2f %%"%-delP_BY_delf 
+
+ +
+
+
+ +
+
+ + +
+
+
1% drop in frequency, Increased in Load = 0.72 %
+
+
+
+ +
+
+ +
+
+
+
+
+
+

exa 1.18 page 24

+
+
+
+
+
+
In [41]:
+
+
+
Lmax=100 #MW
+LF=40 #%#Load Factor
+Lavg=Lmax*LF/100 #MW
+E=Lavg*24*365 #MWh
+print "Energy generated in a year = %0.f MWh "%E 
+
+ +
+
+
+ +
+
+ + +
+
+
Energy generated in a year = 350400 MWh 
+
+
+
+ +
+
+ +
+
+
+
+
+
+

exa 1.19 page 25

+
+
+
+
+
+
In [42]:
+
+
+
from math import sqrt
+V=400 #V
+s1=0.03 #initial slip
+delV=1 #%#/Voltage Drop
+R1=0.290 #ohm/phase
+R2=0.15 #ohm/phase
+X=0.7 #ohm/phase(X1+X2)
+#V1**2*s1=V2**2*s2 for speed independent torque
+#taking for calculating s2
+V1=1 #V 
+V2=V1-V1*delV/100 #V
+s2=V1**2/V2**2*s1 #slip
+I2ByI1=sqrt((R1+R2/s1)**2+X**2)/sqrt((R1+R2/s2)**2+X**2)*(V2/V1)
+delI=(I2ByI1-1)*100 #%#Current Increase
+print "1%% drop in Voltage increases current by = %0.2f %%"%delI
+#P=(R1+R2/s)*I**2
+P2ByP1=(R1+R2/s2)/(R1+R2/s1)*I2ByI1**2 #ratio
+delP=(1-P2ByP1)*100 #%#Power Decrease
+print "1%% drop in Voltage decreases power input by = %0.1f %%"%delP 
+#Answer in the textbook is not accurate.
+
+ +
+
+
+ +
+
+ + +
+
+
1% drop in Voltage increases current by = 0.86 %
+1% drop in Voltage decreases power input by = 0.2 %
+
+
+
+ +
+
+ +
+
+
+ + -- cgit