diff options
22 files changed, 13281 insertions, 0 deletions
diff --git a/Engineering_Thermodynamics_by_Dr._S._S._Khandare/README.txt b/Engineering_Thermodynamics_by_Dr._S._S._Khandare/README.txt new file mode 100644 index 00000000..552509f9 --- /dev/null +++ b/Engineering_Thermodynamics_by_Dr._S._S._Khandare/README.txt @@ -0,0 +1,10 @@ +Contributed By: Sabiya +Course: btech +College/Institute/Organization: Dev Bhoomi Group Of Institution +Department/Designation: ECE +Book Title: Engineering Thermodynamics +Author: Dr. S. S. Khandare +Publisher: Charotar Publishing House Anand India +Year of publication: 2003 +Isbn: 81-85594-21-X +Edition: 1
\ No newline at end of file diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter1.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter1.ipynb new file mode 100644 index 00000000..e7f8326b --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter1.ipynb @@ -0,0 +1,737 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 1: Solution of Equation & Curve Fitting" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.1, page no. 21" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [-3. 2. 0.5]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly([0])\n", + "p = 2*(x**3)+x**2-13*x+6\n", + "print \"The roots of above equation are: \", numpy.roots([2,1,-13,6])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.2, page no. 21" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of the equation are: [ 2.00000000+2.64575131j 2.00000000-2.64575131j -2.66666667+0.j ]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly([0])\n", + "print \"The roots of the equation are: \", numpy.roots ([3, -4, 1, 88])" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 1.3, page no. 22" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [ 6. 3. -2.]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly([0])\n", + "p = x^3-7*(x^2)+36\n", + "print \"The roots of above equation are:\", numpy.roots([1, -7, 0, 36])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.4, page no. 23" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [ 5. -4. 2. -1.]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly ([0]) \n", + "p = x**4-2*(x**3)-21*(x**2)+22*x+40\n", + "print \"The roots of above equation are:\", numpy.roots([1,-2,-21,22,40])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.5, page no. 23" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [ 4. 2. 1. 0.5]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly ([0]) \n", + "p = 2*(x**4)-15*(x**3)+35*(x**2)-30*x+8\n", + "print \"The roots of above equation are:\", numpy.roots([2,-15,35,-30,8])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.6, page no. 24" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [ 2.87938524 0.65270364 -0.53208889]\n", + "let x1 = 0.6527036 x2 = -0.5320889 x3 = 2.8793852\n", + "So the equation whose roots are cube of the roots of above equation is (x−x1ˆ3)∗(x−x2ˆ3)∗(x−x3ˆ3)\n", + "(x - 23.8725770741465)*(x - 0.278066086195109)*(x + 0.150644263115026)\n" + ] + } + ], + "source": [ + "import numpy\n", + "import sympy\n", + "\n", + "x = numpy.poly ([0]) \n", + "p = x**3-3*(x**2)+1\n", + "ans = numpy.roots([1,-3, 0, 1])\n", + "print \"The roots of above equation are:\", ans\n", + "x = sympy.Symbol('x')\n", + "print \"let x1 = 0.6527036 x2 = -0.5320889 x3 = 2.8793852\"\n", + "print \"So the equation whose roots are cube of the roots of above equation is (x−x1ˆ3)∗(x−x2ˆ3)∗(x−x3ˆ3)\"\n", + "p1 = (x-x1**3)*(x-x2**3)*(x-x3**3)\n", + "print p1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.7, page no. 25" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are:\n", + "[ 4.48928857 2.28916855 -0.77845712]\n", + "let x1 = -0.7784571 x2 = 2.2891685 x3 = 4.4892886\n", + "Now, since we want equation whose sum of roots is 0. sum of roots of above equation is 6, so we will decrease\n", + "Value of each root by 2 i.e. x4 = x1-2\n", + "x4 = -2.7784571\n", + "x5 = 0.2891685\n", + "x6 = 2.4892886\n", + "Hence, the required equation is ( x−x4 ) ∗ ( x−x5 ) ∗ ( x−x6 ) = 0 −−>\n", + "(x - 2.4892886)*(x - 0.2891685)*(x + 2.7784571)\n" + ] + } + ], + "source": [ + "import numpy\n", + "import sympy\n", + "\n", + "x = numpy.poly ([0]) \n", + "x1 = numpy.poly ([0]) \n", + "x2 = numpy.poly ([0]) \n", + "x3 = numpy.poly ([0]) \n", + "x4 = numpy.poly ([0]) \n", + "x5 = numpy.poly ([0] ) \n", + "x6 = numpy.poly ([0]) \n", + "p = x**3-6*(x**2)+5*x+8\n", + "print \"The roots of above equation are:\"\n", + "print numpy.roots ([1, -6, 5, 8])\n", + "print \"let x1 = -0.7784571 x2 = 2.2891685 x3 = 4.4892886\"\n", + "x1 = -0.7784571\n", + "x2 = 2.2891685\n", + "x3 = 4.4892886\n", + "print \"Now, since we want equation whose sum of roots is 0. sum of roots of above equation is 6, so we will decrease\"\n", + "print \"Value of each root by 2 i.e. x4 = x1-2\"\n", + "x = sympy.Symbol('x')\n", + "x4 = x1-2\n", + "print \"x4 = \", x4\n", + "x5=x2-2\n", + "print \"x5 = \", x5\n", + "x6=x3-2\n", + "print \"x6 = \", x6\n", + "print \"Hence, the required equation is ( x−x4 ) ∗ ( x−x5 ) ∗ ( x−x6 ) = 0 −−>\"\n", + "p1 =( x-x4 )*(x-x5)*(x-x6)\n", + "print p1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.8, page no. 28" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [ 3. 2. 1. 0.5 0.33333333]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly ([0]) \n", + "p = 6*(x**5)-41*(x**4)+97*(x**3)-97*(x**2)+41*x-6\n", + "print \"The roots of above equation are:\",numpy.roots([6,-41,97,-97,41,-6])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.9, page no. 28" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [ 2.00000000+0.j -1.00000000+0.j 0.83333333+0.5527708j\n", + " 0.83333333-0.5527708j 1.00000000+0.j 0.50000000+0.j ]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly([0]) \n", + "p = 6*(x**6)-25*(x**5)+31*(x**4)-31*(x**2)+25*x-6\n", + "print \"The roots of above equation are:\", numpy.roots([6,-25,31,0,-31,25,-6])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.10, page no. 29" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [ 2.+3.46410162j 2.-3.46410162j -1.+0.j ]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly ([0]) \n", + "p = x**3-3*(x**2)+12*x+16\n", + "print \"The roots of above equation are:\", numpy.roots([1,-3,12,16])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.11, page no. 30" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [ 0.28571429+0.24743583j 0.28571429-0.24743583j -0.25000000+0.j ]\n" + ] + } + ], + "source": [ + "import numpy\n", + "x = numpy.poly ([0]) \n", + "p = 28*(x**3)-9*(x**2)+1\n", + "print \"The roots of above equation are:\",numpy.roots([28,-9,0,1])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.12, page no. 31" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [-5. +0.00000000e+00j 2. +2.90013456e-08j 2. -2.90013456e-08j]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly ([0]) \n", + "p = x**3+x**2-16*x+20\n", + "print \"The roots of above equation are:\",numpy.roots ([1,1,-16,20])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.13, page no. 31" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [ 1.08727971+1.17131211j 1.08727971-1.17131211j -1.17455941+0.j ]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly ([0]) \n", + "p = x**3-3*(x**2)+3\n", + "print \"The roots of above equation are:\",numpy.roots ([1,-1,0,3])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.14, page no. 33" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [ 6. 4. 3. -1.]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly([0]) \n", + "p = x**4-12*(x**3)+41*(x**2)-18*x-72\n", + "print \"The roots of above equation are:\",numpy.roots ([1,-12,41,-18,-72])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.15, page no. 34" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [-2.30277564 2.61803399 1.30277564 0.38196601]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly ([0]) \n", + "p = x**4-2*(x**3)-5*(x**2)+10*x-3\n", + "print \"The roots of above equation are:\", numpy.roots ([1,-2,-5,10,-3])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.16, page no. 35" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [ 3.73205081+0.j -2.00000000+1.73205081j -2.00000000-1.73205081j\n", + " 0.26794919+0.j ]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly ([0]) \n", + "p = x**4-8*(x**2)-24*x+7\n", + "print \"The roots of above equation are:\",numpy.roots ([1,0,-8,-24,7])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.17, page no. 35" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of above equation are: [ 6.05932014 -1.65491082 1.59559067]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly ([0]) \n", + "p = x**4-6*(x**3)-3*(x**2)+22*x-6\n", + "print \"The roots of above equation are:\",numpy.roots ([1,-6,-3,22.-6])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.18, page no. 37" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From the graph, it is clear that the point of intersection is nearly x = 1.43\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEZCAYAAACU3p4jAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xd41FXa//H3TZDQQlUQBRRRioAUBTuEFWmK+6wgiIoN\neKyouys+K4KEVdF1VUAsPxbFrthQF0GqmQRECF1KpAcQpBfpIcn5/TFJSIWZJJOZZD6v65rLmfm2\nk3G459znnO855pxDRERKvzLBLoCIiBQPBXwRkTChgC8iEiYU8EVEwoQCvohImFDAFxEJEwr4IsXM\nzKLNbGuwyyHhRwFfSgwzSzKzE2ZWM8f7S80szczqF/C8V5jZ92a2z8z2m9kqM3vezKoVTclFQoMC\nvpQkDtgI9M14w8xaABXSt/nNzK4BYoE5QGPnXHWgK5ACtMznmIiCXEsk2BTwpaT5GLg7y+t7gA8B\nAzCztma2w8wsYwczu9XMluVzvpeBCc65fznndgM457Y652Kcc3Hpx99rZj+Z2WtmtgcYbmYXmdmP\nZrbH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uAn4xs4x/TEOA+qDvqJ/O\n+Fmi76c/6gAfmFkZvJXzj5xzs83sASjYd1M3XomIhIlQaNIREZFioIAvIhImFPBFRMKEAr6ISJhQ\nwBcRCRMK+CIiYUIBX0q19Cl7N5pZ9fTX1dNf1y+Cc/9U+BKKFB+Nw5dSz8wGAxc75x4ws3HARpdl\nbWWRcKEavoSDUcBVZvYEcA3wSl47mdk3ZrYoffGOgenvXWBma82sZvrMhXPMrFP6tsPp/61jZvHp\nC3qsMLPriunvEvGLavgSFsysC/ADcKNzbnY++1R3zu1Pn7ckAWif/ro/0AVYCFzknHsoff9Dzrko\nM/s7EOmcG5k+T0ylfGbcFAkq1fAlXHQDtgMtTrPP4+lzj/+Md9bBRgDOuXeBqsADwJN5HJcA3Gdm\nw4HLFOwlVCngS6lnZq2ATsDVwF/N7Nw89okGbgCucs61ApYBkenbKuL9AXBAVM5j01chux7vtLTv\nm1m/wPwlIoWjgC+lWnoTy9t4F+PYCvybvNvwqwD7nXPHzawJcFWWbf8CPsI7M+n4PK5RH9jtnHsH\neAfvSk8iIUcBX0q7gUBSlnb7t4CmZnZ9jv2mAWXNbDXwIt5mHcysA3A58C/n3KdAspndk35MRgdY\nR2CZmS0BegNjAvbXiBSCOm1FRMKEavgiImFCAV9EJEwo4IuIhAkFfBGRMKGALyISJhTwRUTChAK+\niEiYUMAXEQkT/x8QVA7U71nSYgAAAABJRU5ErkJggg==\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7fa769850290>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%matplotlib inline\n", + "import matplotlib.pyplot as plt\n", + "import numpy\n", + "import math\n", + "\n", + "x = numpy.linspace(1 ,3 ,30)\n", + "y1 = 3-x\n", + "y2 = math.e**(x-1)\n", + "plt.xlabel('X axis')\n", + "plt.ylabel('Y axis')\n", + "plt.title('My Graph')\n", + "plt.plot(x, y1, \"o-\" )\n", + "plt.plot(x, y2, \"+-\" )\n", + "plt.legend([\"3-x\" ,\"e**(x-1)\"])\n", + "print \"From the graph, it is clear that the point of intersection is nearly x = 1.43\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.19, page no. 40" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From the graph, it is clear that the point of intersection is nearly x=2.3\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEZCAYAAAB4hzlwAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl8lNW9x/HPL2FJWAMIshnZRKiyCYIghqCYICi4Veot\nilyxbqC1oq0CF1zA4u21CrUqWETQWiuggJEdB8Qqyo6AgEhEQDDKDiGQ5Nw/JokhTGASMpkl3/fr\nNS9m5jnzzMn4OL85z/n9zmPOOURERACigt0BEREJHQoKIiKSR0FBRETyKCiIiEgeBQUREcmjoCAi\nInkUFERCkJklmtn3we6HlD0KChJRzCzVzDLMrFaB51ebWbaZxRdzvx3M7EMz22dm+81sg5k9a2Zx\nJdNzkdCgoCCRxgHfArfnPmFmrYDYnG1FZmZdgI+BT4CLnXM1gJ5AJtCmkNdEF+e9RIJNQUEi0VvA\nnfkeDwCmAAZgZpeb2R4zs9wGZnazma0pZH/PA5Occ2Odc2kAzrnvnXOjnHNLcl5/l5l9amYvmNlP\nwEgza2Jmi83sJzNLM7O3zKx6vvdMNbM/5Yw69pnZJDOrmP+NzewPZrbXzHab2V3n/tGInJmCgkSi\nz4FqZtYi5xd7P7yBAgDn3JfAz0ByvtfcAbxZcEdmVhm4Apjux/t2BLYBdYAxeIPQaKAe0BK4ABhV\n4DX/BSQBTYHmwPB82+oC1YD6wN3Ay/mDikggKChIpJqKd7RwLbAR2FVg+xSgP4CZ1cT7xfxPH/up\ngff/kz25T5jZ8znzCkfMbFi+trudcy8757Kdc8edc9ucc4uccyedcz8BfwW65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846M18ACTmP7waSgS+BJs65+3PaH3bOVTWzR4GKzrkxOWv6VC5kpVWRoNJIQeQX1wG7gVZnaPNw\nztr1n+FdbbI5gHPuH0B14F5gqI/XfQEMNLORQGsFBAlVCgoigJm1BXoAnYFHzKyujzaJwDXAFc65\ntsAaoGLOtkp4g4QDqhZ8bc7V8K7Cu2TxZDO7IzB/ici5UVCQMi/ndM4reC/28j3wv/ieU6gG7HfO\nHTezFsAV+baNBabiXZF2oo/3iAfSnHOvA6/jvdqYSMhRUBCBe4DUfPMIfwdamtlVBdrNBcqZ2Ubg\nObynkDCzbkB7YKxz7p/ACTMbkPOa3Em77sAaM1sF3Aa8FLC/RuQcaKJZRETyaKQgIiJ5FBRERCSP\ngoKIiORRUBARkTwKCiIikkdBQURE8igoiIhIHgUFERHJ8//DJctyqZFS9wAAAABJRU5ErkJggg==\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7fa7698ce210>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%matplotlib inline\n", + "import matplotlib.pyplot as plt\n", + "import numpy\n", + "import math\n", + "\n", + "x = numpy.linspace(1 ,3 ,30)\n", + "y1 = x\n", + "y2 = numpy.sin(x)+math.pi/2\n", + "plt.xlabel('X axis')\n", + "plt.ylabel('Y axis')\n", + "plt.title('My Graph')\n", + "plt.plot(x, y1, \"o-\")\n", + "plt.plot(x, y2, \"+-\")\n", + "plt.legend([\"x\", \"sin(x)+pi/2\"])\n", + "print \"From the graph, it is clear that the point of intersection is nearly x=2.3\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 1.20, page no. 41" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From the graph, it is clear that the point of intersection is nearly x=2.3 \n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYoAAAEZCAYAAACJjGL9AAAABHNCSVQICAg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3/0qcWThPA1DVp4Es4Cbg137etxq4VkRmAv9iQcLE\nKwsUxtRBRPoDo4DBwK9EJNdPGTfwI2CQqvbHuaVtmndbS5zAoUBmzfd675J3Ic70zn8RkSujcyTG\nNIwFCmP88F4K+iPOTW0KgQfx30bRGjioqiUicgYwyGfb/cDzODPLPuXnM04B9qrqn4E/49xpzZi4\nY4HCGP9uALb4tEs8AZwpIhfWKPcmkCwi64E5OJefEJHhwLnA/ar6EnBCRK72vqeyYXAE8JmIrAEu\nAx6J2tEY0wDWmG2MMSYgyyiMMcYEZIHCGGNMQBYojDHGBGSBwhhjTEAWKIwxxgRkgcIYY0xAFiiM\nMcYEZIHCGGNMQP8fXmj88edlNkgAAAAASUVORK5CYII=\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7fa7696dc7d0>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%matplotlib inline\n", + "import matplotlib.pyplot as plt\n", + "import numpy\n", + "import math\n", + "\n", + "x = numpy.linspace(0, 3, 30)\n", + "y1 = -1/numpy.cos(x)\n", + "y2 = numpy.cosh(x)\n", + "plt.xlabel('X axis')\n", + "plt.ylabel('Y axis')\n", + "plt.title('My Graph')\n", + "plt.plot(x, y1, \"o-\" )\n", + "plt.plot(x, y2, \"+-\" )\n", + "plt.legend ([\"-sec(x)\", \"cosh(x)\"])\n", + "print \"From the graph, it is clear that the point of intersection is nearly x=2.3 \"" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter10.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter10.ipynb new file mode 100644 index 00000000..d91055ed --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter10.ipynb @@ -0,0 +1,720 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10 : Fourier Series" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.1, page no. 327" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finding the fourier series of given function\n", + "enter the no of terms up to each of sin or cos terms in the expansion : 3\n", + "0.158857730350203*sin(x) + 0.127086184280162*sin(2*x) + 0.0953146382101218*sin(3*x) + 0.158857730350203*cos(x) + 0.0635430921400812*cos(2*x) + 0.0317715460700406*cos(3*x) + 0.158857730350203\n" + ] + } + ], + "source": [ + "import sympy,math,numpy\n", + "\n", + "print \"finding the fourier series of given function\"\n", + "x = sympy.Symbol('x')\n", + "ao = 1/math.pi*sympy.integrate(sympy.exp(-1*x),(x,0,2*math.pi))\n", + "s = ao/2\n", + "n = int(raw_input(\"enter the no of terms up to each of sin or cos terms in the expansion : \"))\n", + "for i in range (1,n+1):\n", + " ai = 1/math.pi*sympy.integrate(sympy.exp(-x)*sympy.cos(i*x),(x,0,2*math.pi))\n", + " bi = 1/math.pi*sympy.integrate(sympy.exp(-x)*sympy.sin(i*x),(x,0,2*math.pi))\n", + " s = s+float(ai)*sympy.cos(i*x)+float(bi)*sympy.sin(i*x)\n", + "print s" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.2, page no. 328" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the fourier transform of given function\n", + "Piecewise((2, s == 0), (1.0*I*exp(-1.0*I*s)/s - 1.0*I*exp(1.0*I*s)/s, True))\n", + "1.57079632679490\n" + ] + } + ], + "source": [ + "import numpy,math,sympy\n", + "\n", + "print \"To find the fourier transform of given function\"\n", + "x = sympy.Symbol('x')\n", + "s = sympy.Symbol('s')\n", + "F = sympy.integrate(sympy.exp(1j*s*x),(x,-1,1))\n", + "print F\n", + "F1 = sympy.integrate(sympy.sin(x)/x,(x,0,numpy.inf))\n", + "print F1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.3, page no. 328" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finding the fourier series of given function\n", + "enter the no of terms up to each of sin or cos terms in the expansion : 3\n", + "3.0*sin(x) - 0.5*sin(2*x) + 1.0*sin(3*x) - 0.636619772367581*cos(x) - 0.0707355302630646*cos(3*x) - 0.785398163397448\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"finding the fourier series of given function\"\n", + "x = sympy.Symbol('x')\n", + "ao = 1/math.pi*(sympy.integrate(-1*math.pi*x**0,(x,-math.pi,0))+sympy.integrate(x,(x,0,math.pi)))\n", + "s = ao/2\n", + "n = int(raw_input(\"enter the no of terms up to each of sin or cos terms in the expansion : \"))\n", + "for i in range (1,n+1):\n", + " ai = 1/math.pi*(sympy.integrate(-1*math.pi*sympy.cos(i*x),(x,-1*math.pi,0))+sympy.integrate(x*sympy.cos(i*x),(x,0,math.pi)))\n", + " bi = 1/math.pi*(sympy.integrate(-1*math.pi*x**0*sympy.sin(i*x),(x,-1*math.pi,0))+sympy.integrate(x*sympy.sin(i*x),(x,0,math.pi)))\n", + " s = s+float(ai)*sympy.cos(i*x)+float(bi)*sympy.sin(i*x)\n", + "print s" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.4, page no. 329" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finding the fourier series of given function\n", + "enter the no of terms up to each of sin or cos terms in the expansion :3\n", + "(exp(l) - exp(-l))/(2*l)\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"finding the fourier series of given function\"\n", + "x = sympy.Symbol('x')\n", + "l = sympy.Symbol('l')\n", + "ao = 1/l*sympy.integrate(sympy.exp(-1*x),(x,-l,l))\n", + "s = ao/2\n", + "n = int(raw_input(\"enter the no of terms up to each of sin or cos terms in the expansion :\"))\n", + "for i in range (1,n+1):\n", + " ai = 1/l*sympy.integrate(sympy.exp(-x)*sympy.cos(i*math.pi*x/l),(x,-l,l))\n", + " bi = 1/l*sympy.integrate(sympy.exp(-x)*sympy.sin(i*math.pi*x/l),(x,-l,l))\n", + " s = s+float(ai)*sympy.cos(i*math.pi*x/l)+float(bi)*sympy.sin(i*math.pi*x/l)\n", + "print s" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.5, page no. 330" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finding the fourier series of given function\n", + "enter the no of terms up to each of terms in the expansion : 3\n", + "2.0*sin(x) - 1.0*sin(2*x) + 0.666666666666667*sin(3*x)\n" + ] + } + ], + "source": [ + "import math,sympy\n", + "\n", + "print \"finding the fourier series of given function\"\n", + "x = sympy.Symbol('x')\n", + "l = sympy.Symbol('l')\n", + "s = 0\n", + "n = int(raw_input(\"enter the no of terms up to each of terms in the expansion : \"))\n", + "for i in range(1,n+1):\n", + " bi = 2/math.pi*sympy.integrate(x*sympy.sin(i*x),(x,0,math.pi))\n", + " s = s+float(bi)*sympy.sin(i*x)\n", + "print s" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.6, page no. 332" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finding the fourier series of given function\n", + "enter the no of terms up to each of sin or cos terms in the expansion :3\n", + "l**2/3\n" + ] + } + ], + "source": [ + "import math,sympy\n", + "\n", + "print \"finding the fourier series of given function\"\n", + "x = sympy.Symbol('x')\n", + "l = sympy.Symbol('l')\n", + "ao = 2/l*sympy.integrate(x**2,(x,0,l))\n", + "s = ao/2\n", + "n = int(raw_input(\"enter the no of terms up to each of sin or cos terms in the expansion :\"))\n", + "for i in range(1,n+1):\n", + " ai = 2/l*sympy.integrate(x**2*sympy.cos(i*math.pi*x/l),(x,0,l))\n", + " s = s+float(ai)*sympy.cos(i*math.pi*x/l)\n", + "print s" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 10.7, page no. 333" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finding the fourier series of given function\n", + "enter the no of terms up to each of sin or cos terms in the expansion :2\n", + "7.06789929214115e-17*cos(x) + 0.424413181578387*cos(2*x) + 0.636619772367581\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"finding the fourier series of given function\"\n", + "x = sympy.Symbol('x')\n", + "ao = 2/math.pi*(sympy.integrate(sympy.cos(x),(x,0,math.pi/2))+sympy.integrate(-sympy.cos(x),(x,math.pi/2,math.pi)))\n", + "s = ao/2\n", + "n = int(raw_input(\"enter the no of terms up to each of sin or cos terms in the expansion :\"))\n", + "for i in range(1,n+1):\n", + " ai = 2/math.pi*(sympy.integrate(sympy.cos(x)*sympy.cos(i*x),(x,0,math.pi/2))+sympy.integrate(-sympy.cos(x)*sympy.cos(i*x),(x,math.pi/2,math.pi)))\n", + " s = s+float(ai)*sympy.cos(i*x)\n", + "print s" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 10.8, page no. 334" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finding the fourier series of given function\n", + "enter the no of terms up to each of sin or cos terms in the expansion : 3\n", + "0.810569469138702*cos(x) + 7.79634366503875e-17*cos(2*x) + 0.0900632743487446*cos(3*x)\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"finding the fourier series of given function\"\n", + "x = sympy.Symbol('x')\n", + "ao = 2/math.pi*(sympy.integrate((1-2*x/math.pi),(x,0,math.pi)))\n", + "s = ao/2\n", + "n = int(raw_input(\"enter the no of terms up to each of sin or cos terms in the expansion : \"))\n", + "for i in range(1,n+1):\n", + " ai = 2/math.pi*(sympy.integrate((1-2*x/math.pi)*sympy.cos(i*x),(x,0,math.pi)))\n", + " s = s+float(ai)*sympy.cos(i*x)\n", + "print s" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.9, page no. 336" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finding the fourier series of given function\n", + "enter the no of terms up to each of sin or cos terms in the expansion : 3\n", + "0.0\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"finding the fourier series of given function\"\n", + "x = sympy.Symbol('x')\n", + "l = sympy.Symbol('l')\n", + "s = 0\n", + "n = int(raw_input(\"enter the no of terms up to each of sin or cos terms in the expansion : \"))\n", + "for i in range(1,n+1):\n", + " bi = sympy.integrate(x*sympy.sin(i*math.pi*x/2),(x,0,2)) \n", + " s = s+float(bi)*sympy.sin(i*math.pi*x/2)\n", + "print float(s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.10, page no. 337" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finding the fourier series of given function\n", + "enter the no of terms up to each of sin or cos terms in the expansion : 5\n", + "1.0\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"finding the fourier series of given function\"\n", + "x = sympy.Symbol('x')\n", + "ao = 2/2*(sympy.integrate(x,(x,0,2)))\n", + "s = ao/2\n", + "n = int(raw_input(\"enter the no of terms up to each of sin or cos terms in the expansion : \"))\n", + "for i in range(1,n+1):\n", + " ai = 2/2*(sympy.integrate(x*sympy.cos(i*math.pi*x/2),(x,0,2)))\n", + " s = s +float(ai)*sympy.cos(i*math.pi*x/2)\n", + "print float(s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.11, page no. 338" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finding the fourier series of given function\n", + "enter the no of terms up to each of sin or cos terms in the expansion : 2\n", + "0.0\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"finding the fourier series of given function\"\n", + "x = sympy.Symbol('x')\n", + "ao = 0\n", + "s = ao\n", + "n = int(raw_input(\"enter the no of terms up to each of sin or cos terms in the expansion : \"))\n", + "for i in range(1,n+1):\n", + " bi = 2/1*(sympy.integrate((1/4-x)*sympy.sin(i*math.pi*x),(x,0,1/2))+sympy.integrate((x-3/4)*sympy.sin(i*math.pi*x),(x,1/2,1)))\n", + " s = s+float(bi)*sympy.sin(i*math.pi*x)\n", + "print float(s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.12, page no. 339" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finding the fourier series of given function\n", + "enter the no of terms up to each of sin or cos terms in the expansion : 3\n", + "-4.0*cos(x) + 0.999999999999999*cos(2*x) - 0.444444444444444*cos(3*x) + 3.28986813369645\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"finding the fourier series of given function\"\n", + "x = sympy.Symbol('x')\n", + "ao = 1/math.pi*sympy.integrate(x**2,(x,-math.pi,math.pi))\n", + "s = ao/2\n", + "n = int(raw_input(\"enter the no of terms up to each of sin or cos terms in the expansion : \"))\n", + "for i in range(1,n+1):\n", + " ai = 1/math.pi*sympy.integrate((x**2)*sympy.cos(i*x),(x,-math.pi,math.pi))\n", + " bi = 1/math.pi*sympy.integrate((x**2)*sympy.sin(i*x),(x,-math.pi,math.pi))\n", + " s = s+float(ai)*sympy.cos(i*x)+float(bi)*sympy.sin(i*x)\n", + "print s" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.13, page no. 341" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The complex form of series is summation of f(n,x) where n varies from −%inf to %inf and f(n,x) is given by : \n", + "0\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"The complex form of series is summation of f(n,x) where n varies from −%inf to %inf and f(n,x) is given by : \"\n", + "n = sympy.Symbol('n')\n", + "x = sympy.Symbol('x')\n", + "a = sympy.exp(-x)\n", + "b = sympy.exp(-1j*math.pi*n*x)\n", + "cn = 1/2*sympy.Integral(sympy.exp(-x)*sympy.exp(-1j*math.pi*n*x),(x, -sympy.oo, sympy.oo))\n", + "fnx = float(cn)*sympy.exp(1j*n*math.pi*x) \n", + "print fnx" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.14, page no. 342" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Practical harmoninc analysis\n", + "No of sin or cos term in expansion : 5\n", + "-0.522944001594253*sin(x) - 0.410968418886797*sin(2*x) + 0.0927272727272729*sin(3*x) + 0.111796006670355*sin(4*x) - 0.126146907496654*sin(5*x) - 0.373397459621556*cos(x) + 0.159090909090909*cos(2*x) - 0.258181818181819*cos(3*x) - 0.257272727272728*cos(4*x) - 0.546602540378445*cos(5*x) + 1.30454545454545\n" + ] + } + ], + "source": [ + "import sympy, math, numpy\n", + "\n", + "print \"Practical harmoninc analysis\"\n", + "x = sympy.Symbol('x')\n", + "xo = numpy.array([math.pi/6, math.pi/3, math.pi/2, 2*math.pi/3, 5*math.pi/6, math.pi, 7*math.pi/6, 4*math.pi/3, \\\n", + " 3*math.pi/2, 5*math.pi/3, 11*math.pi/6])\n", + "yo = numpy.array([1.10, 0.30, 0.16, 1.50, 1.30, 2.16, 1.25, 1.30, 1.52, 1.76, 2.00])\n", + "ao = 2*numpy.sum(yo)/len(xo)\n", + "s = ao/2\n", + "n = int(raw_input('No of sin or cos term in expansion : '))\n", + "for i in range(1,n+1):\n", + " an = 2*sum(yo*numpy.cos(i*xo))/len(yo)\n", + " bn = 2*sum(yo*numpy.sin(i*xo))/len(yo)\n", + " s = s+float(an)*sympy.cos(i*x)+float(bn)*sympy.sin(i*x)\n", + "print s" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 10.15, page no. 342" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Practical harmonic analysis\n", + "No of sin or cos term in expansion :5\n", + "-1.61653377487451e-16*sin(6.28318530717959*x/T) + 1.5*cos(6.28318530717959*x/T) + 0.75\n", + "1.5 -1.61653377487e-16\n", + "Direct current :\n", + "1.5\n" + ] + } + ], + "source": [ + "import math,sympy,numpy\n", + "\n", + "print \"Practical harmonic analysis\"\n", + "x = sympy.Symbol('x')\n", + "T = sympy.Symbol('T')\n", + "xo = numpy.array([1/6,1/3,1/2,2/3,5/6,1])\n", + "yo = numpy.array([1.30,1.05,1.30,-0.88,-0.25,1.98])\n", + "ao = 2*sum(yo)/len(xo)\n", + "s = ao/2\n", + "n = int(raw_input(\"No of sin or cos term in expansion :\"))\n", + "i = 1\n", + "an = 2*sum(yo*numpy.cos(i*xo*2*math.pi))/len(yo)\n", + "bn = 2*sum(yo*numpy.sin(i*xo*2*math.pi))/len(yo)\n", + "s = s+float(an)*sympy.cos(i*x*2*math.pi/T)+float(bn)*sympy.sin(i*x*2*math.pi/T)\n", + "print s\n", + "print \"Direct current :\"\n", + "i = math.sqrt(an**2+bn**2)\n", + "print i" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.16, page no. 343" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Practical harmonic analysis\n", + "Input xo matrix (in factor of T):1\n", + "No of sin or cos term in expansion :5\n", + "-3.67394039744206e-16*sin(6.28318530717959*x/T) + 1.5*cos(6.28318530717959*x/T) + 4.5\n", + "Direct current :\n", + "1.5\n" + ] + } + ], + "source": [ + "import math,sympy,numpy\n", + "\n", + "print \"Practical harmonic analysis\"\n", + "x = sympy.Symbol('x')\n", + "T = sympy.Symbol('T')\n", + "xo = int(raw_input(\"Input xo matrix (in factor of T):\"))\n", + "yo = numpy.array([1.30,1.05,1.30,-0.88,-0.25,1.98])\n", + "ao = 2*sum(yo)/xo \n", + "s = ao/2\n", + "n = int(raw_input(\"No of sin or cos term in expansion :\"))\n", + "i = 1\n", + "an = 2*sum(yo*numpy.cos(i*xo*2*math.pi))/len(yo)\n", + "bn = 2*sum(yo*numpy.sin(i*xo*2*math.pi))/len(yo)\n", + "s = s+float(an)*sympy.cos(i*x*2*math.pi/T)+float(bn)*sympy.sin(i*x*2*math.pi/T)\n", + "print s\n", + "print \"Direct current :\"\n", + "i = math.sqrt(an**2+bn**2)\n", + "print i" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 10.17, page no. 344" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Practical harmonic analysis\n", + "Input xo matrix (in factor of T):1\n", + "No of sin or cos term in expansion :4\n", + "-3.67394039744206e-16*sin(6.28318530717959*x/T) + 1.5*cos(6.28318530717959*x/T) + 4.5\n", + "Direct current :\n", + "1.5\n" + ] + } + ], + "source": [ + "import math,sympy,numpy\n", + "\n", + "print \"Practical harmonic analysis\"\n", + "x = sympy.Symbol('x')\n", + "T = sympy.Symbol('T')\n", + "xo = int(raw_input(\"Input xo matrix (in factor of T):\"))\n", + "yo = numpy.array([1.30,1.05,1.30,-0.88,-0.25,1.98])\n", + "ao = 2*sum(yo)/xo \n", + "s = ao/2\n", + "n = int(raw_input(\"No of sin or cos term in expansion :\"))\n", + "i = 1\n", + "an = 2*sum(yo*numpy.cos(i*xo*2*math.pi))/len(yo)\n", + "bn = 2*sum(yo*numpy.sin(i*xo*2*math.pi))/len(yo)\n", + "s = s+float(an)*sympy.cos(i*x*2*math.pi/T)+float(bn)*sympy.sin(i*x*2*math.pi/T)\n", + "print s\n", + "print \"Direct current :\"\n", + "i = math.sqrt(an**2+bn**2)\n", + "print i" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter13.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter13.ipynb new file mode 100644 index 00000000..611dcffb --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter13.ipynb @@ -0,0 +1,600 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 13: Linear Differential Equations" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.1, page no. 398" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution to the given linear differential equation is given by: \n", + "y = c1*exp(-1.28077640640442*x) + c2*exp(0.780776406404415*x)\n" + ] + } + ], + "source": [ + "import sympy, numpy\n", + "\n", + "print \"Solution to the given linear differential equation is given by: \"\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "x = sympy.Symbol('x')\n", + "m = numpy.poly([0])\n", + "f = m**2+m-2\n", + "r = numpy.roots([2, 1, -2])\n", + "y = c1*sympy.exp(r[0]*x)+c2*sympy.exp(r[1]*x)\n", + "print \"y = \", y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.2, page no. 399" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution to the given linear differntial equation is given by: \n", + "y = (c1 + c2*x)*exp(x*(-1.5 + 1.5*I))\n" + ] + } + ], + "source": [ + "import sympy, numpy\n", + "\n", + "print 'Solution to the given linear differntial equation is given by: '\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "x = sympy.Symbol('x')\n", + "m = numpy.poly([0])\n", + "f = m**2+6*m+9;\n", + "r = numpy.roots([2, 6, 9])\n", + "y =(c1+x*c2)*sympy.exp(r[0]*x)\n", + "print \"y = \", y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.3, page no. 401" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution to the given linear differntial equation is given by: \n", + "y = c1*exp(0.105616806777468*x) + c2*exp(0.105616806777468*x) + c3*exp(-0.877900280221601*x)\n" + ] + } + ], + "source": [ + "import numpy, sympy\n", + "\n", + "print 'Solution to the given linear differntial equation is given by: '\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "c3 = sympy.Symbol('c3')\n", + "x = sympy.Symbol('x')\n", + "m = numpy.poly([0])\n", + "f = m**3+m*2+4*m+4;\n", + "r = numpy.roots([3, 2, 4, 4])\n", + "y = c1*sympy.exp(r[0].real*x)+c2*sympy.exp(r[1].real*x)+c3*sympy.exp(r[2].real*x)\n", + "print \"y = \", y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.4, page no. 402" + ] + }, + { + "cell_type": "code", + "execution_count": 61, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution to the given linear differntial equation is given by: \n", + "y = c1*exp(-0.707106781186547*x) + c2*exp(-0.707106781186547*x) + c3*exp(0.707106781186547*x) + c4*exp(0.707106781186547*x)\n" + ] + } + ], + "source": [ + "import numpy, sympy\n", + "\n", + "print 'Solution to the given linear differntial equation is given by: '\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "c3 = sympy.Symbol('c3')\n", + "c4 = sympy.Symbol('c4')\n", + "x = sympy.Symbol('x')\n", + "m = numpy.poly([0])\n", + "f = m**4+4;\n", + "r = numpy.roots([4, 0, 0, 0, 4])\n", + "y = c1*sympy.exp(r[0].real*x)+c2*sympy.exp(r[1].real*x)+c3*sympy.exp(r[2].real*x)+c4*sympy.exp(r[3].real*x)\n", + "print \"y = \", y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.5, page no. 402" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution to the given linear differntial equation is given by: \n", + "y = [ 9041.93285661 22.41271075]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "print 'Solution to the given linear differntial equation is given by: '\n", + "m = numpy.poly([0])\n", + "f = m**2+5*m+6\n", + "y = numpy.exp(f)/numpy.polyval(f,1)\n", + "print \"y = \", y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.6, page no. 403" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution of the given linear equation is given by: \n", + "[ 0.25+0.96824584j 0.25-0.96824584j]\n", + "y = 1/f(D)∗[exp(-2x)+exp(x)-exp(-x)\n", + "using 1/f(D)exp(ax) = x/f1(D)∗exp(ax) if f(m)=0\n", + "y = x**2*exp(x)/6 + x*exp(-2*x)/9 + exp(-x)/4\n" + ] + } + ], + "source": [ + "import numpy, sympy\n", + "\n", + "print 'Solution of the given linear equation is given by: '\n", + "x = sympy.Symbol('x')\n", + "m = numpy.poly([0])\n", + "f =(m+2)*(m-1)**2;\n", + "r = numpy.roots([2, -1, 2])\n", + "print r\n", + "print 'y = 1/f(D)∗[exp(-2x)+exp(x)-exp(-x)'\n", + "print 'using 1/f(D)exp(ax) = x/f1(D)∗exp(ax) if f(m)=0'\n", + "y1 = x*sympy.exp(-2*x)/9\n", + "y2 = sympy.exp(-x)/4\n", + "y3 = x**2*sympy.exp(x)/6\n", + "y = y1+y2+y3\n", + "print \"y = \", y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.7, page no. 404" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution of the given linear equation is given by: \n", + "Using the identity 1/f(D**2)∗sin(ax+b)[or cos(ax+b)]=1/f(-a**2)∗sin(ax+b)[or cos(ax+b)] this equation \n", + "can be redused to y = (4D+1)/65∗cos(2x-1)\n", + "y = -8*sin(2*x - 1)/65 + cos(2*x - 1)/65\n" + ] + } + ], + "source": [ + "import numpy, sympy\n", + "\n", + "print 'Solution of the given linear equation is given by: '\n", + "x = sympy.Symbol('x')\n", + "m = numpy.poly([0])\n", + "f = m**3+1;\n", + "print '''Using the identity 1/f(D**2)∗sin(ax+b)[or cos(ax+b)]=1/f(-a**2)∗sin(ax+b)[or cos(ax+b)] this equation \n", + "can be redused to''',\n", + "print 'y = (4D+1)/65∗cos(2x-1)'\n", + "y = (sympy.cos(2*x-1)+4*sympy.diff(sympy.cos(2*x-1),x))/65\n", + "print \"y = \", y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.8, page no. 405" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution of the given linear equation is given by: \n", + "Using 1/f(D)exp(ax) = x/f1(D)∗exp(ax) if f(m)=0\n", + "y = x∗1/(3D**2+4)∗sin2x\n", + "Using this identity 1/f(D**2)∗sin(ax+b)[or cos(ax+b)]= 1/f(-a**2)∗sin(ax+b)[or cos (ax+b)] this equation \n", + "can be redused to y = -x/8∗sin2x\n", + "y = -0.113662178353\n" + ] + } + ], + "source": [ + "import numpy, sympy\n", + "\n", + "print 'Solution of the given linear equation is given by: '\n", + "x = sympy.Symbol('x')\n", + "m = numpy.poly([0])\n", + "f = m**3+4*m\n", + "print 'Using 1/f(D)exp(ax) = x/f1(D)∗exp(ax) if f(m)=0'\n", + "print 'y = x∗1/(3D**2+4)∗sin2x'\n", + "print '''Using this identity 1/f(D**2)∗sin(ax+b)[or cos(ax+b)]= 1/f(-a**2)∗sin(ax+b)[or cos (ax+b)] this equation \n", + "can be redused to''',\n", + "print 'y = -x/8∗sin2x'\n", + "x=1\n", + "y = -x*numpy.sin(2*x)/8\n", + "print \"y = \", y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.9, page no. 406" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution of the given linear equation is given by: \n", + "y = 1/(D(D+1))[x**2+2x+4] can be written as (1−D+D**2)/D[x**2+2x+4] which is combination of\n", + "differentialtion and integration\n", + "y = x**3/3 + 4*x\n" + ] + } + ], + "source": [ + "import numpy, sympy\n", + "\n", + "print 'Solution of the given linear equation is given by: '\n", + "x = sympy.Symbol('x')\n", + "m = numpy.poly([0])\n", + "print '''y = 1/(D(D+1))[x**2+2x+4] can be written as (1−D+D**2)/D[x**2+2x+4] which is combination of\n", + "differentialtion and integration'''\n", + "g = x**2+2*x+4\n", + "f = g-sympy.diff(g,x)+sympy.diff(g,x,2)\n", + "y = sympy.integrate(f,x)\n", + "print 'y = ', y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.11, page no. 406" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution to the given linear differntial equation is given by: \n", + "CF + PI\n", + "[-1.]\n", + "CF is given by: \n", + "(c1 + c2*x)*exp(-1.0*x)\n", + "−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−\n", + "PI = 8∗{1/(D−2)**2[exp(2x)]+{1/(D−2)**2[sin(2x)]+{1/(D−2)**2[x**2]}\n", + "Using identitties it reduces to: 4*x**2*exp(2*x) + 4*x + cos(2*x) + 3\n", + "The solution is y = 4*x**2*exp(2*x) + 4*x + (c1 + c2*x)*exp(-1.0*x) + cos(2*x) + 3\n" + ] + } + ], + "source": [ + "import numpy, sympy\n", + "\n", + "print 'Solution to the given linear differntial equation is given by: '\n", + "print 'CF + PI'\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "x = sympy.Symbol('x')\n", + "m = numpy.poly([0])\n", + "f = (m-2)**2;\n", + "r = numpy.roots([2, 2])\n", + "print r\n", + "print 'CF is given by: '\n", + "cf = (c1+c2*x)*sympy.exp(r[0]*x)\n", + "print cf\n", + "print '−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−'\n", + "print 'PI = 8∗{1/(D−2)**2[exp(2x)]+{1/(D−2)**2[sin(2x)]+{1/(D−2)**2[x**2]}'\n", + "print 'Using identitties it reduces to: ',\n", + "pi = 4*x**2*sympy.exp(2*x)+sympy.cos(2*x)+4*x+3\n", + "print pi\n", + "y = cf + pi ;\n", + "print 'The solution is y = ', y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Exampe 13.12, page no. 407" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution to the given linear differntial equation is given by: \n", + "CF + PI\n", + "[-0.+1.41421356j 0.-1.41421356j]\n", + "CF is given by\n", + "c1*exp(1.4142135623731*I*x) + c2*exp(-1.4142135623731*I*x)\n", + "−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−\n", + "PI = 8∗{1/(D**2-4)[x∗sinh(x)]\n", + "Using identities it reduces to: -x*(exp(x) - exp(-x))/6\n", + "The solution is y = c1*exp(1.4142135623731*I*x) + c2*exp(-1.4142135623731*I*x) - x*(exp(x) - exp(-x))/6\n" + ] + } + ], + "source": [ + "import numpy, sympy\n", + "\n", + "print 'Solution to the given linear differntial equation is given by: '\n", + "print 'CF + PI'\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "x = sympy.Symbol('x')\n", + "m = numpy.poly([0])\n", + "f = m**2-4\n", + "r = numpy.roots([2, 0, 4])\n", + "print r\n", + "print 'CF is given by'\n", + "cf = c1*sympy.exp(r[0]*x)+c2*sympy.exp(r[1]*x)\n", + "print cf\n", + "print '−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−'\n", + "print 'PI = 8∗{1/(D**2-4)[x∗sinh(x)]'\n", + "print 'Using identities it reduces to: ',\n", + "pi = -x/6*(sympy.exp(x)-sympy.exp(-x))-2/18*(sympy.exp(x)+sympy.exp(-x))\n", + "print pi\n", + "y = cf + pi\n", + "print \"The solution is y = \", y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.13, page no. 408" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution to the given linear differntial equation is given by: \n", + "CF + PI\n", + "[-0.+0.70710678j 0.-0.70710678j]\n", + "CF is given by\n", + "c1*exp(0.707106781186548*I*x) + c2*exp(-0.707106781186548*I*x)\n", + "−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−\n", + "PI = -1/10∗{1/(D**2-1)[x∗sin(3x)+cos(x)]\n", + "Using identities it reduces to: -x*sin(3*x) - cos(x)/2\n", + "The solution is y = c1*exp(0.707106781186548*I*x) + c2*exp(-0.707106781186548*I*x) - x*sin(3*x) - cos(x)/2\n" + ] + } + ], + "source": [ + "import numpy, sympy\n", + "\n", + "print 'Solution to the given linear differntial equation is given by: '\n", + "print 'CF + PI'\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "x = sympy.Symbol('x')\n", + "m = numpy.poly([0])\n", + "f = m**2-1\n", + "r = numpy.roots([2, 0, 1])\n", + "print r\n", + "print 'CF is given by'\n", + "cf = c1*sympy.exp(r[0]*x)+c2*sympy.exp(r[1]*x)\n", + "print cf\n", + "print '−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−'\n", + "print 'PI = -1/10∗{1/(D**2-1)[x∗sin(3x)+cos(x)]'\n", + "print 'Using identities it reduces to: ',\n", + "pi = -1/10*(x*sympy.sin(3*x)+3/5*sympy.cos(3*x))-sympy.cos(x)/2\n", + "print pi\n", + "y = cf + pi\n", + "print \"The solution is y = \", y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 13.14, page no. 408" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution to the given linear differntial equation is given by: \n", + "CF + PI\n", + "(5.55111512313e-17+0.707106781187j)\n", + "CF is given by\n", + "(c1 + c2*x)*exp(5.55111512312578e-17*x) + (c3 + c4*x)*exp(-0.5*x)\n", + "−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−\n", + "PI = ∗{1/(D**4+2∗D+1)[x**2∗cos(x)]\n", + "Using identities it reduces to: 4*x**3*sin(x) - (x**4 - 9*x**2)*cos(x)\n", + "The solution is y = 4*x**3*sin(x) + (c1 + c2*x)*exp(5.55111512312578e-17*x) + (c3 + c4*x)*exp(-0.5*x) - (x**4 - 9*x**2)*cos(x)\n" + ] + } + ], + "source": [ + "import numpy, sympy\n", + "\n", + "print 'Solution to the given linear differntial equation is given by: '\n", + "print 'CF + PI'\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "c3 = sympy.Symbol('c3')\n", + "c4 = sympy.Symbol('c4')\n", + "x = sympy.Symbol('x')\n", + "m = numpy.poly([0])\n", + "f =m**4+2*m**2+1\n", + "r = numpy.roots([4, 2, 2, 1])\n", + "print r[0]\n", + "print 'CF is given by'\n", + "cf = ((c1+c2*x)*sympy.exp(r[0].real*x)+(c3+c4*x)*sympy.exp(r[2].real*x))\n", + "print cf\n", + "print '−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−'\n", + "print 'PI = ∗{1/(D**4+2∗D+1)[x**2∗cos(x)]'\n", + "print 'Using identities it reduces to: ',\n", + "pi = -1/48*((x**4-9*x**2)*sympy.cos(x)-4*x**3*sympy.sin(x))\n", + "print pi\n", + "y = cf + pi\n", + "print \"The solution is y = \", y" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter2.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter2.ipynb new file mode 100644 index 00000000..142664b2 --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter2.ipynb @@ -0,0 +1,1412 @@ +{ + "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": 8, + "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", + "from sympy import *\n", + "\n", + "a = Symbol('a');\n", + "b = Symbol('b');\n", + "c = 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": [ + "## Example 2.8, page no. 57" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "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": [ + "from sympy import *\n", + "\n", + "x = Symbol('x');\n", + "y = Symbol('y')\n", + "u = x**y\n", + "a = diff(u, y)\n", + "b = diff(a, x)\n", + "c = diff(b, x)\n", + "d = diff(u, x)\n", + "e = diff(d, y)\n", + "f = 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.16, page no. 64" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " AB=\n", + "[[ 3 -2]\n", + " [ 5 -5]\n", + " [ 7 -8]]\n", + "BA=\n" + ] + }, + { + "ename": "ValueError", + "evalue": "objects are not aligned", + "output_type": "error", + "traceback": [ + "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[1;31mValueError\u001b[0m Traceback (most recent call last)", + "\u001b[1;32m<ipython-input-40-036bffb29d5f>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 7\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[0mA\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0mB\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 8\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"BA=\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 9\u001b[1;33m \u001b[1;32mprint\u001b[0m \u001b[0mB\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0mA\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 10\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 11\u001b[0m \u001b[1;31m#Error in book as well. The matrix dimensions are not equal. Error in Scilab too\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;32m/usr/lib/python2.7/dist-packages/numpy/matrixlib/defmatrix.pyc\u001b[0m in \u001b[0;36m__mul__\u001b[1;34m(self, other)\u001b[0m\n\u001b[0;32m 339\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mother\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0mN\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mndarray\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mlist\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mtuple\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 340\u001b[0m \u001b[1;31m# This promotes 1-D vectors to row vectors\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 341\u001b[1;33m \u001b[1;32mreturn\u001b[0m \u001b[0mN\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdot\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0masmatrix\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mother\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 342\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0misscalar\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mother\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mor\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[0mhasattr\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mother\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;34m'__rmul__'\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 343\u001b[0m \u001b[1;32mreturn\u001b[0m \u001b[0mN\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdot\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mother\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n", + "\u001b[1;31mValueError\u001b[0m: objects are not aligned" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.matrix([[0,1,2],[1,2,3],[2,3,4]])\n", + "B = numpy.matrix([[1,-2],[-1,0],[2,-1]])\n", + "\n", + "print \"AB=\"\n", + "print A*B\n", + "print \"BA=\"\n", + "print B*A\n", + "\n", + "#Error in book as well. The matrix dimensions are not equal. Error in Scilab too" + ] + }, + { + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter21.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter21.ipynb new file mode 100644 index 00000000..db9ef99e --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter21.ipynb @@ -0,0 +1,1304 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 21 Laplace Transform" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.1.1, page no. 556" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "(12*s/((s**2 + 1)*(s**2 + 25)), 0, True)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "print laplace_transform(sympy.sin(2*t)*sympy.sin(3*t),t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.1.2, page no. 557" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "(sqrt(pi)*(sqrt(2)*sin(s**2/4)*fresnelc(sqrt(2)*s/(2*sqrt(pi))) - sqrt(2)*cos(s**2/4)*fresnels(sqrt(2)*s/(2*sqrt(pi))) + cos(s**2/4 + pi/4))/2, 0, True)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "print laplace_transform(sympy.cos(t**2),t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.1.3, page no. 558" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "((-1)**(1/12)*pi*sqrt(s)*besseli(-1/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 + (-1)**(11/12)*sqrt(3)*pi*sqrt(s)*besseli(1/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 + (-1)**(7/12)*sqrt(3)*pi*sqrt(s)*besseli(5/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 - (-1)**(5/12)*pi*sqrt(s)*besseli(7/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 + (-1)**(1/12)*pi*sqrt(s)*besselj(-1/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 + (-1)**(11/12)*sqrt(3)*pi*sqrt(s)*besselj(1/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 + (-1)**(7/12)*sqrt(3)*pi*sqrt(s)*besselj(5/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 - (-1)**(5/12)*pi*sqrt(s)*besselj(7/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 + s**2*hyper((1,), (2/3, 5/6, 7/6, 4/3), -s**6/11664)/6 + (-1)**(1/3)*pi*besseli(2/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/(3*s) - 2*(-1)**(1/6)*sqrt(3)*pi*besseli(4/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/(9*s) - (-1)**(1/3)*pi*besselj(2/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/(3*s) + 2*(-1)**(1/6)*sqrt(3)*pi*besselj(4/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/(9*s), 0, True)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "print laplace_transform((sympy.sin(t**3)),t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.2.1, page no. 560" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "((2*s - 9)/(s**2 + 6*s + 34), -3, True)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = sympy.exp(-3*t)*(2*sympy.cos(5*t)-3*sympy.sin(5*t))\n", + "print laplace_transform(f,t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.2.2, page no. 560" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "(2/((s - 3)*((s - 3)**2 + 4)), -oo, Abs(periodic_argument(exp_polar(2*I*pi)*polar_lift(-s + 3)**2, oo)) < pi)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = sympy.exp(3*t)*(sympy.sin(t))**2\n", + "print laplace_transform(f,t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.2.3, page no. 561" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "InverseLaplaceTransform(exp(4*t)*sin(2*t)*cos(t), t, s, _None)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = sympy.exp(4*t)*(sympy.cos(t)*sympy.sin(2*t))\n", + "print inverse_laplace_transform(f,t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.4.1, page no. 563" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "(2*a*s/(a**2 + s**2)**2, 0, Abs(periodic_argument(polar_lift(a)**2, oo)) == 0)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = t*sympy.sin(a*t)\n", + "print laplace_transform(f,t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.4.2, page no. 564" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "((-a**2 + s**2)/(a**2 + s**2)**2, 0, Abs(periodic_argument(polar_lift(a)**2, oo)) == 0)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = t*sympy.cos(a*t)\n", + "print laplace_transform(f,t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.5, page no. 565" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Piecewise((u/2, s**3*u**2 == 0), (1/(s**2*u) + (-s**2*u**2 - s*u)*exp(-s*u)/(s**3*u**2), True)) + Integral(exp(-s*t), (t, u, oo))\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "t = sympy.Symbol('t')\n", + "s = sympy.Symbol('s')\n", + "u = sympy.Symbol('u')\n", + "f = sympy.integrate(sympy.exp(-s*t)*t/u,(t,0,u))+sympy.integrate(sympy.exp(-s*t),(t,u,sympy.oo))\n", + "print f" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.7, page no. 566" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "(atan(a/s), 0, Abs(periodic_argument(polar_lift(a)**2, oo)) == 0)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = sympy.sin(a*t)/t\n", + "print laplace_transform(f,t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.8.1, page no. 567" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "((-a**2 + s**2)/(a**2 + s**2)**2, 0, Abs(periodic_argument(polar_lift(a)**2, oo)) == 0)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = t*sympy.cos(a*t)\n", + "print laplace_transform(f,t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.8.2, page no. 568" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "(2*a*(-a**2 + 3*s**2)/(a**2 + s**2)**3, 0, Abs(periodic_argument(polar_lift(a)**2, oo)) == 0)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = (t**2)*sympy.sin(a*t)\n", + "print laplace_transform(f,t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.8.3, page no. 569" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "(6/(s + 3)**4, 0, True)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = sympy.exp(-3*t)*t**3;\n", + "print laplace_transform(f,t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.8.4, page no. 570" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "(6*(s + 1)/((s + 1)**2 + 9)**2, -1, True)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = sympy.exp(-t)*t*sympy.sin(3*t)\n", + "print laplace_transform(f,t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.9.1, page no. 571" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "-MellinTransform(1, t, s) + MellinTransform(1/t, t, s)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import mellin_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = (1-t)/t\n", + "print mellin_transform(f,t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.9.2, page no. 572" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "(2**s*sqrt(pi)*a**(-s)*b**(-s)*(a*b**s - a**s*b)*gamma(s/2 - 1/2)/(4*gamma(-s/2 + 1)), (1, 2), And(Abs(periodic_argument(polar_lift(a)**2, oo)) == 0, Abs(periodic_argument(polar_lift(b)**2, oo)) == 0))\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import mellin_transform\n", + "from sympy.abc import t, s, a, b\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f =(sympy.cos(a*t)-sympy.cos(b*t))/t\n", + "print mellin_transform(f,t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.10.1, page no. 574" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the given integral find the laplace of tsin(t) and put s=2\n", + "Integral((2*s/(s**2 + 1)**2, 0, True), s)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the given integral find the laplace of tsin(t) and put s=2'\n", + "f = sympy.sin(t)*t\n", + "l = laplace_transform(f,t,s)\n", + "s = 2\n", + "print sympy.integrals.Integral(l)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.10.3, page no. 575" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "(sqrt(2)*LaplaceTransform(meijerg(((-1/2, 0, 1/4, 1/2, 3/4, 1), (1,)), ((), (-1/2, 0, 0)), 64*exp_polar(-4*I*pi)/t**4), t, s)/(8*sqrt(pi)) - 4/s - pi/(4*s) + 34*sqrt(2)/(9*s), 0, True)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = sympy.integrate(sympy.exp(t)*sympy.sin(t)/t,(t,0,t))\n", + "l = laplace_transform(f,t,s)\n", + "print l" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.11.1, page no. 576" + ] + }, + { + "cell_type": "code", + "execution_count": 58, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "InverseLaplaceTransform(1, t, s, _None)/s - 3*InverseLaplaceTransform(1, t, s, _None)/s**2 + 4*InverseLaplaceTransform(1, t, s, _None)/s**3\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f =(s**2-3*s+4)/s**3\n", + "print inverse_laplace_transform(f,t,s)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.11.2, page no. 577" + ] + }, + { + "cell_type": "code", + "execution_count": 60, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "s*InverseLaplaceTransform(1, t, s, _None)/(2*s**2 - 4*s + 13) + 2*InverseLaplaceTransform(1, t, s, _None)/(2*s**2 - 4*s + 13)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f =(s+2)/(2*s**2-4*s+13)\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.12.1, page no. 579" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "2*s**2*InverseLaplaceTransform(1, t, s, _None)/(s**3 - 6*s**2 + 11*s - 6) - 6*s*InverseLaplaceTransform(1, t, s, _None)/(s**3 - 6*s**2 + 11*s - 6) + 5*InverseLaplaceTransform(1, t, s, _None)/(s**3 - 6*s**2 + 11*s - 6)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f =((2*s**2-6*s+5)/(s**3-6*s**2+11*s-6))\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.12. 3, page no. 579" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "4*s*InverseLaplaceTransform(1, t, s, _None)/(s*(s - 1)**2 + 2*(s - 1)**2) + 5*InverseLaplaceTransform(1, t, s, _None)/(s*(s - 1)**2 + 2*(s - 1)**2)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f =(4*s+5)/((s-1)**2*(s+2))\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.13.1, page no. 580" + ] + }, + { + "cell_type": "code", + "execution_count": 64, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "5*s*InverseLaplaceTransform(1, t, s, _None)/(s**3 + s**2 + 3*s - 5) + 3*InverseLaplaceTransform(1, t, s, _None)/(s**3 + s**2 + 3*s - 5)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f =(5*s+3)/((s-1)*(s**2+2*s+5))\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.13.2, page no. 581" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "s*InverseLaplaceTransform(1, t, s, _None)/(4*a**4 + s**4)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = s/(s**4+4*a**4)\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.14.1, page no. 583" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "s**2*InverseLaplaceTransform(1, t, s, _None)/(s - 2)**3\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = s**2/(s-2)**3\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.14.2, page no. 583" + ] + }, + { + "cell_type": "code", + "execution_count": 67, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "s*InverseLaplaceTransform(1, t, s, _None)/(s**2 - 4*s + 13) + 3*InverseLaplaceTransform(1, t, s, _None)/(s**2 - 4*s + 13)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f =(s+3)/((s**2-4*s+13))\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.15.1, page no. 584" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "InverseLaplaceTransform(1, t, s, _None)/(a**2*s + s**3)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f =1/(s*(s**2+a**2))\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.15.2, page no. 584" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "InverseLaplaceTransform(1, t, s, _None)/(s*(a + s)**3)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f =1/(s*(s+a)**3)\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.16.1, page no. 585" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "s*InverseLaplaceTransform(1, t, s, _None)/(a**2 + s**2)**2\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = s/((s**2+a**2)**2)\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.16.2, page no. 586" + ] + }, + { + "cell_type": "code", + "execution_count": 71, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "s**2*InverseLaplaceTransform(1, t, s, _None)/(a**2 + s**2)**2\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = s**2/((s**2+a**2)**2) ;\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.16.3, page no. 587" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "InverseLaplaceTransform(1, t, s, _None)/(a**2 + s**2)**2\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = 1/((s**2+a**2)**2) ;\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.17.1, page no. 588" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "InverseLaplaceTransform(1, t, s, _None)/(a**2 + s**2)**2\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = (s+2)/(s**2*(s+1)*(s-2))\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.17.2, page no. 589" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "s*InverseLaplaceTransform(1, t, s, _None)/(s**2 + 4*s + 5)**2 + 2*InverseLaplaceTransform(1, t, s, _None)/(s**2 + 4*s + 5)**2\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f =(s+2)/(s**2+4*s+5)**2\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.19.1, page no. 590" + ] + }, + { + "cell_type": "code", + "execution_count": 80, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "s*InverseLaplaceTransform(1, t, s, _None)/(a**2 + s**2)**2\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = s/(s**2+a**2)**2\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.19.2, page no. 591" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace of given function in t\n", + "s**2*InverseLaplaceTransform(1, t, s, _None)/(a**2*b**2 + a**2*s**2 + b**2*s**2 + s**4)\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import inverse_laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "print 'To find the laplace of given function in t'\n", + "f = s**2/((s**2+a**2)*(s**2+b**2))\n", + "il = inverse_laplace_transform(f,t,s)\n", + "print il" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.28.1, page no. 598" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Laplace of the given funtion is: \n", + "Piecewise((1/2, s**3 == 0), (exp(-3*s)/s**2 - (-s**2 + s)*exp(-2*s)/s**3, True)) + Piecewise((1/2, s**3 == 0), (exp(-s)/s**2 + (-s**2 - s)*exp(-2*s)/s**3, True))\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "f = sympy.integrate(sympy.exp(-s*t)*(t-1),(t ,1 ,2))+sympy.integrate(sympy.exp(-s*t)*(3-t),(t ,2 ,3))\n", + "print 'Laplace of the given funtion is: '\n", + "print f" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 21.28.2, page no. 598" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Laplace of the given funtion is: \n", + "Piecewise((2, s == -1), (-1/(s*exp(2)*exp(2*s) + exp(2)*exp(2*s)) + 1/(s + 1), True))\n" + ] + } + ], + "source": [ + "import sympy\n", + "from sympy.integrals import laplace_transform\n", + "from sympy.abc import t, s, a\n", + "\n", + "f = sympy.integrate(sympy.exp(-s*t)*sympy.exp(-t),(t ,0 ,2))\n", + "print 'Laplace of the given funtion is: '\n", + "print f" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 21.34, page no. 602" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the laplace transform of periodic funtion\n", + "Piecewise((Piecewise((0, And(s == 0, w == 0)), (1.5707963267949*exp(3.14159265358979*I*w)*sin(3.14159265358979*w) + 1.5707963267949*I*exp(3.14159265358979*I*w)*cos(3.14159265358979*w) - I*exp(3.14159265358979*I*w)*sin(3.14159265358979*w)/(2*w), s == -I*w), (1.5707963267949*exp(-3.14159265358979*I*w)*sin(3.14159265358979*w) - 1.5707963267949*I*exp(-3.14159265358979*I*w)*cos(3.14159265358979*w) + I*exp(-3.14159265358979*I*w)*sin(3.14159265358979*w)/(2*w), s == I*w), (-s*sin(3.14159265358979*w)/(s**2*exp(3.14159265358979*s) + w**2*exp(3.14159265358979*s)) - w*cos(3.14159265358979*w)/(s**2*exp(3.14159265358979*s) + w**2*exp(3.14159265358979*s)), True)), And(Or(s == -I*w, s == 0, s == I*w), Or(s == -I*w, s == I*w, w == 0))), (Piecewise((w/(s**2 + w**2), And(s == 0, w == 0)), (w/(s**2 + w**2) + 1.5707963267949*exp(3.14159265358979*I*w)*sin(3.14159265358979*w) + 1.5707963267949*I*exp(3.14159265358979*I*w)*cos(3.14159265358979*w) - I*exp(3.14159265358979*I*w)*sin(3.14159265358979*w)/(2*w), s == -I*w), (w/(s**2 + w**2) + 1.5707963267949*exp(-3.14159265358979*I*w)*sin(3.14159265358979*w) - 1.5707963267949*I*exp(-3.14159265358979*I*w)*cos(3.14159265358979*w) + I*exp(-3.14159265358979*I*w)*sin(3.14159265358979*w)/(2*w), s == I*w), (-s*sin(3.14159265358979*w)/(s**2*exp(3.14159265358979*s) + w**2*exp(3.14159265358979*s)) - w*cos(3.14159265358979*w)/(s**2*exp(3.14159265358979*s) + w**2*exp(3.14159265358979*s)) + w/(s**2 + w**2), True)), True))/(w*(-exp(-6.28318530717959*s/w) + 1))\n" + ] + } + ], + "source": [ + "import sympy, math\n", + "\n", + "print 'To find the laplace transform of periodic funtion'\n", + "w = sympy.Symbol('w')\n", + "t = sympy.Symbol('t')\n", + "s = sympy.Symbol('s')\n", + "f = 1/(1-sympy.exp(-2*math.pi*s/w))*sympy.integrate(sympy.exp(-1*s*t)*sympy.sin(w*t),(t,0,math.pi))/w\n", + "print f" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter22.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter22.ipynb new file mode 100644 index 00000000..d3d7419e --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter22.ipynb @@ -0,0 +1,244 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 22 : Integral Transform" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22.1, page no. 608" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the fourier sin integral\n", + "0.636619772367581*Integral(sin(t*u), (t, 0, oo))*Integral(sin(u*x), (u, 0, oo))\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"To find the fourier sin integral\"\n", + "x = sympy.Symbol('x')\n", + "t = sympy.Symbol('t')\n", + "u = sympy.Symbol('u')\n", + "fs = 2/math.pi*sympy.integrate(sympy.sin(u*x),(u,0,sympy.oo))*(sympy.integrate(x**0*sympy.sin(u*t),(t,0,sympy.oo)))\n", + "print fs" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22.2, page no. 608" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the fourier transform of given function\n", + "Piecewise((2, s == 0), (1.0*I*exp(-1.0*I*s)/s - 1.0*I*exp(1.0*I*s)/s, True))\n", + "pi/2\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "print \"To find the fourier transform of given function\"\n", + "x = sympy.Symbol('x')\n", + "s = sympy.Symbol('s')\n", + "F = sympy.integrate(sympy.exp(1j*s*x),(x,-1,1))\n", + "print F\n", + "F1 = sympy.integrate(sympy.sin(x)/x,(x,0,sympy.oo))\n", + "print F1" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 22.3, page no. 609" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the fourier transform of given function\n", + "Piecewise((4/3, s**6 == 0), ((-2.0*s**4 - 2.0*I*s**3)*exp(1.0*I*s)/s**6 - (2.0*s**4 - 2.0*I*s**3)*exp(-1.0*I*s)/s**6, True))\n", + "Integral((x*cos(x) - sin(x))*cos(x/2)/x**3, (x, 0, +inf))\n" + ] + } + ], + "source": [ + "import sympy,numpy\n", + "\n", + "print \"To find the fourier transform of given function\"\n", + "x = sympy.Symbol('x')\n", + "s = sympy.Symbol('s')\n", + "F = sympy.integrate(sympy.exp(1j*s*x)*(1-x**2),(x,-1,1))\n", + "print F\n", + "F1 = sympy.integrals.Integral((x*sympy.cos(x)-sympy.sin(x))/x**3*sympy.cos(x/2),(x,0,numpy.inf))\n", + "print F1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22.4, page no. 610" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the fourier sin integral\n", + "Piecewise((s/(s**2 + 1), Abs(periodic_argument(polar_lift(s)**2, oo)) == 0), (Integral(exp(-x)*sin(s*x), (x, 0, oo)), True))\n", + "Piecewise((sqrt(pi)*(-sqrt(pi)*sinh(m) + sqrt(pi)*cosh(m))/2, Abs(periodic_argument(polar_lift(m)**2, oo)) == 0), (Integral(x*sin(m*x)/(x**2 + 1), (x, 0, oo)), True))\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"To find the fourier sin integral\"\n", + "x = sympy.Symbol('x')\n", + "s = sympy.Symbol('s')\n", + "m = sympy.Symbol('m')\n", + "fs = sympy.integrate(sympy.sin(s*x)*sympy.exp(-x),(x,0,sympy.oo))\n", + "print fs\n", + "f = sympy.integrate(x*sympy.sin(m*x)/(1+x**2),(x,0,sympy.oo))\n", + "print f" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22.5, page no. 611" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Fourier cosine transform.\n", + "Piecewise((1/2, s == 0), (-sin(s)/s + cos(s)/s**2 - cos(2*s)/s**2, True)) + Piecewise((1/2, s == 0), (sin(s)/s + cos(s)/s**2 - 1/s**2, True))\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"Fourier cosine transform.\"\n", + "x = sympy.Symbol('x')\n", + "s = sympy.Symbol('s')\n", + "f = sympy.integrate(x*sympy.cos(s*x),(x,0,1))+sympy.integrate((2-x)*sympy.cos(s*x),(x,1,2))\n", + "print f" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22.6, page no. 612" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Fourier cosine transform.\n", + "Piecewise((s*atan(sqrt(s**2/a**2))/(a*sqrt(s**2/a**2)), Or(And(-s**2/a**2 != 1, Abs(periodic_argument(polar_lift(a)**2, oo)) == pi, Abs(periodic_argument(polar_lift(s)**2, oo)) == 0), And(Abs(periodic_argument(polar_lift(a)**2, oo)) < pi, Abs(periodic_argument(polar_lift(s)**2, oo)) == 0))), (Integral(exp(-a*x)*sin(s*x)/x, (x, 0, oo)), True))\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"Fourier cosine transform.\"\n", + "x = sympy.Symbol('x')\n", + "s = sympy.Symbol('s')\n", + "a = sympy.Symbol('a')\n", + "f = sympy.integrate(sympy.exp(-a*x)/x*sympy.sin(s*x),(x,0,sympy.oo))\n", + "print f" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter23.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter23.ipynb new file mode 100644 index 00000000..a7ba913c --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter23.ipynb @@ -0,0 +1,762 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 23 : Statistical Methods" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23.1, page no. 618" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The first row of A denotes the no. of students falling in the marks group starting from (5 −10)... till (40−45)\n", + "the second row denotes cumulative frequency (less than)\n", + "the third row denotes cumulative frequency(more than)\n", + "[[ 5. 6. 15. 10. 5. 4. 2. 2.]\n", + " [ 5. 11. 26. 36. 41. 45. 47. 49.]\n", + " [ 49. 44. 38. 23. 13. 8. 4. 2.]]\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.zeros([3,8])\n", + "print \"The first row of A denotes the no. of students falling in the marks group starting from (5 −10)... till (40−45)\"\n", + "A[0] = [5,6,15,10,5,4,2,2]\n", + "print \"the second row denotes cumulative frequency (less than)\"\n", + "A[1,0] = 5\n", + "for i in range(1,8):\n", + " A[1,i] = A[1,i-1]+A[0,i]\n", + "print \"the third row denotes cumulative frequency(more than)\"\n", + "A[2,0] = 49\n", + "for i in range (1,8):\n", + " A[2,i] = A[2,i-1]-A[0,i-1]\n", + "print A" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23.2, page no. 619" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The first row of A represents the mid values of weekly earnings having interval of 2 in each class=x \n", + "The second row denotes the no. of employees or in other words frequency=f \n", + "Third row denotes f∗x\n", + "Fourth row denotes u=(x−25)/2 \n", + "Fifth row denotes f∗x\n", + "[[ 1.10000000e+01 1.30000000e+01 1.50000000e+01 1.70000000e+01\n", + " 1.90000000e+01 2.10000000e+01 2.30000000e+01 2.50000000e+01\n", + " 2.70000000e+01 2.90000000e+01 3.10000000e+01 3.30000000e+01\n", + " 3.50000000e+01 3.70000000e+01 3.90000000e+01 4.10000000e+01]\n", + " [ 3.00000000e+00 6.00000000e+00 1.00000000e+01 1.50000000e+01\n", + " 2.40000000e+01 4.20000000e+01 7.50000000e+01 9.00000000e+01\n", + " 7.90000000e+01 5.50000000e+01 3.60000000e+01 2.60000000e+01\n", + " 1.90000000e+01 1.30000000e+01 9.00000000e+00 7.00000000e+00]\n", + " [ 3.30000000e+01 7.80000000e+01 1.50000000e+02 2.55000000e+02\n", + " 4.56000000e+02 8.82000000e+02 1.72500000e+03 2.25000000e+03\n", + " 2.13300000e+03 1.59500000e+03 1.11600000e+03 8.58000000e+02\n", + " 6.65000000e+02 4.81000000e+02 3.51000000e+02 2.87000000e+02]\n", + " [ -7.00000000e+00 -6.00000000e+00 -5.00000000e+00 -4.00000000e+00\n", + " -3.00000000e+00 -2.00000000e+00 -1.00000000e+00 0.00000000e+00\n", + " 1.00000000e+00 2.00000000e+00 3.00000000e+00 4.00000000e+00\n", + " 5.00000000e+00 6.00000000e+00 7.00000000e+00 8.00000000e+00]\n", + " [ -2.10000000e+01 -3.60000000e+01 -5.00000000e+01 -6.00000000e+01\n", + " -7.20000000e+01 -8.40000000e+01 -7.50000000e+01 0.00000000e+00\n", + " 7.90000000e+01 1.10000000e+02 1.08000000e+02 1.04000000e+02\n", + " 9.50000000e+01 7.80000000e+01 6.30000000e+01 5.60000000e+01]]\n", + "Sum of all elements of third row= 13315.0\n", + "Sum of all elements of second row= 509.0\n", + "mean= 26.1591355599\n", + "Sum of all elements of fifth row= 295.0\n", + "mean by step deviation method= 26.1591355599\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.zeros([5,16])\n", + "print \"The first row of A represents the mid values of weekly earnings having interval of 2 in each class=x \"\n", + "A[0] = [11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41]\n", + "print \"The second row denotes the no. of employees or in other words frequency=f \"\n", + "A[1]=[3,6,10,15,24,42,75,90,79,55,36,26,19,13,9,7]\n", + "print \"Third row denotes f∗x\"\n", + "for i in range(0,16):\n", + " A[2,i] = A[0,i]*A[1,i]\n", + "print \"Fourth row denotes u=(x−25)/2 \"\n", + "for i in range(0,16):\n", + " A[3,i] = (A[0,i]-25)/2\n", + "print \"Fifth row denotes f∗x\"\n", + "for i in range(0,16):\n", + " A[4,i] = A[3,i]*A[1,i]\n", + "print A\n", + "b = 0\n", + "print \"Sum of all elements of third row=\",\n", + "for i in range(0,16):\n", + " b = b+A[2,i]\n", + "print b\n", + "f = 0\n", + "print \"Sum of all elements of second row=\",\n", + "for i in range(0,16):\n", + " f = f+A[1,i]\n", + "print f\n", + "print \"mean=\",b/f\n", + "d = 0\n", + "print \"Sum of all elements of fifth row= \",\n", + "for i in range(0,16):\n", + " d = d+A[4,i]\n", + "print d\n", + "print \"mean by step deviation method= \",25+(2*d/f)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23.3, page no. 620" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The first row of A denotes the no. of students falling in the marks group startin from (5−10)... till (40−45)\n", + "The second row denotes cumulative frequency (less than)\n", + "The third row denotes cumulative frequency (more than)\n", + "[[ 5. 6. 15. 10. 5. 4. 2. 2.]\n", + " [ 5. 11. 26. 36. 41. 45. 47. 49.]\n", + " [ 49. 44. 38. 23. 13. 8. 4. 2.]]\n", + "Median falls in the class (15−20)=l+((n/2−c)∗h)/f= 19\n", + "Lower quartile also falls in the class (15−20)=\n", + "Upper quartile also falls in the class (25−30)=\n", + "Semiinter quartile range= 5\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.zeros([3,8])\n", + "print \"The first row of A denotes the no. of students falling in the marks group startin from (5−10)... till (40−45)\"\n", + "\n", + "A[0] = [5,6,15,10,5,4,2,2]\n", + "print \"The second row denotes cumulative frequency (less than)\"\n", + "A[1]=[5,11,26,36,41,45,47,49]\n", + "print \"The third row denotes cumulative frequency (more than)\"\n", + "A[2] = [49,44,38,23,13,8,4,2]\n", + "print A\n", + "print \"Median falls in the class (15−20)=l+((n/2−c)∗h)/f= \",15+((49/2-11)*5)/15\n", + "print \"Lower quartile also falls in the class (15−20)=\"\n", + "Q1 = 15+((49/4-11)*5)/15\n", + "print \"Upper quartile also falls in the class (25−30)=\"\n", + "Q3 =25+((3*49/4-36)*5)/5\n", + "print \"Semiinter quartile range= \",(Q3-Q1)/2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23.4, page no. 620" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The first row of A denotes the roll no. of students form 1 to 10 and that of B denotes form 11 to 20 \n", + "The second row of A and B denotes the corresponding marks in physics\n", + "The third row denotes the corresponding marks in chemistry\n", + "Median marks in physics=arithmetic mean of 10th and 11th student = 26\n", + "Median marks in chemistry=arithmetic mean of 10th and 11th student = 41\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.zeros([3,10])\n", + "print \"The first row of A denotes the roll no. of students form 1 to 10 and that of B denotes form 11 to 20 \"\n", + "A[0] = [1,2,3,4,5,6,7,8,9,10]\n", + "B[0] = [11,12,13,14,15,16,17,18,19,20]\n", + "print \"The second row of A and B denotes the corresponding marks in physics\"\n", + "A[1] = [53,54,52,32,30,60,47,46,35,28]\n", + "B[1] = [25,42,33,48,72,51,45,33,65,29]\n", + "print \"The third row denotes the corresponding marks in chemistry\"\n", + "A[2] = [58,55,25,32,26,85,44,80,33,72]\n", + "B[2] = [10,42,15,46,50,64,39,38,30,36]\n", + "print \"Median marks in physics=arithmetic mean of 10th and 11th student = \",(28+25)/2\n", + "print \"Median marks in chemistry=arithmetic mean of 10th and 11th student = \",(72+10)/2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23.5, page no. 621" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Let the misssing frequencies be f1 and f2 \n", + "Sum of given frequencies=12+30+65+25+18 = 150\n", + "So, f1+f2=229−c = 79\n", + "Median=46=40+(114.5−(12+30+f1))∗10/65)\n", + "f1=33.5=34 \n" + ] + } + ], + "source": [ + "print \"Let the misssing frequencies be f1 and f2 \"\n", + "print \"Sum of given frequencies=12+30+65+25+18 = \",\n", + "c =12+30+65+25+18\n", + "print c\n", + "print \"So, f1+f2=229−c = \",229-c\n", + "print \"Median=46=40+(114.5−(12+30+f1))∗10/65)\"\n", + "print \"f1=33.5=34 \"\n", + "f1 = 34\n", + "f2 = 45" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23.6, page no. 622" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Let the eqidistance be s, then\n", + "Average speed = total distance/total time taken 1800/47\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "s = sympy.Symbol('s')\n", + "print \"Let the eqidistance be s, then\"\n", + "t1 = s/30\n", + "t2 = s/40\n", + "t3 = s/50\n", + "print \"Average speed = total distance/total time taken\",3*s/(t1+t2+t3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23.7, page no. 623" + ] + }, + { + "cell_type": "code", + "execution_count": 68, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The first row denotes the size of item \n", + "The second row denotes the corresponding frequency(f)\n", + "The third row denotes the corresponding deviation(d)\n", + "The fourth row denotes the corresponding f∗d \n", + "The fifth row denotes the corresponding f∗dˆ2 \n", + "[[ 6. 7. 8. 9. 10. 11. 12.]\n", + " [ 3. 6. 9. 13. 8. 5. 4.]\n", + " [ -3. -2. -1. 0. 1. 2. 3.]\n", + " [ -9. -12. -9. 0. 8. 10. 12.]\n", + " [ 27. 24. 9. 0. 8. 20. 36.]]\n", + "Sum of fourth row elements= 0.0\n", + "Sum of fifth row elements= 124.0\n", + "Sum of all frequencies = 48.0\n", + "mean=9+b/d = 9.0\n", + "Standard deviation = (c/d)ˆ0.5 = 1.60727512683\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.zeros([5,7])\n", + "print \"The first row denotes the size of item \"\n", + "A[0,:] = [6,7,8,9,10,11,12]\n", + "print \"The second row denotes the corresponding frequency(f)\"\n", + "A[1,:] = [3,6,9,13,8,5,4]\n", + "print \"The third row denotes the corresponding deviation(d)\"\n", + "A[2,:] = [-3,-2,-1,0,1,2,3]\n", + "print \"The fourth row denotes the corresponding f∗d \"\n", + "for i in range(0,7):\n", + " A[3,i] = A[1,i]*A[2,i] \n", + "print \"The fifth row denotes the corresponding f∗dˆ2 \"\n", + "for i in range(0,7):\n", + " A[4,i] = A[1,i]*(A[2,i]**2)\n", + "print A\n", + "b = 0\n", + "print \"Sum of fourth row elements= \",\n", + "for i in range(0,7):\n", + " b = b+A[3,i]\n", + "print b\n", + "c = 0\n", + "print \"Sum of fifth row elements= \",\n", + "for i in range(0,7):\n", + " c = c+A[4,i]\n", + "print c\n", + "d = 0\n", + "print \"Sum of all frequencies = \",\n", + "for i in range(0,7):\n", + " d = d+A[1,i]\n", + "print d\n", + "print \"mean=9+b/d = \",9+b/d\n", + "print \"Standard deviation = (c/d)ˆ0.5 = \",(c/d)**0.5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23.8, page no. 624" + ] + }, + { + "cell_type": "code", + "execution_count": 70, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The first row of A represents the mid values of wage classes having interval of 8 in each class=x \n", + "The second row denotes the no. of men or in other words frequency=f \n", + "Third row denotes f∗x \n", + "Fourth row denotes d=(x−32.5)/8 \n", + "Fifth row denotes f∗d \n", + "Sixth row denotes f∗(dˆ2)\n", + "[[ 8.5 16.5 24.5 32.5 40.5 48.5 56.5 64.5 72.5]\n", + " [ 2. 24. 21. 18. 5. 3. 5. 8. 2. ]\n", + " [ 17. 396. 514.5 585. 202.5 145.5 282.5 516. 145. ]\n", + " [ -3. -2. -1. 0. 1. 2. 3. 4. 5. ]\n", + " [ -6. -48. -21. 0. 5. 6. 15. 32. 10. ]\n", + " [ 18. 96. 21. 0. 5. 12. 45. 128. 50. ]]\n", + "Sum of all elements of sixth row= 375.0\n", + "Sum of all elements of second row= 88.0\n", + "mean= 4.26136363636\n", + "Sum of all elements of fifth row= Mean wage= 31.8636363636\n", + "standard deviation= 34.0402892562\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.zeros([6,9])\n", + "print \"The first row of A represents the mid values of wage classes having interval of 8 in each class=x \"\n", + "A[0] = [8.5,16.5,24.5,32.5,40.5,48.5,56.5,64.5,72.5]\n", + "print \"The second row denotes the no. of men or in other words frequency=f \"\n", + "A[1] = [2,24,21,18,5,3,5,8,2]\n", + "print \"Third row denotes f∗x \"\n", + "for i in range(0,9):\n", + " A[2,i] = A[0,i]*A[1,i] \n", + "print \"Fourth row denotes d=(x−32.5)/8 \"\n", + "for i in range(0,9):\n", + " A[3,i] = (A[0,i]-32.5)/8\n", + "print \"Fifth row denotes f∗d \"\n", + "for i in range(0,9):\n", + " A[4,i] = A[3,i]*A[1,i]\n", + "print \"Sixth row denotes f∗(dˆ2)\"\n", + "for i in range(0,9):\n", + " A[5,i] = A[3,i]**2*A[1,i]\n", + "print A\n", + "b = 0\n", + "print \"Sum of all elements of sixth row= \",\n", + "for i in range(0,9):\n", + " b = b+A[5,i]\n", + "print b\n", + "f = 0\n", + "print \"Sum of all elements of second row= \",\n", + "for i in range(0,9):\n", + " f = f+A[1,i]\n", + "print f\n", + "print \"mean= \",b/f\n", + "d = 0\n", + "print \"Sum of all elements of fifth row= \",\n", + "for i in range(0,9):\n", + " d = d+A[4,i]\n", + "print \"Mean wage= \",32.5+(8*d/f)\n", + "print \"standard deviation= \",8*(b/f-(d/f)**2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23.9, page no. 626" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The first row of A denotes the scores of A and that of B denotes that of B \n", + "The second row of A and B denotes the corresponding deviation \n", + "The third row of A and B denotes the corresponding deviation square \n", + "[[ 12. 115. 6. 73. 7. 19. 119. 36. 84. 29.]\n", + " [ -39. 64. -45. 22. -44. -32. 68. -15. 33. -22.]\n", + " [ 1521. 4096. 2025. 484. 1936. 1024. 4624. 225. 1089. 484.]]\n", + "[[ 47. 12. 16. 42. 4. 51. 37. 48. 13. 0.]\n", + " [ -4. -39. -35. -9. -47. 0. -14. -3. -38. -51.]\n", + " [ 16. 1521. 1225. 81. 2209. 0. 196. 9. 1444. 2601.]]\n", + "Sum of second row elements of A=b= -10.0\n", + "sum of second row elements of B=c= -240.0\n", + "Sum of third row elements of A=d= 17508.0\n", + "Sum of second row elements of B=e= 9302.0\n", + "Arithmetic mean of A= 50.0\n", + "Standard deviation of A= 41.8306108012\n", + "Arithmetic mean of B= 27.0\n", + "Standard deviation of A= 18.8202019118\n", + "Coefficient of variation of A= 83.6612216024\n", + "Coefficient of variation of B= 69.7044515251\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.zeros([3,10])\n", + "B = numpy.zeros([3,10])\n", + "print \"The first row of A denotes the scores of A and that of B denotes that of B \"\n", + "A[0] = [12,115,6,73,7,19,119,36,84,29]\n", + "B[0] = [47,12,16,42,4,51,37,48,13,0]\n", + "print \"The second row of A and B denotes the corresponding deviation \"\n", + "for i in range (0,10):\n", + " A[1,i] = A[0,i]-51\n", + " B[1,i] = B[0,i]-51\n", + "print \"The third row of A and B denotes the corresponding deviation square \"\n", + "for i in range (0,10):\n", + " A[2,i] = A[1,i]**2\n", + " B[2,i] = B[1,i]**2\n", + "print A\n", + "print B\n", + "b = 0\n", + "print \"Sum of second row elements of A=b=\",\n", + "for i in range (0,10):\n", + " b = b+A[1,i]\n", + "print b\n", + "c = 0\n", + "print \"sum of second row elements of B=c=\",\n", + "for i in range (0,10):\n", + " c = c+B[1,i]\n", + "print c\n", + "d = 0\n", + "print \"Sum of third row elements of A=d=\",\n", + "for i in range (0,10):\n", + " d = d+A[2,i]\n", + "print d\n", + "e = 0\n", + "print \"Sum of second row elements of B=e=\",\n", + "for i in range (0,10):\n", + " e = e+B[2,i]\n", + "print e\n", + "print \"Arithmetic mean of A= \",\n", + "f = 51+b/10\n", + "print f\n", + "print \"Standard deviation of A= \",\n", + "g = (d/10-(b/10)**2)**0.5\n", + "print g\n", + "print \"Arithmetic mean of B= \",\n", + "h = 51+c/10\n", + "print h\n", + "print \"Standard deviation of A= \",\n", + "i = (e/10-(c/10)**2)**0.5\n", + "print i\n", + "print \"Coefficient of variation of A=\",(g/f)*100\n", + "print \"Coefficient of variation of B=\",(i/h)*100" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23.10, page no. 628" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "If m is the mean of entire data, then\n", + "116\n", + "If s is the standard deviation of entire data, then \n", + "7.74596669241\n" + ] + } + ], + "source": [ + "print \"If m is the mean of entire data, then\"\n", + "m = (50*113+60*120+90*115)/(50+60+90)\n", + "print m\n", + "print \"If s is the standard deviation of entire data, then \"\n", + "s = (((50*6**2)+(60*7**2)+(90*8**2)+(50*3**2)+(60*4**2)+(90*1**2))/200)**0.5\n", + "print s" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23.12, page no. 629" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The first row of A denotes the no. of persons falling in the weight group starting from (70−80)... till (140−150)\n", + "The second row denotes cumulative frequency\n", + "Median falls in the class (110−120) = l+((n/2−c)∗h)/f= 111\n", + "Lower quartile also falls in the class (90−100)= 97.8571428571\n", + "Upper quartile also falls in the class (120−130)= 123.444444444\n", + "Quartile coefficient of skewness= -0.0272952853598\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.zeros([2,8])\n", + "print \"The first row of A denotes the no. of persons falling in the weight group starting from (70−80)... till (140−150)\"\n", + "A[0] = [12,18,35,42,50,45,20,8]\n", + "print \"The second row denotes cumulative frequency\"\n", + "A[1,0] = 12\n", + "for i in range(1,8):\n", + " A[1,i] = A[1,i-1]+A[0,i]\n", + "print \"Median falls in the class (110−120) = l+((n/2−c)∗h)/f= \",\n", + "Q2 = 110+(8*10)/50\n", + "print Q2\n", + "print \"Lower quartile also falls in the class (90−100)= \",\n", + "Q1 = 90+(57.5-30)*10/35\n", + "print Q1\n", + "print \"Upper quartile also falls in the class (120−130)= \",\n", + "Q3 = 120+(172.5-157)*10/45\n", + "print Q3\n", + "print \"Quartile coefficient of skewness= \",(Q1+Q3-2*Q2)/(Q3-Q1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 23.13, page no. 631" + ] + }, + { + "cell_type": "code", + "execution_count": 76, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The first row of A denotes the corresponding I.R. of students \n", + "The second row denotes the corresponding deviation of I.R.\n", + "The third row denotes the square of corresponding deviation of I.R.\n", + "The fourth row denotes the corresponding E.R. of students \n", + "The fifth row denotes the corresponding deviation of E.R.\n", + "The sixth row denotes the square of corresponding deviation of E.R.\n", + "The seventh row denotes the product of the two corresponding deviations\n", + "[[ 105. 104. 102. 101. 100. 99. 98. 96. 93. 92.]\n", + " [ 6. 5. 3. 2. 1. 0. -1. -3. -6. -7.]\n", + " [ 36. 25. 9. 4. 1. 0. 1. 9. 36. 49.]\n", + " [ 101. 103. 100. 98. 95. 96. 104. 92. 97. 94.]\n", + " [ 3. 5. 2. 0. -3. -2. 6. -6. -1. -4.]\n", + " [ 9. 25. 4. 0. 9. 4. 36. 36. 1. 16.]\n", + " [ 18. 25. 6. 0. -3. -0. -6. 18. 6. 28.]]\n", + "The sum of elements of first row=a = 990.0\n", + "The sum of elements of second row=b = 0.0\n", + "The sum of elements of third row=c = 170.0\n", + "The sum of elements of fourth row=d = 980.0\n", + "The sum of elements of fifth row=e = 0.0\n", + "The sum of elements of sixth row=d = 140.0\n", + "The sum of elements of seventh row=d = 92.0\n", + "Coefficient of correlation = 0.596347425668\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.zeros([7,10])\n", + "print \"The first row of A denotes the corresponding I.R. of students \"\n", + "A[0] = [105,104,102,101,100,99,98,96,93,92]\n", + "print \"The second row denotes the corresponding deviation of I.R.\"\n", + "for i in range(0,10):\n", + " A[1,i] = A[0,i]-99\n", + "print \"The third row denotes the square of corresponding deviation of I.R.\"\n", + "for i in range(0,10):\n", + " A[2,i] = A[1,i]**2\n", + "print \"The fourth row denotes the corresponding E.R. of students \"\n", + "A[3] = [101,103,100,98,95,96,104,92,97,94]\n", + "print \"The fifth row denotes the corresponding deviation of E.R.\"\n", + "for i in range(0,10):\n", + " A[4,i] = A[3,i]-98\n", + "print \"The sixth row denotes the square of corresponding deviation of E.R.\"\n", + "for i in range(0,10):\n", + " A[5,i] = A[4,i]**2\n", + "print \"The seventh row denotes the product of the two corresponding deviations\"\n", + "for i in range(0,10):\n", + " A[6,i] = A[1,i]*A[4,i]\n", + "print A\n", + "a = 0\n", + "print \"The sum of elements of first row=a = \",\n", + "for i in range(0,10):\n", + " a = a+A[0,i]\n", + "print a\n", + "b = 0 \n", + "print \"The sum of elements of second row=b = \",\n", + "for i in range(0,10):\n", + " b = b+A[1,i]\n", + "print b\n", + "c = 0\n", + "print \"The sum of elements of third row=c = \",\n", + "for i in range(0,10):\n", + " c = c+A[2,i]\n", + "print c\n", + "d = 0\n", + "print \"The sum of elements of fourth row=d = \",\n", + "for i in range(0,10):\n", + " d = d+A[3,i]\n", + "print d\n", + "e = 0\n", + "print \"The sum of elements of fifth row=e = \",\n", + "for i in range(0,10):\n", + " e = e+A[4,i]\n", + "print e\n", + "f = 0\n", + "print \"The sum of elements of sixth row=d = \",\n", + "for i in range(0,10):\n", + " f = f+A[5,i]\n", + "print f\n", + "g = 0\n", + "print \"The sum of elements of seventh row=d = \",\n", + "for i in range(0,10):\n", + " g = g+A[6,i]\n", + "print g\n", + "print \"Coefficient of correlation = \",g/(c*f)**0.5" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter24.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter24.ipynb new file mode 100644 index 00000000..9dd44a2c --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter24.ipynb @@ -0,0 +1,331 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 24: Numerical Methods" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 24.1, page no. 636" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Finding roots of this equation by bisection method\n", + "f(2) is -ve and f(3) is +ve so root lies between 2 and 3\n", + "The root is: 2.6875\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "x = numpy.poly([0])\n", + "p = x**3-4*x-9\n", + "print \"Finding roots of this equation by bisection method\"\n", + "print 'f(2) is -ve and f(3) is +ve so root lies between 2 and 3'\n", + "l = 2.\n", + "m = 3.\n", + "def f(x):\n", + " y = x**3-4*x-9\n", + " return y\n", + "for i in range(1,5):\n", + " k = 1.0/2.*(l+m)\n", + " if(f(k)<0):\n", + " l = k\n", + " else:\n", + " m = k\n", + "print \"The root is: \", k" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 24.3, page no. 638" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "f(x)=xeˆx−cos(x)\n", + "We are required to find the roots of f(x) by the method of false position \n", + "f(0)=−ve and f(1)=+ve so s root lie between 0 and 1 \n", + "finding the roots by false position method \n", + "The root of the equation is :\n", + "0.517747878322\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "print \"f(x)=xeˆx−cos(x)\"\n", + "def f(x):\n", + " y = x*math.e**(x)-math.cos(x)\n", + " return y\n", + "print \"We are required to find the roots of f(x) by the method of false position \"\n", + "print \"f(0)=−ve and f(1)=+ve so s root lie between 0 and 1 \"\n", + "print \"finding the roots by false position method \"\n", + "l = 0.0\n", + "m = 1.0\n", + "for i in range(1,11):\n", + " k = l-(m-l)*f(l)/(f(m)-f(l))\n", + " if(f(k)<0):\n", + " l = k\n", + " else:\n", + " m = k\n", + "print \"The root of the equation is :\"\n", + "print k" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 24.4, page no. 638" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "f(x) = x∗math.log(x)−1.2\n", + "We are required to find the roots of f(x) by the method of false position \n", + "f(2)=−ve and f(3)=+ve so s root lie between 2 and 3 \n", + "finding the roots by false position method \n", + "The root of the equation is : 2.74063625664\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "print \"f(x) = x∗math.log(x)−1.2\"\n", + "def f(x):\n", + " y = x*math.log10(x)-1.2\n", + " return y\n", + "print \"We are required to find the roots of f(x) by the method of false position \"\n", + "print \"f(2)=−ve and f(3)=+ve so s root lie between 2 and 3 \"\n", + "print \"finding the roots by false position method \"\n", + "l = 2.\n", + "m = 3.\n", + "for i in range(1,4):\n", + " k = l-(m-l)*f(l)/(f(m)-f(l))\n", + " if(f(k)<0):\n", + " l = k\n", + " else:\n", + " m = k\n", + "print \"The root of the equation is : \",k" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 24.5, page no. 639" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the roots of f(x) = 3x−cos(x)−1 by newtons method \n", + "f(0)=−ve and f(1) is +ve so a root lies between 0 and 1 \n", + "Let us take x0 =0.6 as the root is closer to 1 \n", + "Root is given by r=x0−f(xn)/der(f(xn))\n", + "Approximated root in each steps are \n", + "0.607290551153\n", + "0.607096741973\n", + "0.607101775605\n" + ] + } + ], + "source": [ + "import math,numpy\n", + "from scipy.misc import derivative\n", + "\n", + "print \"To find the roots of f(x) = 3x−cos(x)−1 by newtons method \"\n", + "print \"f(0)=−ve and f(1) is +ve so a root lies between 0 and 1 \"\n", + "l = 0\n", + "m = 1\n", + "def f(x):\n", + " y = 3*x-math.cos(x)-1\n", + " return y\n", + "x0 = 0.6\n", + "print \"Let us take x0 =0.6 as the root is closer to 1 \"\n", + "print \"Root is given by r=x0−f(xn)/der(f(xn))\"\n", + "print \"Approximated root in each steps are \"\n", + "for i in range(1,4):\n", + " k = x0-f(x0)/derivative(f,x0)\n", + " print k\n", + " x0 = k" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 24.6, page no. 640" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find square root of 28 by newtons method let x=sqrt(28) ie xˆ2−28=0 \n", + "To find the roots by newtons method\n", + "f(5)=−ve and f(6) is +ve so a root lies between 5 and 6 \n", + "Let us take x0 = 5.5 \n", + "Root is given by rn=xn−f(xn)/der(f(xn))\n", + "Approximated root in each steps are\n", + "5.29545454545\n", + "5.29150409676\n", + "5.29150262213\n", + "5.29150262213\n" + ] + } + ], + "source": [ + "from scipy.misc import derivative\n", + "\n", + "print \"To find square root of 28 by newtons method let x=sqrt(28) ie xˆ2−28=0 \"\n", + "def f(x):\n", + " y = x**2-28\n", + " return y\n", + "print \"To find the roots by newtons method\"\n", + "print \"f(5)=−ve and f(6) is +ve so a root lies between 5 and 6 \"\n", + "l = 5\n", + "m = 6\n", + "print \"Let us take x0 = 5.5 \"\n", + "print \"Root is given by rn=xn−f(xn)/der(f(xn))\"\n", + "print \"Approximated root in each steps are\"\n", + "x0 = 5.5\n", + "for i in range(1,5):\n", + " k = x0-f(x0)/derivative(f,x0)\n", + " print k\n", + " x0 = k" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 24.7, page no. 641" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find square root of 28 by newtons method let x=sqrt(28) ie xˆ2−28=0 \n", + "To find the roots by newtons method\n", + "f(5)=−ve and f(6) is +ve so a root lies between 5 and 6 \n", + "Let us take x0 = 5.5 \n", + "Root is given by rn=xn−f(xn)/der(f(xn))\n", + "Approximated root in each steps are\n", + "5.29545454545\n", + "5.29150409676\n", + "5.29150262213\n", + "5.29150262213\n" + ] + } + ], + "source": [ + "from scipy.misc import derivative\n", + "\n", + "print \"To find square root of 28 by newtons method let x=sqrt(28) ie xˆ2−28=0 \"\n", + "def f(x):\n", + " y = x**2-28\n", + " return y\n", + "print \"To find the roots by newtons method\"\n", + "print \"f(5)=−ve and f(6) is +ve so a root lies between 5 and 6 \"\n", + "l = 5\n", + "m = 6\n", + "print \"Let us take x0 = 5.5 \"\n", + "print \"Root is given by rn=xn−f(xn)/der(f(xn))\"\n", + "print \"Approximated root in each steps are\"\n", + "x0 = 5.5\n", + "for i in range(1,5):\n", + " k = x0-f(x0)/derivative(f,x0)\n", + " print k\n", + " x0 = k" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter26.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter26.ipynb new file mode 100644 index 00000000..dcac1bac --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter26.ipynb @@ -0,0 +1,522 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 26 : Difference Equations And Z Transform" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 26.2, page no. 667" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "yn= (-2)**n*b + 2**n*a\n", + "y(n+1)=yn1= (-2.0)**n*b + 2.0**n*a\n", + "y(n+2)=yn2= (-2.0)**n*b + 2.0**n*a\n", + "Eliminating a b from these equations we get :\n", + "The required difference equation : \n", + "16*yn0 - 4*yn2\n", + "=0\n" + ] + } + ], + "source": [ + "import sympy,numpy\n", + "\n", + "n = sympy.Symbol('n')\n", + "a = sympy.Symbol('a')\n", + "b = sympy.Symbol('b')\n", + "yn0 = sympy.Symbol('yn0')\n", + "yn1 = sympy.Symbol('yn1')\n", + "yn2 = sympy.Symbol('yn2')\n", + "yn = a*2**n+b*(-2)**n\n", + "print \"yn= \",yn\n", + "n = n+1\n", + "yn = yn.evalf()\n", + "print \"y(n+1)=yn1=\",yn\n", + "n = n+1\n", + "yn = yn.evalf()\n", + "print \"y(n+2)=yn2=\",yn\n", + "print \"Eliminating a b from these equations we get :\"\n", + "A = sympy.Matrix([[yn0,1,1],[yn1,2,-2],[yn2,4,4]])\n", + "y = A.det()\n", + "print \"The required difference equation : \"\n", + "print y\n", + "print \"=0\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 26.3, page no. 669" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cumulative function is given by Eˆ3−2∗Eˆ2−5∗E+6=0 \n", + "[-2. 3. 1.]\n", + "Therefor the complete solution is : \n", + "un= (-2.0)**(n + 2)*c1 + 1.0**(n + 2)*c3 + 3.0**(n + 2)*c2\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "c3 = sympy.Symbol('c3')\n", + "print \"Cumulative function is given by Eˆ3−2∗Eˆ2−5∗E+6=0 \"\n", + "E = numpy.poly([0])\n", + "f = E**3-2*E**2-5*E+6\n", + "r = numpy.roots([1,-2,-5,6])\n", + "print r\n", + "print \"Therefor the complete solution is : \"\n", + "un = c1*(r[0])**n+c2*(r[1])**n+c3*(r[2])**n\n", + "print \"un=\",un" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 26.4, page no. 670" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cumulative function is given by Eˆ2−2∗E+1=0 \n", + "[ 1. 1.]\n", + "Therefor the complete solution is : \n", + "un = 1.0**n*(c1 + c2*n)\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "c3 = sympy.Symbol('c3')\n", + "n = sympy.Symbol('n')\n", + "print \"Cumulative function is given by Eˆ2−2∗E+1=0 \"\n", + "E = numpy.poly([0])\n", + "f = E**2-2*E+1\n", + "r = numpy.roots([1,-2,1])\n", + "print r\n", + "print \"Therefor the complete solution is : \"\n", + "un = (c1+c2*n)*(r[0])**n\n", + "print \"un = \",un" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 26.6, page no. 671" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "For Fibonacci Series yn2=yn1+yn0 \n", + "So Cumulative function is given by Eˆ2−E−1=0 \n", + "[ 1.61803399 -0.61803399]\n", + "Therefor the complete solution is : \n", + "un = (-0.618033988749895)**n*c2 + 1.61803398874989**n*c1\n", + "Now puttting n=1, y=0 and n=2, y=1 we get \n", + "c1=(5−sqrt(5))/10 c2=(5+sqrt(5))/10 \n", + "(-0.618033988749895)**n*c2 + 1.61803398874989**n*c1\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "c3 = sympy.Symbol('c3')\n", + "n = sympy.Symbol('n')\n", + "print \"For Fibonacci Series yn2=yn1+yn0 \"\n", + "print \"So Cumulative function is given by Eˆ2−E−1=0 \"\n", + "E = numpy.poly([0])\n", + "f = E**2-E-1\n", + "r = numpy.roots([1,-1,-1])\n", + "print r\n", + "print \"Therefor the complete solution is : \"\n", + "un = (c1)*(r[0])**n+c2*(r[1])**n \n", + "print \"un = \",un\n", + "print \"Now puttting n=1, y=0 and n=2, y=1 we get \"\n", + "print \"c1=(5−sqrt(5))/10 c2=(5+sqrt(5))/10 \"\n", + "c1 =(5-math.sqrt(5))/10\n", + "c2 =(5+math.sqrt(5))/10\n", + "un = un.evalf()\n", + "print un" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 26.7, page no. 672" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cumulative function is given by Eˆ2−4∗E+3=0 \n", + "[ 3. 1.]\n", + "Therefor the complete solution is = cf+pi \n", + "cf = 1.0**n*c2 + 3.0**n*c1\n", + "PI=1/(Eˆ2−4E+3)[5ˆn]\n", + "put E=5\n", + "We get PI=5ˆn/8 \n", + "un = 1.0**n*c2 + 3.0**n*c1 + 5**n/8\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "c3 = sympy.Symbol('c3')\n", + "n = sympy.Symbol('n')\n", + "print \"Cumulative function is given by Eˆ2−4∗E+3=0 \"\n", + "E = numpy.poly([0])\n", + "f = E**2-4*E+3\n", + "r = numpy.roots([1,-4,3])\n", + "print r\n", + "print \"Therefor the complete solution is = cf+pi \"\n", + "cf = c1*(r[0])**n+c2*r[1]**n \n", + "print \"cf = \",cf\n", + "print \"PI=1/(Eˆ2−4E+3)[5ˆn]\"\n", + "print \"put E=5\"\n", + "print \"We get PI=5ˆn/8 \"\n", + "pi = 5**n/8\n", + "un = cf+pi\n", + "print \"un = \",un" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 26.8, page no. 672" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cumulative function is given by Eˆ2−4∗E+4=0 \n", + "[ 2. 2.]\n", + "Therefor the complete solution is = cf+pi\n", + "cf = 2.0**n*(c1 + c2*n)\n", + "PI=1/(Eˆ2−4E+4)[2ˆn]\n", + "We get PI=n∗(n−1)/2∗2ˆ(n−2)\n", + "un = 2**(n - 2)*n*(n - 1)/2 + 2.0**n*(c1 + c2*n)\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "c3 = sympy.Symbol('c3')\n", + "n = sympy.Symbol('n')\n", + "print \"Cumulative function is given by Eˆ2−4∗E+4=0 \"\n", + "E = numpy.poly([0])\n", + "f = E**2-4*E+4\n", + "r = numpy.roots([1,-4,4])\n", + "print r\n", + "print \"Therefor the complete solution is = cf+pi\" \n", + "cf = (c1+c2*n)*r[0]**n\n", + "print \"cf = \",cf\n", + "print \"PI=1/(Eˆ2−4E+4)[2ˆn]\"\n", + "print \"We get PI=n∗(n−1)/2∗2ˆ(n−2)\"\n", + "pi = n*(n-1)/math.factorial(2)*2**(n-2)\n", + "un = cf+pi\n", + "print \"un = \",un" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 26.10, page no. 674" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cumulative function is given by Eˆ2−4=0 \n", + "[-2. 2.]\n", + "Therefor the complete solution is = cf+pi \n", + "CF = (-2.0)**n*(c1 + c2*n)\n", + " PI=1/(Eˆ2−4)[nˆ2+n−1]\n", + "We get PI=−nˆ2/3−7/9∗n−17/27 \n", + "un = (-2.0)**n*(c1 + c2*n) - n**2/3\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "c3 = sympy.Symbol('c3')\n", + "n = sympy.Symbol('n')\n", + "print \"Cumulative function is given by Eˆ2−4=0 \"\n", + "E = numpy.poly([0])\n", + "f = E**2-4\n", + "r = numpy.roots([1,0,-4]) \n", + "print r\n", + "print \"Therefor the complete solution is = cf+pi \"\n", + "cf = (c1+c2*n)*r[0]**n\n", + "print \"CF = \",cf\n", + "print \" PI=1/(Eˆ2−4)[nˆ2+n−1]\"\n", + "print \"We get PI=−nˆ2/3−7/9∗n−17/27 \"\n", + "pi = -n**2/3-7/9*n-17/27\n", + "un = cf+pi \n", + "print \"un = \",un" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 26.11,page no. 674" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Cumulative function is given by Eˆ2−2∗E+1=0 \n", + "[-2.41421356 0.41421356]\n", + "Therefor the complete solution is = cf+pi\n", + "CF = (-2.41421356237309)**n*(c1 + c2*n)\n", + "PI=1/(E−1)ˆ2[nˆ2∗2ˆn]\n", + "We get PI=2ˆn∗(nˆ2−8∗n+20)\n", + "un = (-2.41421356237309)**n*(c1 + c2*n) + 2**n*(n**2 - 8*n + 20)\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "c3 = sympy.Symbol('c3')\n", + "n = sympy.Symbol('n')\n", + "print \"Cumulative function is given by Eˆ2−2∗E+1=0 \"\n", + "E = numpy.poly([0])\n", + "f = E**2+2*E-1\n", + "r = numpy.roots([1,2,-1])\n", + "print r\n", + "print \"Therefor the complete solution is = cf+pi\"\n", + "cf = (c1+c2*n)*r[0]**n\n", + "print \"CF = \",cf\n", + "print \"PI=1/(E−1)ˆ2[nˆ2∗2ˆn]\"\n", + "print \"We get PI=2ˆn∗(nˆ2−8∗n+20)\"\n", + "pi = 2**n*(n**2-8*n+20)\n", + "un = cf+pi\n", + "print \"un = \",un" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 26.12, page no. 676" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Simplified equations are : \n", + "(E−3) ux+vx=x..... (i) 3ux+(E−5)∗vx=4ˆx......(ii)\n", + "Simplifying we get (Eˆ2−8E+12) ux=1−4x−4ˆx \n", + "Cumulative function is given by Eˆ2−8∗E+12=0 \n", + "[ 6. 2.]\n", + "Therefor the complete solution is = cf+pi\n", + "CF = 2.0**x*c2 + 6.0**x*c1\n", + "Solving for PI \n", + "We get PI= \n", + "ux = 2.0**x*c2 + 4**x/4 + 6.0**x*c1 - x\n", + "Putting in (i) we get vx= \n", + "2**x*c1 - 4**x/4 - 3*6**x*c2 - 1\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "print \"Simplified equations are : \"\n", + "print \"(E−3) ux+vx=x..... (i) 3ux+(E−5)∗vx=4ˆx......(ii)\"\n", + "print \"Simplifying we get (Eˆ2−8E+12) ux=1−4x−4ˆx \"\n", + "c1 = sympy.Symbol('c1')\n", + "c2 = sympy.Symbol('c2')\n", + "c3 = sympy.Symbol('c3')\n", + "x = sympy.Symbol('x')\n", + "print \"Cumulative function is given by Eˆ2−8∗E+12=0 \"\n", + "E = numpy.poly([0])\n", + "f = E**2-8*E+12\n", + "r = numpy.roots([1,-8,12])\n", + "print r\n", + "print \"Therefor the complete solution is = cf+pi\"\n", + "cf = c1*r[0]**x+c2*r[1]**x\n", + "print \"CF = \",cf\n", + "print \"Solving for PI \"\n", + "print \"We get PI= \"\n", + "pi = -4/5*x-19/25+4**x/4\n", + "ux = cf+pi \n", + "print \"ux = \",ux\n", + "print \"Putting in (i) we get vx= \"\n", + "vx = c1*2**x-3*c2*6**x-3/5*x-34/25-4**x/4\n", + "print vx" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 26.16, page no. 682" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "u2 = 2\n", + "u3 = 13\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "z = sympy.Symbol('z')\n", + "f = (2/z**2+5/z+14)/(1/z-1)**4\n", + "u0 = sympy.limit(f,z,0)\n", + "u1 = sympy.limit(1/z*(f- u0),z,0)\n", + "u2 = sympy.limit(1/z**2*(f-u0-u1*z),z,0)\n", + "print \"u2 = \",u2\n", + "u3 = sympy.limit(1/z**3*(f-u0-u1*z-u2*z**2),z,0)\n", + "print \"u3 = \",u3" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter27.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter27.ipynb new file mode 100644 index 00000000..7703700f --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter27.ipynb @@ -0,0 +1,1082 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 27 : Numerical Solution Of Ordinary Differential Equations" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.1, page no. 686" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution through picards method \n", + "The no of iterations required3\n", + "y(0)=1 and y(x)=x+y \n", + "Y = x**4/24 + x**3/3 + x**2 + x + 1\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "x = sympy.Symbol('x')\n", + "print \"Solution through picards method \"\n", + "n = int(raw_input(\"The no of iterations required\")) \n", + "print \"y(0)=1 and y(x)=x+y \"\n", + "yo = 1\n", + "yn = 1\n", + "for i in range(1,n+1):\n", + " yn = yo+sympy.integrate(yn+x,(x,0,x))\n", + "print \"Y = \",yn" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.2, page no. 687" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution through picards method \n", + "The no of iterations required : 2\n", + "y(0)=1 and y(x)=x+y \n", + "Y = -Integral(2*x/(2*log(x + 1) + 1), x) + Integral(2*x/(2*log(x + 1) + 1), (x, 0)) - Integral(-2*log(x + 1)/(2*log(x + 1) + 1), x) + Integral(-2*log(x + 1)/(2*log(x + 1) + 1), (x, 0)) - Integral(-1/(2*log(x + 1) + 1), x) + Integral(-1/(2*log(x + 1) + 1), (x, 0)) + 1.0\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "x = sympy.Symbol('x')\n", + "print \"Solution through picards method \"\n", + "n = int(raw_input(\"The no of iterations required : \")) \n", + "print \"y(0)=1 and y(x)=x+y \"\n", + "yo = 1\n", + "y = 1\n", + "for i in range(1,n+1):\n", + " f = (y-x)/(y+x) \n", + " y = yo+sympy.integrate(f,(x,0,x))\n", + "x = 0.1\n", + "print \"Y = \",y.evalf()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.5, page no. 690" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution using Eulers Method \n", + "0.3\n", + "1.362\n", + "Input the number of iteration :− 4\n", + "The value of y is :− 1.5282\n" + ] + } + ], + "source": [ + "print \"Solution using Eulers Method \"\n", + "print x\n", + "print y\n", + "n = int(raw_input(\"Input the number of iteration :− \"))\n", + "x = 0\n", + "y = 1\n", + "for i in range(1,n+1):\n", + " y1 = x+y\n", + " y = y+0.1*y1\n", + " x = x+0.1\n", + "print \"The value of y is :− \",y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.6, page no. 691" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution using Eulers Method \n", + "0.4\n", + "1.5282\n", + "Input the number of iteration :− 2\n", + "1.02\n", + "1.03642857143\n", + "The value of y is :− 1.03642857143\n" + ] + } + ], + "source": [ + "print \"Solution using Eulers Method \"\n", + "print x\n", + "print y\n", + "n = int(raw_input(\"Input the number of iteration :− \"))\n", + "x = 0\n", + "y = 1\n", + "for i in range(1,n+1):\n", + " y1 = (y-x)/(y+x)\n", + " y = y+0.02*y1\n", + " x = x+0.1\n", + " print y\n", + "print \"The value of y is :− \",y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.7, page no. 692" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution using Eulers Method \n", + "0.2\n", + "1.03642857143\n", + "Input the number of iteration :− 3\n", + "1.1\n", + "1.11\n", + "1.1105\n", + "1.110525\n", + "−−−−−−−−−−−−−−−−−−−−−−− \n", + "1.2315775\n", + "1.2315775\n", + "1.242630125\n", + "1.24318275625\n", + "1.24321038781\n", + "−−−−−−−−−−−−−−−−−−−−−−− \n", + "1.38753142659\n", + "1.38753142659\n", + "1.39974747853\n", + "1.40035828113\n", + "1.40038882126\n", + "−−−−−−−−−−−−−−−−−−−−−−− \n", + "1.57042770339\n", + "The value of y is :− 1.40038882126\n" + ] + } + ], + "source": [ + "print \"Solution using Eulers Method \"\n", + "print x\n", + "print y\n", + "n = int(raw_input(\"Input the number of iteration :− \"))\n", + "x = 0.1\n", + "m = 1\n", + "y = 1\n", + "yn = 1\n", + "y1 = 1\n", + "k = 1\n", + "for i in range(1,n+1):\n", + " yn = y \n", + " for i in range(1,5):\n", + " m = (k+y1)/2\n", + " yn = y+0.1*m\n", + " y1 = (yn+x)\n", + " print yn\n", + " print \"−−−−−−−−−−−−−−−−−−−−−−− \"\n", + " y = yn \n", + " m = y1\n", + " yn = yn+0.1*m \n", + " print yn\n", + " x = x+0.1\n", + " yn = y \n", + " k = m\n", + "print \"The value of y is :− \",y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.8, page no. 694" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution using Eulers Method \n", + "0.2\n", + "2\n", + "Input the number of iteration :− 3\n", + "2.06020299957\n", + "2.06551474469\n", + "2.06561668931\n", + "2.06561864352\n", + "−−−−−−−−−−−−−−−−−−−−−−−\n", + "2.13665600548\n", + "2.13665600548\n", + "2.14156348217\n", + "2.14164742068\n", + "2.14164885497\n", + "−−−−−−−−−−−−−−−−−−−−−−−\n", + "2.22267196493\n", + "2.22267196493\n", + "2.22722645093\n", + "2.22729646948\n", + "2.22729754504\n", + "−−−−−−−−−−−−−−−−−−−−−−−\n", + "2.31757184825\n", + "The value of y is :− 2.22729754504\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "print \"Solution using Eulers Method \"\n", + "print x\n", + "print y\n", + "n = int(raw_input(\"Input the number of iteration :− \"))\n", + "x = 0.2\n", + "m = 0.301\n", + "y = 2\n", + "yn = 2\n", + "y1 = math.log10(2)\n", + "k = 0.301\n", + "for i in range(1,n+1):\n", + " yn = y\n", + " for i in range(1,5):\n", + " m = (k+y1)/2\n", + " yn = y+0.2*m\n", + " y1 = math.log10(yn+x)\n", + " print yn\n", + " print \"−−−−−−−−−−−−−−−−−−−−−−−\"\n", + " y = yn\n", + " m = y1\n", + " yn = yn+0.2*m \n", + " print yn\n", + " x = x+0.2\n", + " yn = y\n", + " k = m\n", + "print \"The value of y is :− \",y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.9, page no. 696" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Solution using Eulers Method \n", + "0.8\n", + "2.22729754504\n", + "Input the number of iteration :− 2\n", + "1.2\n", + "1.2295445115\n", + "1.23088482816\n", + "1.23094524903\n", + "−−−−−−−−−−−−−−−−−−−−−−− \n", + "1.49284119302\n", + "1.49284119302\n", + "1.52407510156\n", + "1.52534665765\n", + "1.52539814634\n", + "−−−−−−−−−−−−−−−−−−−−−−− \n", + "1.85241216588\n", + "The value of y is :− 1.52539814634\n" + ] + } + ], + "source": [ + "print \"Solution using Eulers Method \"\n", + "print x\n", + "print y\n", + "n = int(raw_input(\"Input the number of iteration :− \"))\n", + "x = 0.2 \n", + "m = 1\n", + "y = 1\n", + "yn = 1\n", + "y1 = 1\n", + "k = 1\n", + "for i in range(1,n+1):\n", + " yn = y\n", + " for i in range(1,5):\n", + " m = (k+y1)/2\n", + " yn = y+0.2*m \n", + " y1 = math.sqrt(yn)+x\n", + " print yn\n", + " print \"−−−−−−−−−−−−−−−−−−−−−−− \"\n", + " y = yn\n", + " m = y1\n", + " yn = yn+0.2*m\n", + " print yn\n", + " x = x+0.2\n", + " yn = y\n", + " k = m\n", + "print \"The value of y is :− \",y" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 27.10, page no. 697" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runges method\n", + "The required approximate value is :− \n", + "1.0\n" + ] + } + ], + "source": [ + "print \"Runges method\"\n", + "def f(x,y):\n", + " y = x+y\n", + " return y\n", + "x = 0\n", + "y = 1\n", + "h = 0.2\n", + "k1 = h*f(x,y)\n", + "k2 = h*f(x+1/2*h,y+1/2*k1)\n", + "kk = h*f(x+h,y+k1)\n", + "k3 = h*f(x+h,y+kk)\n", + "k = 1/6*(k1+4*k2+k3)\n", + "print \"The required approximate value is :− \"\n", + "y = y+k\n", + "print y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.11, page no. 697" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runges method\n", + "The required approximate value is :− \n", + "1.0\n" + ] + } + ], + "source": [ + "print \"Runges method\"\n", + "def f(x,y):\n", + " y = x+y\n", + " return y\n", + "x = 0\n", + "y = 1\n", + "h = 0.2\n", + "k1 = h*f(x,y)\n", + "k2 = h*f(x+1/2*h,y+1/2*k1)\n", + "k3 = h*f(x+1/2*h,y+1/2*k2)\n", + "k4 = h*f(x+h,y+k3)\n", + "k = 1/6*(k1+2*k2+2*k3+k4)\n", + "print \"The required approximate value is :− \"\n", + "y = y+k\n", + "print y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.12, page no. 698" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runga kutta method\n", + "The required approximate value is :− \n", + "1.0\n", + "To find y(0.4) put x=0.2 y=above value ie 1.196 h=0.2 \n", + "The required approximate value is :− \n", + "1.0\n" + ] + } + ], + "source": [ + "print \"Runga kutta method\"\n", + "def f(x,y):\n", + " y = (y**2-x**2)/(x**2+y**2)\n", + " return y\n", + "x = 0\n", + "y = 1\n", + "h = 0.2\n", + "k1 = h*f(x,y)\n", + "k2 = h*f(x+1/2*h,y+1/2*k1)\n", + "k3 = h*f(x+1/2*h,y+1/2*k2)\n", + "k4 = h*f(x+h,y+k3)\n", + "k = 1/6*(k1+2*k2+2*k3+k4)\n", + "print \"The required approximate value is :− \"\n", + "y = y+k\n", + "print y\n", + "print \"To find y(0.4) put x=0.2 y=above value ie 1.196 h=0.2 \"\n", + "x = 0.2\n", + "h = 0.2\n", + "k1 = h*f(x,y)\n", + "k2 = h*f(x+1/2*h,y+1/2*k1)\n", + "k3 = h*f(x+1/2*h,y+1/2*k2)\n", + "k4 = h*f(x+h,y+k3)\n", + "k = 1/6*(k1+2*k2+2*k3+k4)\n", + "print \"The required approximate value is :− \"\n", + "y = y+k\n", + "print y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.13, page no. 699" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runga kutta method\n", + "The required approximate value is :− \n", + "1.0\n", + "To find y(0.4) put x=0.2 y=above value ie 1.196 h=0.2 \n", + "The required approximate value is :− \n", + "1.0\n" + ] + } + ], + "source": [ + "print \"Runga kutta method\"\n", + "def f(x,y):\n", + " yy = x+y**2\n", + " return yy\n", + "x = 0\n", + "y = 1\n", + "h = 0.1\n", + "k1 = h*f(x,y)\n", + "k2 = h*f(x+1/2*h,y+1/2*k1)\n", + "k3 = h*f(x+1/2*h,y+1/2*k2) \n", + "k4 = h*f(x+h,y+k3)\n", + "k = 1/6*(k1+2*k2+2*k3+k4)\n", + "print \"The required approximate value is :− \"\n", + "y = y+k\n", + "print y\n", + "print \"To find y(0.4) put x=0.2 y=above value ie 1.196 h=0.2 \"\n", + "x = 0.1\n", + "h = 0.1\n", + "k1 = h*f(x,y)\n", + "k2 = h*f(x+1/2*h,y+1/2*k1)\n", + "k3 = h*f(x+1/2*h,y+1/2*k2)\n", + "k4 = h*f(x+h,y+k3)\n", + "k = 1/6*(k1+2*k2+2*k3+k4)\n", + "print \"The required approximate value is :− \"\n", + "y = y+k\n", + "print y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.14, page no. 700" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "y1= x**2/2\n", + "y2= -x**5/20 + x**2/2\n", + "y3= -x**5/20 + x**2/2\n", + "Determining the initial values for milnes method using y3 \n", + "x=0.0 y0=0.0 f0=0 \n", + "x=0.2 y1= x**2/2\n", + "f1= -x**4/4 + 0.2\n", + "x=0.4 y2= -x**5/20 + x**2/2\n", + "f2= -(-x**5/20 + x**2/2)**2 + 0.4\n", + "x=0.6 y3= -x**5/20 + x**2/2\n", + "f3= -(-x**5/20 + x**2/2)**2 + 0.6\n", + "Using predictor method to find y4\n", + "y4= -0.1*x**4 - 0.2*(-x**5/20 + x**2/2)**2 + 0.24\n", + "f4= -(-x**5/20 + x**2/2)**2 + 0.8\n", + "Using predictor method to find y5 \n", + "[-1.53353211362738, 2.59188514369719, -1.51825864909117 - 1.96576535664013*I, -1.51825864909117 + 1.96576535664013*I, -0.611593620665791 - 2.14551655586226*I, -0.611593620665791 + 2.14551655586226*I, 0.00495892544779777 - 0.780181689871346*I, 0.00495892544779777 + 0.780181689871346*I, 1.59571682927425 - 0.8271211188914*I, 1.59571682927425 + 0.8271211188914*I]\n", + "f5 = [-1.28459666867223, 2.38248090853886, -1.33416685318757 - 1.68618279990398*I, -1.33416685318757 + 1.68618279990398*I, -1.00716479884721 - 2.10036734766602*I, -1.00716479884721 + 2.10036734766602*I, 0.142926398918135 - 1.33989714259572*I, 0.142926398918135 + 1.33989714259572*I, 1.64946313318333 - 0.385565643189579*I, 1.64946313318333 + 0.385565643189579*I]\n", + "Hence y(1)= [-1.53353211362738, 2.59188514369719, -1.51825864909117 - 1.96576535664013*I, -1.51825864909117 + 1.96576535664013*I, -0.611593620665791 - 2.14551655586226*I, -0.611593620665791 + 2.14551655586226*I, 0.00495892544779777 - 0.780181689871346*I, 0.00495892544779777 + 0.780181689871346*I, 1.59571682927425 - 0.8271211188914*I, 1.59571682927425 + 0.8271211188914*I]\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "x = sympy.Symbol('x')\n", + "yo = 0\n", + "y = 0\n", + "h = 0.2\n", + "f = x-y**2\n", + "y = sympy.integrate(f,(x,0,x))\n", + "y1 = yo+y\n", + "print \"y1= \",y1\n", + "f = x-y**2\n", + "y = sympy.integrate(f,(x,0,x))\n", + "y2 = yo+y\n", + "print \"y2= \",y2\n", + "y = x-y**2\n", + "y = sympy.integrate(f,(x,0,x))\n", + "y3 = yo+y\n", + "print \"y3= \",y3\n", + "print \"Determining the initial values for milnes method using y3 \"\n", + "print \"x=0.0 y0=0.0 f0=0 \"\n", + "print \"x=0.2 y1= \",\n", + "x = 0.2\n", + "print y1\n", + "#y1 = sympy.solve(y1)\n", + "print \"f1=\",\n", + "f1 = x-y1**2\n", + "print f1\n", + "print \"x=0.4 y2= \",\n", + "x = 0.4\n", + "print y2\n", + "print \"f2= \",\n", + "f2 = x-y2**2\n", + "print f2\n", + "print \"x=0.6 y3= \",\n", + "x = 0.6\n", + "print y3\n", + "print \"f3=\",\n", + "f3 = x-y3**2\n", + "print f3\n", + "print \"Using predictor method to find y4\"\n", + "x = 0.8\n", + "y4 = yo+4/3*h*(2*f1-f2+2*f3)\n", + "print \"y4=\",y4\n", + "f4 = x-y**2\n", + "print \"f4= \",f4\n", + "print \"Using predictor method to find y5 \"\n", + "x = 1.0\n", + "y5 = sympy.solve(y1+4/3*h*(2*f2-f3+2*f4))\n", + "print y5\n", + "f5 = sympy.solve(x-y**2)\n", + "print \"f5 =\",f5\n", + "print \"Hence y(1)= \",y5" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.15, page no. 704" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runga kutta method\n", + "The required approximate value is :− \n", + "1.0\n", + "To find y(0.4) put x=0.2 y=above value ie 1.196 h=0.2 \n", + "The required approximate value is :− \n", + "1.0\n", + "To find y(0.4) put x=0.2 y=above value ie 1.196 h=0.2 \n", + "The required approximate value is :− \n", + "1.0\n", + "y0 y1 y2 y3 are respectively: \n", + "1.0 1.0 1.0 1\n", + "f0 f1 f2 f3 are respectively: \n", + "1.3 1.2 1.1 1\n", + "finding y4 using predictors milne method x=0.4\n", + "y4 = 1.48\n", + "f4 = 2.7824\n", + "Using corrector method : \n", + "y4 = -0.0333333333333333*(-x**5/20 + x**2/2)**2 + 1.24\n", + "f4 = -0.0133333333333333*(-x**5/20 + x**2/2)**2 + (-0.0333333333333333*(-x**5/20 + x**2/2)**2 + 1.24)**2 + 0.496\n" + ] + } + ], + "source": [ + "print \"Runga kutta method\"\n", + "def f(x,y):\n", + " yy = x*y+y**2\n", + " return yy\n", + "y0 = 1\n", + "x = 0\n", + "y = 1\n", + "h = 0.1\n", + "k1 = h*f(x,y)\n", + "k2 = h*f(x+1/2*h,y+1/2*k1)\n", + "k3 = h*f(x+1/2*h,y+1/2*k2)\n", + "k4 = h*f(x+h,y+k3)\n", + "ka = 1/6*(k1+2*k2+2*k3+k4)\n", + "print \"The required approximate value is :− \"\n", + "y1 = y+ka \n", + "y = y+ka \n", + "print y\n", + "print \"To find y(0.4) put x=0.2 y=above value ie 1.196 h=0.2 \"\n", + "x = 0.1\n", + "h = 0.1\n", + "k1 = h*f(x,y)\n", + "k2 = h*f(x+1/2*h,y+1/2*k1)\n", + "k3 = h*f(x+1/2*h,y+1/2*k2)\n", + "k4 = h*f(x+h,y+k3)\n", + "kb = 1/6*(k1+2*k2+2*k3+k4)\n", + "print \"The required approximate value is :− \"\n", + "y2 = y+kb \n", + "y = y+kb\n", + "print y\n", + "print \"To find y(0.4) put x=0.2 y=above value ie 1.196 h=0.2 \"\n", + "x = 0.2\n", + "h = 0.1\n", + "k1 = h*f(x,y)\n", + "k2 = h*f(x+1/2*h,y+1/2*k1)\n", + "k3 = h*f(x+1/2*h,y+1/2*k2)\n", + "k4 = h*f(x+h,y+k3)\n", + "kc = 1/6*(k1+2*k2+2*k3+k4)\n", + "print \"The required approximate value is :− \"\n", + "y3 = y+kc\n", + "y = y+kc \n", + "print y\n", + "f0 = f(0,y0)\n", + "f1 = f(0.1,y1)\n", + "f2 = f(0.2,y2)\n", + "f3 = f(0.3,y3)\n", + "print \"y0 y1 y2 y3 are respectively: \"\n", + "print y3,y2,y1,y0\n", + "print \"f0 f1 f2 f3 are respectively: \"\n", + "print f3,f2,f1,f0\n", + "print \"finding y4 using predictors milne method x=0.4\"\n", + "h = 0.1\n", + "y4 = y0+4*h/3*(2*f1-f2+2*f3)\n", + "print \"y4 = \",y4\n", + "print \"f4 = \",f(0.4,y4)\n", + "print \"Using corrector method : \"\n", + "y4 = y2+h/3*(f2+4*f3+f4) \n", + "print \"y4 = \",y4\n", + "print \"f4 = \",f(0.4,y4) " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.16, page no. 705" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Using predictor method \n", + "y11 = 2.57229741667\n", + "Using corrector method \n", + "y11 = 2.57494727679\n", + "f11 = 7.00689666251\n" + ] + } + ], + "source": [ + "def f(x,y):\n", + " yy = x**2*(1+y)\n", + " return yy\n", + "y3 = 1\n", + "y2 = 1.233\n", + "y1 = 1.548\n", + "y0 = 1.979\n", + "f3 = f(1,y3)\n", + "f2 = f(1.1,y2)\n", + "f1 = f(1.2,y1)\n", + "f0 = f(1.3,y0)\n", + "print \"Using predictor method \"\n", + "h = 0.1\n", + "y11 = y0+h/24*(55*f0-59*f1+37*f2-9*f3)\n", + "print \"y11 = \",y11\n", + "x = 1.4\n", + "f11 = f(1.4,y11)\n", + "print \"Using corrector method \"\n", + "y11 = y0+h/24*(9*f11+19*f0-5*f1+f2)\n", + "print \"y11 = \",y11\n", + "f11 = f(1.4,y11)\n", + "print \"f11 = \",f11" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.17, page no. 706" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Runga kutta method\n", + "The required approximate value is :− \n", + "1.0\n", + "To find y(0.4) put x=0.2 y=above value ie 1.196 h=0.2 \n", + "The required approximate value is :− \n", + "1.0\n", + "To find y(0.4) put x=0.2 y=above value ie 1.196 h=0.2 \n", + "The required approximate value is :− \n", + "1.0\n", + "y0 y1 y2 y3 are respectively :\n", + "1.0 1.0 1.0 1\n", + "f0 f1 f2 f3 are respectively :\n", + "-0.7 -0.8 -0.9 -1\n", + "Using adams method \n", + "Using the predictor\n", + "y4 = 0.935\n", + "Using corrector method \n", + "y4 = 0.9397165625\n", + "f4 = -0.483067217837\n" + ] + } + ], + "source": [ + "print \"Runga kutta method\"\n", + "def f(x,y):\n", + " yy = x-y**2\n", + " return yy\n", + "y0 = 1\n", + "x = 0\n", + "y = 1\n", + "h = 0.1\n", + "k1 = h*f(x,y)\n", + "k2 = h*f(x+1/2*h,y+1/2*k1)\n", + "k3 = h*f(x+1/2*h,y+1/2*k2)\n", + "k4 = h*f(x+h,y+k3)\n", + "ka = 1/6*(k1+2*k2+2*k3+k4) \n", + "print \"The required approximate value is :− \"\n", + "y1 = y+ka\n", + "y = y+ka\n", + "print y\n", + "print \"To find y(0.4) put x=0.2 y=above value ie 1.196 h=0.2 \"\n", + "x = 0.1\n", + "h = 0.1\n", + "k1 = h*f(x,y)\n", + "k2 = h*f(x+1/2*h,y+1/2*k1)\n", + "k3 = h*f(x+1/2*h,y+1/2*k2)\n", + "k4 = h*f(x+h,y+k3)\n", + "kb = 1/6*(k1+2*k2+2*k3+k4)\n", + "print \"The required approximate value is :− \"\n", + "y2 = y+kb\n", + "y = y+kb\n", + "print y\n", + "print \"To find y(0.4) put x=0.2 y=above value ie 1.196 h=0.2 \"\n", + "x = 0.2\n", + "h = 0.1\n", + "k1 = h*f(x,y)\n", + "k2 = h*f(x+1/2*h,y+1/2*k1)\n", + "k3 = h*f(x+1/2*h,y+1/2*k2)\n", + "k4 = h*f(x+h,y+k3)\n", + "kc = 1/6*(k1+2*k2+2*k3+k4) \n", + "print \"The required approximate value is :− \"\n", + "y3 = y+kc\n", + "y = y+kc\n", + "print y\n", + "f0 = f(0,y0)\n", + "f1 = f(0.1,y1)\n", + "f2 = f(0.2,y2)\n", + "f3 = f(0.3,y3) \n", + "print \"y0 y1 y2 y3 are respectively :\"\n", + "print y3,y2,y1,y0\n", + "print \"f0 f1 f2 f3 are respectively :\"\n", + "print f3,f2,f1,f0\n", + "print \"Using adams method \"\n", + "print \"Using the predictor\"\n", + "h = 0.1\n", + "y4 = y3+h/24*(55*f3-59*f2+37*f1-9*f0)\n", + "x = 0.4\n", + "f4 = f(0.4,y4)\n", + "print \"y4 = \",y4\n", + "print \"Using corrector method \"\n", + "y4 = y3+h/24*(9*f4+19*f3-5*f2+f1) \n", + "print \"y4 = \",y4\n", + "f4 = f(0.4,y4)\n", + "print \"f4 = \",f4" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.18, page no. 708" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Picards method\n", + "First approximation\n", + "y1 = x**2/2 + x + 2\n", + "z1 = x**2/2 - 4*x + 1\n", + "Second approximation\n", + "y2 = x**3/6 - 3*x**2/2 + x + 2\n", + "z2 = -x**5/20 - x**4/4 - x**3 - 3*x**2/2 - 4*x + 1\n", + "Third approximation\n", + "y3 = -x**6/120 - x**5/20 - x**4/4 - x**3/2 - 3*x**2/2 + x + 2\n", + "z3 = -x**7/252 + x**6/12 - 31*x**5/60 + 7*x**4/12 + 5*x**3/3 - 3*x**2/2 - 4*x + 1\n", + "y(0.1) = -0.00833333333333333*x**6 - 0.05*x**5 - 0.25*x**4 - 0.5*x**3 - 1.5*x**2 + x + 2.0\n", + "z(0.1) = -0.00396825396825397*x**7 + 0.0833333333333333*x**6 - 0.516666666666667*x**5 + 0.583333333333333*x**4 + 1.66666666666667*x**3 - 1.5*x**2 - 4.0*x + 1.0\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "print \"Picards method\"\n", + "x0 = 0\n", + "y0 = 2\n", + "z0 = 1\n", + "x = sympy.Symbol('x')\n", + "def f(x,y,z):\n", + " yy = x+z\n", + " return yy\n", + "def g(x,y,z):\n", + " yy = x-y**2\n", + " return yy\n", + "print \"First approximation\"\n", + "y1 = y0+sympy.integrate(f(x,y0,z0),(x,x0,x))\n", + "print \"y1 = \",y1\n", + "z1 = z0+sympy.integrate(g(x,y0,z0),(x,x0,x))\n", + "print \"z1 = \",z1\n", + "print \"Second approximation\"\n", + "y2 = y0+sympy.integrate(f(x,y1,z1),(x,x0,x))\n", + "print \"y2 = \",y2\n", + "z2 = z0+sympy.integrate(g(x,y1,z1),(x,x0,x))\n", + "print \"z2 = \",z2\n", + "print \"Third approximation\"\n", + "y3 = y0+sympy.integrate(f(x,y2,z2),(x,x0,x))\n", + "print \"y3 = \",y3\n", + "z3 = z0+sympy.integrate(g(x,y2,z2),(x,x0,x))\n", + "print \"z3 = \",z3\n", + "x = 0.1\n", + "print \"y(0.1) = \",y3.evalf()\n", + "print \"z(0.1) = \",z3.evalf()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 27.19, page no. 710" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Using k1 k2.. for f and l1 l2... for g runga kutta formula becomes \n", + "y = 1.0\n", + "y1 = 0.0\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "x = sympy.Symbol('x')\n", + "def f(x,y,z):\n", + " yy = z \n", + " return yy\n", + "def g(x,y,z):\n", + " yy = x*y**2-y**2\n", + " return yy\n", + "x0 = 0\n", + "y0 = 1\n", + "z0 = 0\n", + "h = 0.2\n", + "print \"Using k1 k2.. for f and l1 l2... for g runga kutta formula becomes \"\n", + "h = 0.2\n", + "k1 = h*f(x0,y0,z0)\n", + "l1 = h*g(x0,y0,z0)\n", + "k2 = h*f(x0+1/2*h,y0+1/2*k1,z0+1/2*l1)\n", + "l2 = h*g(x0+1/2*h,y0+1/2*k1,z0+1/2*l1)\n", + "k3 = h*f(x0+1/2*h,y0+1/2*k2,z0+1/2*l2)\n", + "l3 = h*g(x0+1/2*h,y0+1/2*k2,z0+1/2*l2)\n", + "k4 = h*f(x0+h,y0+k3,z0+l3)\n", + "l4 = h*g(x0+h,y0+k3,z0+l3)\n", + "k = 1/6*(k1+2*k2+2*k3+k4)\n", + "l = 1/6*(l1+2*l2+2*l3+2*l4)\n", + "x = 0.2\n", + "y = y0+k\n", + "y1 = z0+l\n", + "print \"y = \",y\n", + "print \"y1 = \",y1" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter28.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter28.ipynb new file mode 100644 index 00000000..960db82d --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter28.ipynb @@ -0,0 +1,435 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 28: Numerical Solution Of Partial Differential Equations" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 28.1, page no. 725" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "D=Bˆ2−4AC\n", + "if D<0 then elliptic if D=0 then parabolic if D>0 then hyperboic\n", + "(i) A=xˆ2, B1−yˆ2 D=4ˆ2−4∗1∗4=0 so the equation is PARABOLIC \n", + "(ii) D=4xˆ2(yˆ2−1)\n", + "for −inf<x<inf and −1<y<1 D<0 \n", + "So the equation is ELLIPTIC \n", + "(iii) A=1+xˆ2, B=5+2xˆ2, C=4+xˆ2\n", + "D=9>0\n", + "So the equation is HYPERBOLIC \n" + ] + } + ], + "source": [ + "print \"D=Bˆ2−4AC\"\n", + "print \"if D<0 then elliptic if D=0 then parabolic if D>0 then hyperboic\"\n", + "print \"(i) A=xˆ2, B1−yˆ2 D=4ˆ2−4∗1∗4=0 so the equation is PARABOLIC \"\n", + "print \"(ii) D=4xˆ2(yˆ2−1)\"\n", + "print \"for −inf<x<inf and −1<y<1 D<0 \"\n", + "print \"So the equation is ELLIPTIC \"\n", + "print \"(iii) A=1+xˆ2, B=5+2xˆ2, C=4+xˆ2\"\n", + "print \"D=9>0\"\n", + "print \"So the equation is HYPERBOLIC \"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 28.2, page no. 726" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "See figure in question\n", + "From symmetry u7=u1, u8=u2, u9=u3, u3=u1, u6=u4, u9=u7\n", + "u5=1/4∗(2000+2000+1000+1000)=1500\n", + "u1=1/4(0=1500+1000+2000)=1125\n", + "u2=1/4∗(1125+1125+1000+1500)=1188\n", + "u4=1/4(2000+1500+1125+1125)=1438\n", + "1125 1188 1438 1500\n", + "Iterations :\n", + "\n", + "1301 1414 1164 1031\n", + "\n", + "1250 1337 1087 1019\n", + "\n", + "1199 1312 1062 981\n", + "\n", + "1174 1287 1037 968\n", + "\n", + "1155 1274 1024 956\n", + "\n", + "1144 1265 1015 949\n" + ] + } + ], + "source": [ + "print \"See figure in question\"\n", + "print \"From symmetry u7=u1, u8=u2, u9=u3, u3=u1, u6=u4, u9=u7\"\n", + "print \"u5=1/4∗(2000+2000+1000+1000)=1500\"\n", + "u5 = 1500\n", + "print \"u1=1/4(0=1500+1000+2000)=1125\"\n", + "u1 = 1125\n", + "print \"u2=1/4∗(1125+1125+1000+1500)=1188\"\n", + "u2 = 1188\n", + "print \"u4=1/4(2000+1500+1125+1125)=1438\"\n", + "u4 = 1438\n", + "print u1,u2,u4,u5 \n", + "print \"Iterations :\"\n", + "for i in range(1,7):\n", + " u11 = (1000+u2+500+u4)/4\n", + " u22 = (u11+u1+1000+u5)/4 \n", + " u44 = (2000+u5+u11+u1)/4\n", + " u55 = (u44+u4+u22+u2)/4\n", + " print \"\"\n", + " print u55,u44,u22,u11\n", + " u1 = u11 \n", + " u2 = u22 \n", + " u4 = u44 \n", + " u5 = u55" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 28.3, page no. 727" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "See figure in question\n", + "To find the initial values of u1 u2 u3 u4 we assume u4=0 \n", + "u1=1/4∗(1000+0+1000+2000)=1000\n", + "u2=1/4(1000+500+1000+500)=625 \n", + "u3=1/4∗(2000+0+1000+500)=875\n", + "u4=1/4(875+0+625+0)=375\n", + "1000 625 875 375\n", + "Iterations:\n", + "\n", + "437 1000 750 1125\n", + "\n", + "453 1031 781 1187\n", + "\n", + "457 1039 789 1203\n", + "\n", + "458 1041 791 1207\n", + "\n", + "458 1041 791 1208\n", + "\n", + "458 1041 791 1208\n" + ] + } + ], + "source": [ + "print \"See figure in question\"\n", + "print \"To find the initial values of u1 u2 u3 u4 we assume u4=0 \"\n", + "print \"u1=1/4∗(1000+0+1000+2000)=1000\"\n", + "u1 = 1000\n", + "print \"u2=1/4(1000+500+1000+500)=625 \"\n", + "u2 = 625\n", + "print \"u3=1/4∗(2000+0+1000+500)=875\"\n", + "u3 = 875\n", + "print \"u4=1/4(875+0+625+0)=375\"\n", + "u4 = 375\n", + "print u1,u2,u3,u4 \n", + "print \"Iterations:\"\n", + "for i in range(1,7):\n", + " u11 = (2000+u2+1000+u3)/4 \n", + " u22 = (u11+500+1000+u4)/4\n", + " u33 = (2000+u4+u11+500)/4\n", + " u44 = (u33+0+u22+0)/4\n", + " print \"\"\n", + " print u44,u33,u22,u11\n", + " u1 = u11 \n", + " u2 = u22 \n", + " u4 = u44 \n", + " u3 = u33" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 28.5, page no. 729" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Here cˆ2=4, h=1, k=1/8, therefore alpha=(cˆ2)∗k/(hˆ2)\n", + "Using bendre−schmidits recurrence relation ie u(i)(j +1)=t∗u(i−1)(j)+t∗u(i+1)(j)+(1−2t)∗u(i,j)\n", + "Now since u(0,t)=0=u(8,t) therefore u(0,i)=0 and u(8,j)=0 and u(x,0)=4x−1/2xˆ2 \n", + "0.0\n", + "-4.0\n", + "0.0\n", + "4.0\n", + "8.0\n", + "12.0\n", + "16.0\n" + ] + } + ], + "source": [ + "import numpy\n", + "print \"Here cˆ2=4, h=1, k=1/8, therefore alpha=(cˆ2)∗k/(hˆ2)\"\n", + "print \"Using bendre−schmidits recurrence relation ie u(i)(j +1)=t∗u(i−1)(j)+t∗u(i+1)(j)+(1−2t)∗u(i,j)\"\n", + "print \"Now since u(0,t)=0=u(8,t) therefore u(0,i)=0 and u(8,j)=0 and u(x,0)=4x−1/2xˆ2 \"\n", + "c = 2\n", + "h = 1\n", + "k = 1/8\n", + "t = (c**2)*k/(h**2)\n", + "A = numpy.ones((9,9))\n", + "for i in range(0,9):\n", + " for j in range (0,9):\n", + " A[0,i] = 0\n", + " A[8,i] = 0\n", + " A[i,0] = 4*(i-1)-1/2*(i-1)**2\n", + "for i in range(1,8):\n", + " for j in range(1,7):\n", + " A[i,j] = t*A[i-1,j-1]+t*A[i+1,j-1]+(1-2*t)*A[i-1,j-1]\n", + "for i in range(1,8):\n", + " j = 2\n", + " print A[i,j]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 28.6, page no. 730" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Here cˆ2=1, h=1/3, k=1/36, therefore t=(cˆ2)∗k/(hˆ2)=1/4 \n", + "So bendre−schmidits recurrence relation ie u(i)(j+1)=1/4(u(i−1)(j)+u(i+1)(j)+2u(i,j)\n", + "Now since u(0,t)=0=u(1,t) therefore u(0,i)=0 and u(1,j)=0 and u(x,0)=sin(%pi)x\n", + "-0.433012701892\n", + "0.216506350946\n", + "0.649519052838\n", + "0.433012701892\n", + "-0.216506350946\n", + "-0.649519052838\n", + "-0.433012701892\n" + ] + } + ], + "source": [ + "import numpy,math\n", + "\n", + "print \"Here cˆ2=1, h=1/3, k=1/36, therefore t=(cˆ2)∗k/(hˆ2)=1/4 \"\n", + "print \"So bendre−schmidits recurrence relation ie u(i)(j+1)=1/4(u(i−1)(j)+u(i+1)(j)+2u(i,j)\"\n", + "print \"Now since u(0,t)=0=u(1,t) therefore u(0,i)=0 and u(1,j)=0 and u(x,0)=sin(%pi)x\"\n", + "c = 1.\n", + "h = 1./3\n", + "k = 1./36\n", + "t = (c**2)*k/(h**2)\n", + "A = numpy.ones((9,9))\n", + "for i in range(0,9):\n", + " for j in range(0,9):\n", + " A[0,i] = 0\n", + " A[1,i] = 0\n", + " A[i,0] = math.sin(math.pi/3*(i-1)) \n", + "for i in range(1,8):\n", + " for j in range(1,8):\n", + " A[i,j] = t*A[i-1,j-1]+t*A[i+1,j-1]+(1-2*t)*A[i-1,j-1]\n", + "for i in range(1,8):\n", + " j = 1\n", + " print A[i,j]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 28.7, page no. 732" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Here cˆ2=16, taking h=1, finding k such that cˆ2tˆ2=1 \n", + "So bendre−schmidits recurrence relation ie u(i)(j+1)=(16tˆ2(u(i−1)(j)+u(i+1)(j))+2(1−16∗tˆ2u(i,j)−u(i)(j−1)\n", + "Now since u(0,t)=0=u(5,t) therefore u(0,i)=0 and u(5,j)=0 and u(x,0)=xˆ2(5−x)\n", + "Also from 1st derivative (u(i)(j+1)−u(i,j−1))/2k=g(x) and g(x)=0 in this case\n", + "So if j=0 this gives u(i)(1)=1/2∗(u(i−1)(0)+u(i+1)(0))\n", + " 0.0 0.0 0.0 0.0 0.0 \n", + " 0.0 4.0 8.0 12.0 16.0 \n", + " 0.0 12.0 24.0 36.0 48.0 \n", + " 0.0 18.0 36.0 54.0 72.0 \n", + " 0.0 16.0 0.0 0.0 0.0 \n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "print \"Here cˆ2=16, taking h=1, finding k such that cˆ2tˆ2=1 \"\n", + "print \"So bendre−schmidits recurrence relation ie u(i)(j+1)=(16tˆ2(u(i−1)(j)+u(i+1)(j))+2(1−16∗tˆ2u(i,j)−u(i)(j−1)\"\n", + "print \"Now since u(0,t)=0=u(5,t) therefore u(0,i)=0 and u(5,j)=0 and u(x,0)=xˆ2(5−x)\"\n", + "c = 4\n", + "h =1 \n", + "k = (h/c)\n", + "t = k/h\n", + "A = numpy.zeros((6,6))\n", + "print \"Also from 1st derivative (u(i)(j+1)−u(i,j−1))/2k=g(x) and g(x)=0 in this case\"\n", + "print \"So if j=0 this gives u(i)(1)=1/2∗(u(i−1)(0)+u(i+1)(0))\"\n", + "for i in range(0,6):\n", + " for j in range(1,9):\n", + " A[0,i] = 0\n", + " A[5,i] = 0;\n", + " A[i,1] = (i)**2*(5-i)\n", + "for i in range(0,4):\n", + " A[i+1,2] =1/2*(A[i,1]+A[i+2,1])\n", + "for i in range(2,5):\n", + " for j in range(2,5):\n", + " A[i-1,j] = (c*t)**2*(A[i-2,j-1]+A[i,j-1])+2*(1-(c*t)**2)*A[i-1,j-1]-A[i-1,j-2]\n", + "for i in range(0,5):\n", + " for j in range(0,5):\n", + " print \" \",A[i,j],\n", + " print \"\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 28.8, page no. 734" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Here cˆ2=4, taking h=1, finding k such that cˆ2tˆ2=1 \n", + "So bendre−schmidits recurrence relation ie u(i)(j+1)=(16tˆ2(u(i−1)(j)+u(i+1)(j))+2(1−16∗tˆ2u(i,j)−u(i)(j−1)\n", + "Now since u(0,t)=0=u(4,t) therefore u(0,i)=0 and u(4,j)=0 and u(x,0)=x(4−x) \n", + "Also from 1st derivative (u(i)(j+1)−u(i,j−1))/2 k=g(x) and g(x)=0 in this case\n", + "So if j=0 this gives u(i)(1)=1/2∗(u(i−1)(0)+u(i+1)(0))\n", + " 0.0 0.0 0.0 0.0 0.0 \n", + " 3.0 0.0 -3.0 -6.0 -9.0 \n", + " 4.0 0.0 -4.0 -8.0 -12.0 \n", + " 3.0 0.0 -3.0 -6.0 -9.0 \n", + " 0.0 0.0 0.0 0.0 0.0 \n" + ] + } + ], + "source": [ + "print \"Here cˆ2=4, taking h=1, finding k such that cˆ2tˆ2=1 \"\n", + "print \"So bendre−schmidits recurrence relation ie u(i)(j+1)=(16tˆ2(u(i−1)(j)+u(i+1)(j))+2(1−16∗tˆ2u(i,j)−u(i)(j−1)\"\n", + "print \"Now since u(0,t)=0=u(4,t) therefore u(0,i)=0 and u(4,j)=0 and u(x,0)=x(4−x) \"\n", + "c = 2\n", + "h = 1\n", + "k = (h/c)\n", + "t = k/h\n", + "A = numpy.zeros((6,6))\n", + "print \"Also from 1st derivative (u(i)(j+1)−u(i,j−1))/2 k=g(x) and g(x)=0 in this case\"\n", + "print \"So if j=0 this gives u(i)(1)=1/2∗(u(i−1)(0)+u(i+1)(0))\"\n", + "for i in range(0,6):\n", + " for j in range(1,9):\n", + " A[0,i] = 0\n", + " A[4,i] = 0\n", + " A[i,0] = (i)*(4-i)\n", + "for i in range(0,4):\n", + " A[i+1,2] = 1/2*(A[i,1]+A[i+2,1])\n", + "for i in range(2,5):\n", + " for j in range(2,5):\n", + " A[i-1,j] = (c*t)**2*(A[i-2,j-1]+A[i,j-1])+2*(1-(c*t)**2)*A[i-1,j-1]-A[i-1,j-2]\n", + "for i in range (0,5):\n", + " for j in range(0,5):\n", + " print \" \",A[i,j],\n", + " print \"\"" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter34.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter34.ipynb new file mode 100644 index 00000000..36e4482a --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter34.ipynb @@ -0,0 +1,1413 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 34 : Probability And Distributions" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.1, page no. 830" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From the principle of counting, the required no. of ways are 12∗11∗10∗9= \n", + "11880\n" + ] + } + ], + "source": [ + "print \"From the principle of counting, the required no. of ways are 12∗11∗10∗9= \"\n", + "print 12*11*10*9" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.2.1, page no. 831" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "no. of permutations=9!/(2!∗2!∗2!)\n", + "45360\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "print \"no. of permutations=9!/(2!∗2!∗2!)\"\n", + "print math.factorial(9)/(math.factorial(2)*math.factorial(2)*math.factorial(2))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.2.2, page no. 831" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "no. of permutations=9!/(2!∗2!∗3!*3!)\n", + "2520\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "print \"no. of permutations=9!/(2!∗2!∗3!*3!)\"\n", + "print math.factorial(9)/(math.factorial(2)*math.factorial(2)*math.factorial(3)*math.factorial(3))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.3.1, page no. 832" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "no. of committees=C(6,3)∗C(5,2)=’\n", + "200\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "def C(a,b):\n", + " x = math.factorial(a)/(math.factorial(b)*math.factorial(a-b))\n", + " return x\n", + "print \"no. of committees=C(6,3)∗C(5,2)=’\"\n", + "print C(6,3)*C(5,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.3.2, page no. 832" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "no. of committees=C(4,1)∗C(5,2)=’\n", + "40\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "def C(a,b):\n", + " x = math.factorial(a)/(math.factorial(b)*math.factorial(a-b))\n", + " return x\n", + "print \"no. of committees=C(4,1)∗C(5,2)=’\"\n", + "print C(4,1)*C(5,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.3.3, page no. 833" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "no. of committees=C(6,3)∗C(4,2)=’\n", + "120\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "def C(a,b):\n", + " x = math.factorial(a)/(math.factorial(b)*math.factorial(a-b))\n", + " return x\n", + "print \"no. of committees=C(6,3)∗C(4,2)=’\"\n", + "print C(6,3)*C(4,2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.4.1, page no. 834" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The probability of getting a four is 1/6= 0.166666666667\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "print \"The probability of getting a four is 1/6= \",1./6" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.4.2, page no. 834" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The probability of getting an even no. 1/2= 0.5\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "print \"The probability of getting an even no. 1/2= \",1./2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.5, page no. 835" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The probability of 53 Sundays is 2/7= 0.285714285714\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "print \"The probability of 53 Sundays is 2/7= \",2./7" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.6, page no. 835" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The five digits can be arranged in 5! ways = 120\n", + "Of which 4! will begin with 0 = 24\n", + "So, total no. of five digit numbers = 5!−4! = 96\n", + "The numbers ending in 04, 12, 20, 24, 32, 40 will be divisible by 4 \n", + "numbers ending in 04 = 3! = 6\n", + "numbers ending in 12 = 3!−2! = 4\n", + "numbers ending in 20 = 3! = 6\n", + "numbers ending in 24 = 3!−2! = 4\n", + "numbers ending in 32 = 3!−2! = 4\n", + "numbers ending in 40 = 3! = 6\n", + "So, total no. of favourable ways = 6+4+6+4+4+6 = 30\n", + "probability = 30/96 = 0.3125\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "print \"The five digits can be arranged in 5! ways = \",math.factorial(5)\n", + "print \"Of which 4! will begin with 0 = \",math.factorial(4)\n", + "print \"So, total no. of five digit numbers = 5!−4! = \",math.factorial(5)-math.factorial(4)\n", + "print \"The numbers ending in 04, 12, 20, 24, 32, 40 will be divisible by 4 \"\n", + "print \"numbers ending in 04 = 3! = \",math.factorial(3)\n", + "print \"numbers ending in 12 = 3!−2! = \",math.factorial(3)-math.factorial(2)\n", + "print \"numbers ending in 20 = 3! = \",math.factorial(3)\n", + "print \"numbers ending in 24 = 3!−2! = \",math.factorial(3)-math.factorial(2)\n", + "print \"numbers ending in 32 = 3!−2! = \",math.factorial(3)-math.factorial(2)\n", + "print \"numbers ending in 40 = 3! = \",math.factorial(3)\n", + "print \"So, total no. of favourable ways = 6+4+6+4+4+6 = \",6+4+6+4+4+6\n", + "print \"probability = 30/96 = \",30./96" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.7, page no. 836" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total no. of possible cases = C(40,4) = 91390\n", + "Favourable outcomes = C(24,2)∗C(15,1) = 4140\n", + "Probability = 0.0453003610898\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "def C(a,b):\n", + " x = math.factorial(a)/(math.factorial(b)*math.factorial(a-b))\n", + " return x\n", + "print \"Total no. of possible cases = C(40,4) = \",C(40,4)\n", + "print \"Favourable outcomes = C(24,2)∗C(15,1) = \",C(24,2)*C(15,1)\n", + "print \"Probability = \",float(C(24,2)*C(15,1))/C(40,4)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.8, page no. 836" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total no. of possible cases = C(15,8) = 6435\n", + "Favourable outcomes = C(5,2)∗C(10,6) = 2100\n", + "Probability = 0.32634032634\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "def C(a,b):\n", + " x = math.factorial(a)/(math.factorial(b)*math.factorial(a-b))\n", + " return x\n", + "print \"Total no. of possible cases = C(15,8) = \",C(15,8)\n", + "print \"Favourable outcomes = C(5,2)∗C(10,6) = \",C(5,2)*C(10,6)\n", + "print \"Probability = \",float(C(5,2)*C(10,6))/C(15,8)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.9.1, page no. 837" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total no. of possible cases = C(9,3) = 84\n", + "Favourable outcomes = C(2,1)∗C(3,1)*C(4,1) = 24\n", + "Probability = 0.285714285714\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "def C(a,b):\n", + " x = math.factorial(a)/(math.factorial(b)*math.factorial(a-b))\n", + " return x\n", + "print \"Total no. of possible cases = C(9,3) = \",C(9,3)\n", + "print \"Favourable outcomes = C(2,1)∗C(3,1)*C(4,1) = \",C(2,1)*C(3,1)*C(4,1)\n", + "print \"Probability = \",float(C(2,1)*C(3,1)*C(4,1))/C(9,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.9.2, page no. 837" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total no. of possible cases = C(9,3) = 84\n", + "Favourable outcomes = C(2,2)∗C(7,1)+C(3,2)∗C(6,1)+C(4,2)∗C(5,1) = 55\n", + "Probability = 0.654761904762\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "\n", + "def C(a,b):\n", + " x = math.factorial(a)/(math.factorial(b)*math.factorial(a-b))\n", + " return x\n", + "print \"Total no. of possible cases = C(9,3) = \",C(9,3)\n", + "print \"Favourable outcomes = C(2,2)∗C(7,1)+C(3,2)∗C(6,1)+C(4,2)∗C(5,1) = \",C(2,2)*C(7,1)+C(3,2)*C(6,1)+C(4,2)*C(5,1)\n", + "print \"Probability = \",float(C(2,2)*C(7,1)+C(3,2)*C(6,1)+C(4,2)*C(5,1))/C(9,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.9.3, page no. 838" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total no. of possible cases = C(9,3) = 84\n", + "Favourable outcomes = C(3,3)+C(4,3) = 5\n", + "Probability = 0.0595238095238\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "def C(a,b):\n", + " x = math.factorial(a)/(math.factorial(b)*math.factorial(a-b))\n", + " return x\n", + "print \"Total no. of possible cases = C(9,3) = \",C(9,3)\n", + "print \"Favourable outcomes = C(3,3)+C(4,3) = \",C(3,3)+C(4,3)\n", + "print \"Probability = \",5./84" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.13, page no. 840" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability of drawing an ace or spade or both from pack of 52 cards = 4/52+13/52−1/52= 17\n" + ] + } + ], + "source": [ + "print \"Probability of drawing an ace or spade or both from pack of 52 cards = 4/52+13/52−1/52= \",4+13-1/52" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.14.1, page no. 841" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability of first card being a king = 4/52 = 0.0769230769231\n", + "Probability of second card being a queen = 4/52 = 0.0769230769231\n", + "Probability of drawing both cards in succession = 4/52∗4/52= 0.00591715976331\n" + ] + } + ], + "source": [ + "print \"Probability of first card being a king = 4/52 = \",4./52\n", + "print \"Probability of second card being a queen = 4/52 = \",4./52\n", + "print \"Probability of drawing both cards in succession = 4/52∗4/52= \",(4./52)*(4./52)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.15.1, page no. 842" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability of getting 7 in first toss and not getting it in second toss = 1/6∗5/6 = 0.138888888889\n", + "Probability of not getting 7 in first toss and getting it in second toss = 5/6∗1/6 = 0.138888888889\n", + "Required probability = 1/6∗5/6+5/6∗1/6 = 0.277777777778\n" + ] + } + ], + "source": [ + "print \"Probability of getting 7 in first toss and not getting it in second toss = 1/6∗5/6 = \",(1./6)*(5./6)\n", + "print \"Probability of not getting 7 in first toss and getting it in second toss = 5/6∗1/6 = \",(5./6)*(1./6)\n", + "print \"Required probability = 1/6∗5/6+5/6∗1/6 = \",((1./6)*(5./6))+((5./6)*(1./6))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.15.2, page no. 842" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability of not getting 7 in either toss = 5/6∗5/6 = 0.694444444444\n", + "Probability of getting 7 at least once = 1−5/6∗5/6 = 0.305555555556\n" + ] + } + ], + "source": [ + "print \"Probability of not getting 7 in either toss = 5/6∗5/6 = \",(5./6)*(5./6)\n", + "print \"Probability of getting 7 at least once = 1−5/6∗5/6 = \",1-(5./6)*(5./6)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.15.3, page no. 842" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability of getting 7 twice = 1/6∗1/6 = 0.0277777777778\n" + ] + } + ], + "source": [ + "print \"Probability of getting 7 twice = 1/6∗1/6 = \",(1./6)*(1./6)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.16, page no. 843" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability of engineering subject being choosen = (1/3∗3/8)+(2/3∗5/8) = 0.541666666667\n" + ] + } + ], + "source": [ + "print \"Probability of engineering subject being choosen = (1/3∗3/8)+(2/3∗5/8) = \",((1./3)*(3./8)) +((2./3)*(5./8))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.17, page no. 844" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability of white ball being choosen = 2/6∗6/13+4/6∗5/13 = 0.410256410256\n" + ] + } + ], + "source": [ + "print \"Probability of white ball being choosen = 2/6∗6/13+4/6∗5/13 = \",((2./6)*(6./13))+((4./6)*(5./13))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.18, page no. 844" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Chances of winning of A=1/2+(1/2)ˆ2∗(1/2)+(1/2)ˆ4∗(1/2)+(1/2)ˆ6∗(1/2)+..= 0.666666666667\n", + "Chances of winning of B=1−chances of winning of A = 1\n" + ] + } + ], + "source": [ + "print \"Chances of winning of A=1/2+(1/2)ˆ2∗(1/2)+(1/2)ˆ4∗(1/2)+(1/2)ˆ6∗(1/2)+..= \",(1./2)/(1-(1./2)**2)\n", + "print \"Chances of winning of B=1−chances of winning of A = \",1-(2/3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.19.1, page no. 845" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total no. of possible outcomes = C(10,2) = 45\n", + "Favourable outcomes = 5*5 = 25\n", + "P = 0.555555555556\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "def C(a,b):\n", + " x = math.factorial(a)/(math.factorial(b)*math.factorial(a-b))\n", + " return x\n", + "print \"Total no. of possible outcomes = C(10,2) = \",C(10,2)\n", + "print \"Favourable outcomes = 5*5 = \",5*5\n", + "print \"P = \",25./45" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.19.2, page no. 845" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total no. of possible outcomes = 10*10 = 100\n", + "Favourable outcomes = 5*5+5*5 = 50\n", + "P = 0.5\n" + ] + } + ], + "source": [ + "print \"Total no. of possible outcomes = 10*10 = \",10*10\n", + "print \"Favourable outcomes = 5*5+5*5 = \",5*5+5*5\n", + "print \"P = \",50./100" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.20, page no. 846" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability of A/B = AandB/B = 0.25\n", + "Probability of B/A = AandB/A = 0.333333333333\n", + "Probability of AandBnot = A−AandB = 0.166666666667\n", + "Probability of A/Bnot = AandBnot/Bnot = 0.25\n" + ] + } + ], + "source": [ + "A = 1./4\n", + "B = 1./3\n", + "AorB = 1./2\n", + "AandB = A+B-AorB\n", + "print \"Probability of A/B = AandB/B = \",AandB/B\n", + "print \"Probability of B/A = AandB/A = \",AandB/A\n", + "print \"Probability of AandBnot = A−AandB = \",A-AandB\n", + "print \"Probability of A/Bnot = AandBnot/Bnot = \",(1./6)/(1-1./3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.22, page no. 846" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability of A hitting target = 3/5\n", + "Probability of B hitting target = 2/5\n", + "Probability of C hitting target = 3/4\n", + "Probability that two shots hit = 3/5∗2/5∗(1−3/4)+2/5∗3/4∗(1−3/5)+3/4∗3/5∗(1−2/5) = \n", + "0.45\n" + ] + } + ], + "source": [ + "print \"Probability of A hitting target = 3/5\"\n", + "print \"Probability of B hitting target = 2/5\"\n", + "print \"Probability of C hitting target = 3/4\"\n", + "print \"Probability that two shots hit = 3/5∗2/5∗(1−3/4)+2/5∗3/4∗(1−3/5)+3/4∗3/5∗(1−2/5) = \"\n", + "print (3./5)*(2./5)*(1-3./4)+(2./5)*(3./4)*(1-3./5)+(3./4)*(3./5)*(1-2./5)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.23, page no. 847" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability of problem not getting solved = 1/2∗2/3∗3/4 = 0.25\n", + "Probability of problem getting solved = 1−(1/2∗2/3∗3/4) = 0.75\n" + ] + } + ], + "source": [ + "print \"Probability of problem not getting solved = 1/2∗2/3∗3/4 = \",(1./2)*(2./3)*(3./4)\n", + "print \"Probability of problem getting solved = 1−(1/2∗2/3∗3/4) = \",1-((1./2)*(2./3)*(3./4))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.25, page no. 848" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total frequency=integrate(f,x,0,2) =\n", + "u1 about origin = 1\n", + "u2 about origin = 16/15\n", + "Standard deviation = (u2−u1ˆ2)ˆ0.5= 0.258198889747161\n", + "Mean deviation about the mean = (1/n)∗(integrate(|x−1|∗(xˆ3),x,0,1)+integrate(|x−1|∗((2−x)ˆ3),x,1,2))\n", + "1/5\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "print \"Total frequency=integrate(f,x,0,2) =\" \n", + "n = sympy.integrate('x**3',('x',0,1))+sympy.integrate('(2-x)**3',('x',1,2))\n", + "print \"u1 about origin = \",\n", + "u1 = (1/n)*(sympy.integrate('(x)*(x**3)',('x',0,1))+sympy.integrate('(x)*((2-x)**3)',('x',1,2)))\n", + "print u1\n", + "print \"u2 about origin = \",\n", + "u2 = (1/n)*(sympy.integrate('(x**2)*(x**3)',('x',0,1))+sympy.integrate('(x**2)*((2-x)**3)',('x',1,2)))\n", + "print u2\n", + "print \"Standard deviation = (u2−u1ˆ2)ˆ0.5= \",(u2-u1**2)**0.5\n", + "print \"Mean deviation about the mean = (1/n)∗(integrate(|x−1|∗(xˆ3),x,0,1)+integrate(|x−1|∗((2−x)ˆ3),x,1,2))\"\n", + "print (1/n)*(sympy.integrate('(1-x)*(x**3)',('x',0,1))+sympy.integrate('(x-1)*((2-x)**3)',('x',1,2)))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.26, page no. 849" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability = (0.45∗0.03)/(0.45∗0.03+0.25∗0.05+0.3∗0.04 = 0.355263157895\n" + ] + } + ], + "source": [ + "print \"Probability = (0.45∗0.03)/(0.45∗0.03+0.25∗0.05+0.3∗0.04 = \",(0.45*0.03)/(0.45*0.03+0.25*0.05+0.3*0.04)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.27, page no. 849" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability = (1/3∗2/6∗3/5)/(1/3∗2/6∗3/5+1/3∗1/6∗2/5+1/3∗3/6∗1/5) = 1.05555555556\n" + ] + } + ], + "source": [ + "print \"Probability = (1/3∗2/6∗3/5)/(1/3∗2/6∗3/5+1/3∗1/6∗2/5+1/3∗3/6∗1/5) = \",\n", + "print ((1./3)*(2./6)*(3./5))/((1./3)*(2./6)*(3./5))+((1./3)*(1./6)*(2./5))+((1./3)*(3./6)*(1./5))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.28, page no. 850" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability of no success = 8/27 \n", + "Probability of a success = 1/3 \n", + "Probability of one success = 4/9\n", + "Probability of two success = 2/9\n", + "Probability of three success = 2/9\n", + "mean=sum of i∗pi = 1.0\n", + "sum of i∗piˆ2 = 1.66666666667\n", + "variance = (sum of i∗piˆ2)−1= 0.666666666667\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "print \"Probability of no success = 8/27 \"\n", + "print \"Probability of a success = 1/3 \"\n", + "print \"Probability of one success = 4/9\"\n", + "print \"Probability of two success = 2/9\"\n", + "print \"Probability of three success = 2/9\"\n", + "A = numpy.array([[0,1,2,3],[8./27,4./9,2./9,1./27]])\n", + "print \"mean=sum of i∗pi = \",\n", + "print A[0,0]*A[1,0]+A[0,1]*A[1,1]+A[0,3]*A[1,3]+A[0,2]*A[1,2]\n", + "print \"sum of i∗piˆ2 = \",\n", + "print A[0,0]**2*A[1,0]+A[0,1]**2*A[1,1]+A[0,3]**2*A[1,3]+A[0,2]**2*A[1,2]\n", + "print \"variance = (sum of i∗piˆ2)−1= \",\n", + "print A[0,0]**2*A[1,0]+A[0,1]**2*A[1,1]+A[0,3]**2*A[1,3]+A[0,2]**2*A[1,2]-1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.29, page no. 851" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Sumof all pi = 1 \n", + "Hence ,\n", + "p(x<4) = 16.0*k\n", + "p(x>=5) = 24.0*k\n", + "p(3<x<=6) = 33.0*k\n", + "p(x<=2) = 9.0*k\n" + ] + } + ], + "source": [ + "import sympy,numpy\n", + "\n", + "k = sympy.Symbol('k')\n", + "A =numpy.array([[0,1,2,3,4,5,6],[k,3*k,5*k,7*k,9*k,11*k,13*k]])\n", + "print \"Sumof all pi = 1 \"\n", + "print \"Hence ,\"\n", + "k = 1./49\n", + "print \"p(x<4) = \",\n", + "a = A[1,0]+A[1,1]+A[1,3]+A[1,2]\n", + "print a.evalf()\n", + "print \"p(x>=5) = \",\n", + "b = A[1,5]+A[1,6]\n", + "print b.evalf()\n", + "print \"p(3<x<=6) = \",\n", + "c = A[1,4]+A[1,5]+A[1,6]\n", + "print c.evalf()\n", + "print \"p(x<=2) = \",\n", + "e = A[1,0]+A[1,1]+A[1,2]\n", + "print e.evalf()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.30, page no. 853" + ] + }, + { + "cell_type": "code", + "execution_count": 57, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Sum of all pi = 1\n", + "Hence,\n", + "p(x<6) = 2.0*k**2 + 10.0*k\n", + "p(x>=6) = 9.0*k**2 + k\n", + "p(3<x<5) = 8.0*k\n" + ] + } + ], + "source": [ + "import sympy,numpy,math\n", + "\n", + "k = sympy.Symbol('k')\n", + "A =numpy.array([[0,1,2,3,4,5,6,7],[0,k,2*k,2*k,3*k,k**2,2*k**2,7*k**2+ k]])\n", + "print \"Sum of all pi = 1\"\n", + "print \"Hence,\"\n", + "k = 1./10\n", + "print \"p(x<6) = \",\n", + "a = A[1,0]+A[1,1]+A[1,3]+A[1,2]+ A[1,3]+A[1,4]+A[1,6]\n", + "print a.evalf()\n", + "print \"p(x>=6) = \",\n", + "b = A[1,6]+A[1,7]\n", + "print b.evalf()\n", + "print \"p(3<x<5) = \",\n", + "c = A[1,1]+A[1,2]+A[1,3]+A[1,4]\n", + "print c.evalf()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.31, page no. 853" + ] + }, + { + "cell_type": "code", + "execution_count": 62, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Clearly, f>0 for every x in (1,2) and integrate(f,x,0,numpy.inf)= 1.00000000000000\n", + "Required probability=p(1<=x<=2)= integrate(f,x,1,2) = 0.232544157934830\n", + "Cumulative probability function f(2)=integrate(f,x,−%inf,2) = 0.864664716763387\n" + ] + } + ], + "source": [ + "import sympy,numpy,math\n", + "y = sympy.Symbol('y')\n", + "f = math.e**(-y)\n", + "print \"Clearly, f>0 for every x in (1,2) and integrate(f,x,0,numpy.inf)= \",\n", + "print sympy.integrate(math.e**(-y),('y',0,sympy.oo))\n", + "print \"Required probability=p(1<=x<=2)= integrate(f,x,1,2) = \",\n", + "print sympy.integrate(math.e**(-y),('y',1,2))\n", + "print \"Cumulative probability function f(2)=integrate(f,x,−%inf,2) = \",\n", + "print sympy.integrate(math.e**(-y),('y',0,2))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.33, page no. 854" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total probability = integrate(f,x,0,6)=\n", + "2*k\n", + "4*k\n", + "2*k\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "k = sympy.Symbol('k')\n", + "print \"Total probability = integrate(f,x,0,6)=\"\n", + "p = sympy.integrate('k*x',('x',0,2))\n", + "q = sympy.integrate('2*k',('x',2,4))\n", + "r = sympy.integrate('-k*x+6*k',('x',4,6))\n", + "print p\n", + "print q\n", + "print r" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 34.34, page no. 854" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "First row of A displays the value of x\n", + "The second row of x displays the probability of corresponding to x\n", + "E(x) = 5.5\n", + "E(x)ˆ2 = 46.5\n", + "E(2∗x+1)^2=E(4∗xˆ2+4∗x+1) = 209.0\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.array([[-3.,6.,9.],[1./6,1./2,1./3]])\n", + "print \"First row of A displays the value of x\"\n", + "print \"The second row of x displays the probability of corresponding to x\"\n", + "print \"E(x) = \",\n", + "c = A[0,0]*A[1,0]+A[0,1]*A[1,1]+A[0,2]*A[1,2]\n", + "print c\n", + "print \"E(x)ˆ2 = \",\n", + "b = A[0,0]**2*A[1,0]+A[0,1]**2*A[1,1]+A[0,2]**2*A[1,2]\n", + "print b\n", + "print \"E(2∗x+1)^2=E(4∗xˆ2+4∗x+1) = \",4*b+4*c+1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.35, page no. 855" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total frequency=integrate(f,x,0,2)= \n", + "u1 about origin = \n", + "u2 about origin = \n", + "standard deviation = (u2−u1ˆ2)ˆ0.5 = 0.258198889747161\n", + "Mean deviation about the mean = (1/n)∗(integrate|x−1|∗(xˆ3),x,0,1)+integrate(|x−1|∗((2−x)ˆ3),x,1,2))\n", + "1/5\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "print \"Total frequency=integrate(f,x,0,2)= \"\n", + "n = sympy.integrate('x**3',('x',0,1))+sympy.integrate('(2-x)**3',('x',1,2))\n", + "print \"u1 about origin = \"\n", + "u1 = (1/n)*(sympy.integrate('(x)*(x**3)',('x',0,1))+sympy.integrate('(x)*((2-x)**3)',('x',1,2)))\n", + "print \"u2 about origin = \"\n", + "u2 = (1/n)*(sympy.integrate('(x**2)*(x**3)',('x',0,1))+sympy.integrate('(x**2)*((2-x)**3)',('x',1,2)))\n", + "print \"standard deviation = (u2−u1ˆ2)ˆ0.5 = \",(u2-u1**2)**0.5\n", + "print \"Mean deviation about the mean = (1/n)∗(integrate|x−1|∗(xˆ3),x,0,1)+integrate(|x−1|∗((2−x)ˆ3),x,1,2))\"\n", + "print (1/n)*(sympy.integrate('(1-x)*(x**3)',('x',0,1))+sympy.integrate('(x-1)*((2-x)**3)',('x',1,2)))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.38, page no. 857" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " Probability that exactly two will be defective = C(12,2)∗(0.1)ˆ2∗(0.9)ˆ10 = 0.230127770466\n", + "Probability that at least two will be defective = 1−(C(12,0)∗(0.9)ˆ12+C(12,1)∗(0.1)∗(0.9)ˆ11) = 0.340997748211\n", + "The probability that none will be defective = C(12,12)∗(0.9)ˆ12 = 0.282429536481\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "def C(a,b):\n", + " x = math.factorial(a)/(math.factorial(b)*math.factorial(a-b))\n", + " return x\n", + "print \"Probability that exactly two will be defective = C(12,2)∗(0.1)ˆ2∗(0.9)ˆ10 = \",C(12,2)*(0.1)**2*(0.9)**10\n", + "print \"Probability that at least two will be defective = 1−(C(12,0)∗(0.9)ˆ12+C(12,1)∗(0.1)∗(0.9)ˆ11) = \",\n", + "print 1-(C(12,0)*(0.9)**12+C(12,1)*(0.1)*(0.9)**11)\n", + "print \"The probability that none will be defective = C(12,12)∗(0.9)ˆ12 = \",C(12,12)*(0.9)**12" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.39, page no. 858" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability of 8 heads and 4 tail sin 12 trials = p(8) = C(12,8)∗(1/2)ˆ8∗(1/2)ˆ4= 0.120849609375\n", + "The expected no. of such cases in 256 sets = 256∗p(8) = 30.9375\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "def C(a,b):\n", + " x = math.factorial(a)/(math.factorial(b)*math.factorial(a-b))\n", + " return x\n", + "print \"Probability of 8 heads and 4 tail sin 12 trials = p(8) = C(12,8)∗(1/2)ˆ8∗(1/2)ˆ4= \",C(12.,8.)*(1./2)**8*(1./2)**4\n", + "print \"The expected no. of such cases in 256 sets = 256∗p(8) = \",256*(495./4096)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.40, page no. 859" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Probability of a defective part = 2/20 =0.1 \n", + "Probability of a non defective part = 0.9 \n", + "Probabaility of atleast three defectives in a sample = 0.323073194811\n", + "No. of sample shaving three defective parts = 1000∗0.323 = 323.0\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "def C(a,b):\n", + " x = math.factorial(a)/(math.factorial(b)*math.factorial(a-b))\n", + " return x\n", + "print \"Probability of a defective part = 2/20 =0.1 \"\n", + "print \"Probability of a non defective part = 0.9 \"\n", + "print \"Probabaility of atleast three defectives in a sample = \",\n", + "print 1-(C(20.,0.)*(0.9)**20+C(20.,1.)*(0.1)*(0.9)**19+C(20.,2.)*(0.1)**2*(0.9)**18)\n", + "print \"No. of sample shaving three defective parts = 1000∗0.323 = \",1000*0.323" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter35.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter35.ipynb new file mode 100644 index 00000000..5ca46e4e --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter35.ipynb @@ -0,0 +1,536 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 35 : Sampling And Inference" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 35.1, page no. 864" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Suppose the coin is unbiased\n", + "Then probability of getting the head in a toss = 1/2 \n", + "Then, expected no. of successes = a = 1/2∗400\n", + "Observed no. of successes = 216\n", + "The excess of observed value over expected value = 216\n", + "S. D. of simple sampling = (n∗p∗q)ˆ0.5 = c \n", + "Hence, z = (b−a)/c = 21.6\n", + "As z<1.96, the hypothesis is accepted at 5% level of significance\n" + ] + } + ], + "source": [ + "print \"Suppose the coin is unbiased\"\n", + "print \"Then probability of getting the head in a toss = 1/2 \"\n", + "print \"Then, expected no. of successes = a = 1/2∗400\"\n", + "a = 1/2*400\n", + "print \"Observed no. of successes = 216\"\n", + "b = 216\n", + "print \"The excess of observed value over expected value = \",b-a\n", + "print \"S. D. of simple sampling = (n∗p∗q)ˆ0.5 = c \"\n", + "c = (400*0.5*0.5)**0.5\n", + "print \"Hence, z = (b−a)/c = \",(b-a)/c\n", + "print \"As z<1.96, the hypothesis is accepted at 5% level of significance\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 35.2, page no. 865" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Suppose the die is unbiased \n", + "Then probability of getting 5 or 6 with one die=1/3 \n", + "Then, expected no. of successes = a = 1/3∗9000 \n", + "Observed no. of successes = 3240\n", + "The excess of observed value over expected value = 240.0\n", + "S. D. of simple sampling = (n∗p∗q)ˆ0.5=c\n", + "Hence, z = (b−a)/c = 5.366563146\n", + "As z>2.58, the hypothesis has to be rejected at 1% level of significance\n" + ] + } + ], + "source": [ + "print \"Suppose the die is unbiased \"\n", + "print \"Then probability of getting 5 or 6 with one die=1/3 \"\n", + "print \"Then, expected no. of successes = a = 1/3∗9000 \"\n", + "a = 1./3*9000\n", + "print \"Observed no. of successes = 3240\"\n", + "b = 3240\n", + "print \"The excess of observed value over expected value = \",b-a\n", + "print \"S. D. of simple sampling = (n∗p∗q)ˆ0.5=c\"\n", + "c = (9000*(1./3)*(2./3))**0.5\n", + "print \"Hence, z = (b−a)/c = \",(b-a)/c\n", + "print \"As z>2.58, the hypothesis has to be rejected at 1% level of significance\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 35.3, page no. 865" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "q = 1−p \n", + "Standard error of the population of families having a monthly income of rs. 250 or less=(p∗q/n)ˆ0.5 = 0.0148442858929\n", + "Hence taking 103/420 to be the estimate of families having a monthly income of rs. 250 or less, the limits are 20% and 29% approximately\n" + ] + } + ], + "source": [ + "p = 206./840\n", + "print \"q = 1−p \"\n", + "q = 1-p\n", + "n = 840\n", + "print \"Standard error of the population of families having a monthly income of rs. 250 or less=(p∗q/n)ˆ0.5 = \",(p*q/n)**0.5\n", + "print \"Hence taking 103/420 to be the estimate of families having a monthly income of rs. 250 or less, the limits are 20% and 29% approximately\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 35.4, page no. 866" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "p=(n1∗p1+n2∗p2)/(n1+n2)\n", + "0.1904\n", + "q = 1−p \n", + "0.8096\n", + "e=(p∗q∗(1/n1+1/n2))ˆ0.5\n", + "0.0163590274093\n", + "z = 0.916924926202\n", + "As z<1, the difference between the proportions is not significant. \n" + ] + } + ], + "source": [ + "n1 = 900\n", + "n2 = 1600\n", + "p1 = 20./100\n", + "p2 = 18.5/100\n", + "print \"p=(n1∗p1+n2∗p2)/(n1+n2)\"\n", + "p = (n1*p1+n2*p2)/(n1+n2)\n", + "print p\n", + "print \"q = 1−p \"\n", + "q = 1-p\n", + "print q\n", + "print \"e=(p∗q∗(1/n1+1/n2))ˆ0.5\"\n", + "e = (p*q*((1./n1)+(1./n2)))**0.5\n", + "print e\n", + "z = (p1-p2)/e\n", + "print \"z = \",z\n", + "print \"As z<1, the difference between the proportions is not significant. \"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 35.5, page no. 867" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "q1 = 1−p1 \n", + "q2=1−p2\n", + "e=((p1∗q1/n1)+(p2*q2/n2))ˆ0.5\n", + "Hence, it is likely that real difference will be hidden.\n" + ] + } + ], + "source": [ + "p1 = 0.3\n", + "p2 = 0.25\n", + "print \"q1 = 1−p1 \"\n", + "q1 = 1-p1\n", + "print \"q2=1−p2\"\n", + "q2 = 1-p2\n", + "n1 = 1200\n", + "n2 = 900\n", + "print \"e=((p1∗q1/n1)+(p2*q2/n2))ˆ0.5\"\n", + "e = ((p1*q1/n1)+(p2*q2/n2))**0.5\n", + "z = (p1-p2)/e\n", + "print \"Hence, it is likely that real difference will be hidden.\" " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 35.6, page no. 868" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "m and n represents mean and number of objects in sample respectively \n", + "z=(m−M)/(d/(nˆ0.5)\n", + "z = 2.7950310559\n", + "As z>1.96, it cannot be regarded as a random sample\n" + ] + } + ], + "source": [ + "print \"m and n represents mean and number of objects in sample respectively \"\n", + "m = 3.4\n", + "n = 900.\n", + "M = 3.25\n", + "d = 1.61\n", + "print \"z=(m−M)/(d/(nˆ0.5)\"\n", + "z = (m-M)/(d/(n**0.5))\n", + "print \"z = \",z\n", + "print \"As z>1.96, it cannot be regarded as a random sample\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 35.9, page no. 871" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "m1 and n1 represents mean and no. of objects in sample 1\n", + "m2 and n2 represents mean and no. of objects in sample 2\n", + "On the hypothesis that the samples are drawn from the same population of d = 2.5, we get\n", + "z = -5.16397779494\n", + "Since |z|>1.96, thus samples cannot be regarded as drawn from the same population\n" + ] + } + ], + "source": [ + "print \"m1 and n1 represents mean and no. of objects in sample 1\"\n", + "print \"m2 and n2 represents mean and no. of objects in sample 2\"\n", + "m1 = 67.5\n", + "m2 = 68.\n", + "n1 = 1000.\n", + "n2 = 2000.\n", + "d = 2.5\n", + "print \"On the hypothesis that the samples are drawn from the same population of d = 2.5, we get\"\n", + "z = (m1-m2)/(d*((1/n1)+(1/n2))**0.5)\n", + "print \"z = \",z\n", + "print \"Since |z|>1.96, thus samples cannot be regarded as drawn from the same population\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 35.10, page no. 872" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "m1, d1 and n1 denotes mean, deviation and no.of objects in first sample \n", + "m2, d2 and n2 denotes mean, deviation and no.of objects in second sample\n", + "S. E. of the difference of the mean heights is 0.0703246933872\n", + "-0.7\n", + "|m1−m2|>10e, this is highly significant. hence, the data indicates that the sailors are on the average taller than the soldiers.\n" + ] + } + ], + "source": [ + "print \"m1, d1 and n1 denotes mean, deviation and no.of objects in first sample \"\n", + "m1 = 67.85\n", + "d1 = 2.56\n", + "n1 = 6400.\n", + "print \"m2, d2 and n2 denotes mean, deviation and no.of objects in second sample\"\n", + "m2 = 68.55\n", + "d2 = 2.52\n", + "n2 = 1600.\n", + "print \"S. E. of the difference of the mean heights is \",\n", + "e = ((d**2/n1)+(d2**2/n2))**0.5\n", + "print e\n", + "print m1-m2\n", + "print \"|m1−m2|>10e, this is highly significant. hence, the data indicates that the sailors are on the average taller than the soldiers.\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 35.12, page no. 874" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "First of row denotes the different values of sample \n", + "The second row denotes the corresponding deviation\n", + "The third row denotes the corresponding square of deviation\n", + "The sum of second row elements = 10.0\n", + "The sum of third row elements = 66.0\n", + "let m be the mean \n", + "let d be the standard deviation\n", + "1.84522581263\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.zeros((3,9))\n", + "n = 9\n", + "print \"First of row denotes the different values of sample \"\n", + "A[0,:] = [45,47,50,52,48,47,49,53,51]\n", + "print \"The second row denotes the corresponding deviation\"\n", + "for i in range(0,9):\n", + " A[1,i] = A[0,i]-48\n", + "print \"The third row denotes the corresponding square of deviation\"\n", + "for i in range(0,9):\n", + " A[2,i] = A[1,i]**2\n", + "print \"The sum of second row elements = \",\n", + "a =0\n", + "for i in range(0,9):\n", + " a = a+A[1,i]\n", + "print a\n", + "print \"The sum of third row elements = \",\n", + "b = 0\n", + "for i in range(0,9):\n", + " b = b+A[2,i]\n", + "print b\n", + "print \"let m be the mean \"\n", + "m = 48+a/n\n", + "print \"let d be the standard deviation\"\n", + "d = ((b/n)-(a/n)**2)**0.5\n", + "t = (m-47.5)*(n-1)**0.5/d\n", + "print t" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 35.13, page no. 876" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "d and n represents the deviation and no. objects in given sample\n", + "Taking the hypothesis that the product is not inferior i.e. there is no significant difference between m and M\n", + "3.15\n", + "Degrees of freedom= \n", + "9.0\n" + ] + } + ], + "source": [ + "print \"d and n represents the deviation and no. objects in given sample\"\n", + "n = 10.\n", + "d = 0.04\n", + "m = 0.742\n", + "M = 0.700\n", + "print \"Taking the hypothesis that the product is not inferior i.e. there is no significant difference between m and M\"\n", + "t = (m-M)*(n-1)**0.5/d\n", + "print t\n", + "print \"Degrees of freedom= \"\n", + "f = n-1\n", + "print f" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 34.15, page no. 878" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The first row denotes the boy no. \n", + "The second row denotes the marks in test I(x1)\n", + "The third row denotes the marks in test I(x2)\n", + "The fourth row denotes the difference of marks in two tests(d)\n", + "The fifth row denotes the (d−1)\n", + "The sixth row denotes the square of elements of fourth row \n", + "[[ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.]\n", + " [ 23. 20. 19. 21. 18. 20. 18. 17. 23. 16. 19.]\n", + " [ 24. 19. 22. 18. 20. 22. 20. 20. 23. 20. 17.]\n", + " [ 1. -1. 3. -3. 2. 2. 2. 3. 0. 4. -2.]\n", + " [ 0. -2. 2. -4. 1. 1. 1. 2. -1. 3. -3.]\n", + " [ 1. 1. 9. 9. 4. 4. 4. 9. 0. 16. 4.]]\n", + "The sum of elements of fourth row=\n", + "11.0\n", + "The sum of elements of sixth row= \n", + "61.0\n", + "Standard deviation\n", + "d = 2.46981780705\n", + "t = 1.48063606712\n" + ] + } + ], + "source": [ + "import numpy\n", + "\n", + "A = numpy.zeros((6,11))\n", + "n = 11\n", + "print \"The first row denotes the boy no. \"\n", + "A[0,:] = [1,2,3,4,5,6,7,8,9,10,11]\n", + "print \"The second row denotes the marks in test I(x1)\"\n", + "A[1,:] = [23,20,19,21,18,20,18,17,23,16,19]\n", + "print \"The third row denotes the marks in test I(x2)\"\n", + "A[2,:] = [24,19,22,18,20,22,20,20,23,20,17]\n", + "print \"The fourth row denotes the difference of marks in two tests(d)\"\n", + "for i in range (0,11):\n", + " A[3,i] = A[2,i]-A[1,i]\n", + "print \"The fifth row denotes the (d−1)\"\n", + "for i in range (0,11):\n", + " A[4,i] = A[3,i]-1\n", + "print \"The sixth row denotes the square of elements of fourth row \"\n", + "for i in range(0,11):\n", + " A[5,i] = A[3,i]**2\n", + "print A\n", + "a = 0\n", + "print \"The sum of elements of fourth row=\"\n", + "for i in range(0,11):\n", + " a = a+A[3,i]\n", + "print a\n", + "b = 0\n", + "print \"The sum of elements of sixth row= \"\n", + "for i in range(0,11):\n", + " b = b + A[5,i]\n", + "print b\n", + "print \"Standard deviation\"\n", + "d = (b/(n-1))**0.5\n", + "t = (1-0)*(n)**0.5/2.24\n", + "print \"d = \",d\n", + "print \"t = \",t" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter4.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter4.ipynb new file mode 100644 index 00000000..e40044d7 --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter4.ipynb @@ -0,0 +1,1208 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4: Diffrentiations And Applications" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 4.1, page no. 133" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "We have to find yn for F=cosxcos2xcos3x\n", + "Enter the order of differentiation: 0\n", + "calculating yn..\n", + "The expression for yn is\n", + "cos(x)*cos(2*x)*cos(3*x)\n" + ] + } + ], + "source": [ + "import sympy\n", + "import numpy\n", + "import math\n", + "\n", + "print \"We have to find yn for F=cosxcos2xcos3x\"\n", + "x = sympy.Symbol('x')\n", + "F = sympy.cos(x)*sympy.cos(2*x)*sympy.cos(3*x)\n", + "n = int(raw_input(\"Enter the order of differentiation: \"))\n", + "print \"calculating yn..\"\n", + "yn= sympy.diff(F,x,n)\n", + "print \"The expression for yn is\"\n", + "print yn " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.5, page no. 137" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "we have to find yn for F=cosxcos2xcos3x\n", + "Enter the order of differentiation: 0\n", + "calculating yn\n", + "The expression for yn is\n", + "x/((x - 1)*(2*x + 3))\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "print 'we have to find yn for F=cosxcos2xcos3x'\n", + "x = sympy.Symbol('x')\n", + "F = x/((x-1)*(2*x+3))\n", + "n = int(raw_input(\"Enter the order of differentiation: \"))\n", + "print \"calculating yn\"\n", + "yn= sympy.diff(F,x,n)\n", + "print \"The expression for yn is\"\n", + "print yn" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.6, page no. 138" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "We have to find yn for F=cosxcos2xcos3x\n", + "Enter the orde of differentiation:0\n", + "calculating yn\n", + "the expression for yn is\n", + "x/(a**2 + x**2)\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "print \"We have to find yn for F=cosxcos2xcos3x\"\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "F = x/(x**2+a**2)\n", + "n = raw_input (\"Enter the orde of differentiation:\")\n", + "print \"calculating yn\"\n", + "yn = diff(F,x,n)\n", + "print \"the expression for yn is\"\n", + "print yn" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.7, page no. 139" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "we have to find yn for F=cosxcos2xcos3x\n", + "Enter the order of differentiation: 0\n", + "calculating yn\n", + "the expression for yn is\n", + "2.71828182845905**x*(2*x + 3)**3\n" + ] + } + ], + "source": [ + "import sympy, math\n", + "\n", + "print \"we have to find yn for F=cosxcos2xcos3x\"\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "F = math.e**(x)*(2*x+3)**3\n", + "n = raw_input (\"Enter the order of differentiation: \")\n", + "print \"calculating yn\"\n", + "yn = diff(F,x,n)\n", + "print \"the expression for yn is\"\n", + "print yn" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.8, page no. 139" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "y=(sinˆ-1)x) --sign inverse x\n", + "we have to prove (1-xˆ2)y(n+2)-(2n+1)xy(n+1)-nˆ2 yn\n", + "Calculating yn for various values of n\n", + "1\n", + "The expression for yn is\n", + "-6*x*(x*asin(x)/(-x**2 + 1)**(3/2) - 1/(x**2 - 1)) - 2*(a**2 + 1)*asin(x)/sqrt(-x**2 + 1) + 2*(-x**2 + 1)*(3*x**2*asin(x)/(-x**2 + 1)**(5/2) + 3*x/(x**2 - 1)**2 + asin(x)/(-x**2 + 1)**(3/2))\n", + "Which is equal to 0\n", + "2\n", + "The expression for yn is\n", + "-10*x*(3*x**2*asin(x)/(-x**2 + 1)**(5/2) + 3*x/(x**2 - 1)**2 + asin(x)/(-x**2 + 1)**(3/2)) - 2*(a**2 + 4)*(x*asin(x)/(-x**2 + 1)**(3/2) - 1/(x**2 - 1)) + 2*(-x**2 + 1)*(15*x**3*asin(x)/(-x**2 + 1)**(7/2) - 15*x**2/(x**2 - 1)**3 + 9*x*asin(x)/(-x**2 + 1)**(5/2) + 4/(x**2 - 1)**2)\n", + "Which is equal to 0\n", + "3\n", + "The expression for yn is\n", + "-14*x*(15*x**3*asin(x)/(-x**2 + 1)**(7/2) - 15*x**2/(x**2 - 1)**3 + 9*x*asin(x)/(-x**2 + 1)**(5/2) + 4/(x**2 - 1)**2) - 2*(a**2 + 9)*(3*x**2*asin(x)/(-x**2 + 1)**(5/2) + 3*x/(x**2 - 1)**2 + asin(x)/(-x**2 + 1)**(3/2)) + 2*(-x**2 + 1)*(105*x**4*asin(x)/(-x**2 + 1)**(9/2) + 105*x**3/(x**2 - 1)**4 + 90*x**2*asin(x)/(-x**2 + 1)**(7/2) - 55*x/(x**2 - 1)**3 + 9*asin(x)/(-x**2 + 1)**(5/2))\n", + "Which is equal to 0\n", + "4\n", + "The expression for yn is\n", + "-18*x*(105*x**4*asin(x)/(-x**2 + 1)**(9/2) + 105*x**3/(x**2 - 1)**4 + 90*x**2*asin(x)/(-x**2 + 1)**(7/2) - 55*x/(x**2 - 1)**3 + 9*asin(x)/(-x**2 + 1)**(5/2)) - 2*(a**2 + 16)*(15*x**3*asin(x)/(-x**2 + 1)**(7/2) - 15*x**2/(x**2 - 1)**3 + 9*x*asin(x)/(-x**2 + 1)**(5/2) + 4/(x**2 - 1)**2) + 2*(-x**2 + 1)*(945*x**5*asin(x)/(-x**2 + 1)**(11/2) - 945*x**4/(x**2 - 1)**5 + 1050*x**3*asin(x)/(-x**2 + 1)**(9/2) + 735*x**2/(x**2 - 1)**4 + 225*x*asin(x)/(-x**2 + 1)**(7/2) - 64/(x**2 - 1)**3)\n", + "Which is equal to 0\n", + "Hence Proved\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "print 'y=(sinˆ-1)x) --sign inverse x'\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "y = (sympy.asin(x))**2;\n", + "print 'we have to prove (1-xˆ2)y(n+2)-(2n+1)xy(n+1)-nˆ2 yn'\n", + "print 'Calculating yn for various values of n'\n", + "for n in range(1,5):\n", + " F=(1-x**2)*sympy.diff(y,x,n+2)-(2*n+1)*x*sympy.diff(y,x,n+1)-(n**2+a**2)*sympy.diff(y,x,n)\n", + " print n\n", + " print 'The expression for yn is'\n", + " print F\n", + " print 'Which is equal to 0'\n", + "print 'Hence Proved'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.9, page no. 140" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "y=eˆ(a(sinˆ-1)x))--sign inverse x\n", + "We have to prove (1-xˆ2)y(n+2)-(2n+1)xy(n+1)-(nˆ2+aˆ2)yn\n", + "Calculating yn for various values of n\n", + "1\n", + "The expression for yn is\n", + "-3.0*2.71828182845905**(a*asin(x))*a*x*(-a/(x**2 - 1) + x/(-x**2 + 1)**(3/2)) - 1.0*2.71828182845905**(a*asin(x))*a*(a**2 + 1)/sqrt(-x**2 + 1) + 2.71828182845905**(a*asin(x))*a*(-x**2 + 1)*(1.0*a**2/(-x**2 + 1)**(3/2) + 3.0*a*x/(x**2 - 1)**2 + 3.0*x**2/(-x**2 + 1)**(5/2) + 1.0/(-x**2 + 1)**(3/2))\n", + "Which is equal to 0\n", + "2\n", + "The expression for yn is\n", + "-5*2.71828182845905**(a*asin(x))*a*x*(1.0*a**2/(-x**2 + 1)**(3/2) + 3.0*a*x/(x**2 - 1)**2 + 3.0*x**2/(-x**2 + 1)**(5/2) + 1.0/(-x**2 + 1)**(3/2)) - 1.0*2.71828182845905**(a*asin(x))*a*(a**2 + 4)*(-a/(x**2 - 1) + x/(-x**2 + 1)**(3/2)) + 2.71828182845905**(a*asin(x))*a*(-x**2 + 1)*(1.0*a**3/(x**2 - 1)**2 + 6.0*a**2*x/(-x**2 + 1)**(5/2) - 15.0*a*x**2/(x**2 - 1)**3 + 4.0*a/(x**2 - 1)**2 + 15.0*x**3/(-x**2 + 1)**(7/2) + 9.0*x/(-x**2 + 1)**(5/2))\n", + "Which is equal to 0\n", + "3\n", + "The expression for yn is\n", + "-7*2.71828182845905**(a*asin(x))*a*x*(1.0*a**3/(x**2 - 1)**2 + 6.0*a**2*x/(-x**2 + 1)**(5/2) - 15.0*a*x**2/(x**2 - 1)**3 + 4.0*a/(x**2 - 1)**2 + 15.0*x**3/(-x**2 + 1)**(7/2) + 9.0*x/(-x**2 + 1)**(5/2)) - 2.71828182845905**(a*asin(x))*a*(a**2 + 9)*(1.0*a**2/(-x**2 + 1)**(3/2) + 3.0*a*x/(x**2 - 1)**2 + 3.0*x**2/(-x**2 + 1)**(5/2) + 1.0/(-x**2 + 1)**(3/2)) + 2.71828182845905**(a*asin(x))*a*(-x**2 + 1)*(1.0*a**4/(-x**2 + 1)**(5/2) - 10.0*a**3*x/(x**2 - 1)**3 + 45.0*a**2*x**2/(-x**2 + 1)**(7/2) + 10.0*a**2/(-x**2 + 1)**(5/2) + 105.0*a*x**3/(x**2 - 1)**4 - 55.0*a*x/(x**2 - 1)**3 + 105.0*x**4/(-x**2 + 1)**(9/2) + 90.0*x**2/(-x**2 + 1)**(7/2) + 9.0/(-x**2 + 1)**(5/2))\n", + "Which is equal to 0\n", + "4\n", + "The expression for yn is\n", + "-9*2.71828182845905**(a*asin(x))*a*x*(1.0*a**4/(-x**2 + 1)**(5/2) - 10.0*a**3*x/(x**2 - 1)**3 + 45.0*a**2*x**2/(-x**2 + 1)**(7/2) + 10.0*a**2/(-x**2 + 1)**(5/2) + 105.0*a*x**3/(x**2 - 1)**4 - 55.0*a*x/(x**2 - 1)**3 + 105.0*x**4/(-x**2 + 1)**(9/2) + 90.0*x**2/(-x**2 + 1)**(7/2) + 9.0/(-x**2 + 1)**(5/2)) - 2.71828182845905**(a*asin(x))*a*(a**2 + 16)*(1.0*a**3/(x**2 - 1)**2 + 6.0*a**2*x/(-x**2 + 1)**(5/2) - 15.0*a*x**2/(x**2 - 1)**3 + 4.0*a/(x**2 - 1)**2 + 15.0*x**3/(-x**2 + 1)**(7/2) + 9.0*x/(-x**2 + 1)**(5/2)) + 2.71828182845905**(a*asin(x))*a*(-x**2 + 1)*(-1.0*a**5/(x**2 - 1)**3 + 15.0*a**4*x/(-x**2 + 1)**(7/2) + 105.0*a**3*x**2/(x**2 - 1)**4 - 20.0*a**3/(x**2 - 1)**3 + 420.0*a**2*x**3/(-x**2 + 1)**(9/2) + 195.0*a**2*x/(-x**2 + 1)**(7/2) - 945.0*a*x**4/(x**2 - 1)**5 + 735.0*a*x**2/(x**2 - 1)**4 - 64.0*a/(x**2 - 1)**3 + 945.0*x**5/(-x**2 + 1)**(11/2) + 1050.0*x**3/(-x**2 + 1)**(9/2) + 225.0*x/(-x**2 + 1)**(7/2))\n", + "Which is equal to 0\n", + "Hence proved\n" + ] + } + ], + "source": [ + "import sympy, math\n", + "\n", + "print 'y=eˆ(a(sinˆ-1)x))--sign inverse x'\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "y = math.e**(a*(sympy.asin(x)))\n", + "print 'We have to prove (1-xˆ2)y(n+2)-(2n+1)xy(n+1)-(nˆ2+aˆ2)yn'\n", + "print 'Calculating yn for various values of n'\n", + "for n in range(1,5):\n", + " F =(1-x**2)*sympy.diff(y,x,n+2)-(2*n+1)*x*sympy.diff(y,x,n+1)-(n**2+a**2)*sympy.diff(y,x,n)\n", + " print n\n", + " print 'The expression for yn is'\n", + " print F\n", + " print 'Which is equal to 0'\n", + "print 'Hence proved'\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.10, page no. 141" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "y^(1/m)+y^-(1/m)=2x\n", + "OR y^(2/m)-2xy^(1/m)+1\n", + "OR y=[ x+(xˆ2-1)]ˆm and y=[x-(xˆ2 −1)]ˆm\n", + "For y=[x+(xˆ2−1)]ˆm\n", + "We have to prove (xˆ2−1)y(n+2)+(2n+1)xy(n+1)+(nˆ2−mˆ2)yn\n", + "Calculating various values for yn\n", + "1\n", + "The expression for yn is\n", + "3*m*x*(x**2 + x - 1)**m*(m*(2*x + 1)**2/(x**2 + x - 1) - (2*x + 1)**2/(x**2 + x - 1) + 2)/(x**2 + x - 1) + m*(-m**2 + 1)*(2*x + 1)*(x**2 + x - 1)**m/(x**2 + x - 1) + m*(2*x + 1)*(x**2 - 1)*(x**2 + x - 1)**m*(m**2*(2*x + 1)**2/(x**2 + x - 1) - 3*m*(2*x + 1)**2/(x**2 + x - 1) + 6*m + 2*(2*x + 1)**2/(x**2 + x - 1) - 6)/(x**2 + x - 1)**2\n", + "Which is equal to 0\n", + "2\n", + "The expression for yn is\n", + "5*m*x*(2*x + 1)*(x**2 + x - 1)**m*(m**2*(2*x + 1)**2/(x**2 + x - 1) - 3*m*(2*x + 1)**2/(x**2 + x - 1) + 6*m + 2*(2*x + 1)**2/(x**2 + x - 1) - 6)/(x**2 + x - 1)**2 + m*(-m**2 + 4)*(x**2 + x - 1)**m*(m*(2*x + 1)**2/(x**2 + x - 1) - (2*x + 1)**2/(x**2 + x - 1) + 2)/(x**2 + x - 1) + m*(x**2 - 1)*(x**2 + x - 1)**m*(m**3*(2*x + 1)**4/(x**2 + x - 1)**2 - 6*m**2*(2*x + 1)**4/(x**2 + x - 1)**2 + 12*m**2*(2*x + 1)**2/(x**2 + x - 1) + 11*m*(2*x + 1)**4/(x**2 + x - 1)**2 - 36*m*(2*x + 1)**2/(x**2 + x - 1) + 12*m - 6*(2*x + 1)**4/(x**2 + x - 1)**2 + 24*(2*x + 1)**2/(x**2 + x - 1) - 12)/(x**2 + x - 1)**2\n", + "Which is equal to 0\n", + "3\n", + "The expression for yn is\n", + "7*m*x*(x**2 + x - 1)**m*(m**3*(2*x + 1)**4/(x**2 + x - 1)**2 - 6*m**2*(2*x + 1)**4/(x**2 + x - 1)**2 + 12*m**2*(2*x + 1)**2/(x**2 + x - 1) + 11*m*(2*x + 1)**4/(x**2 + x - 1)**2 - 36*m*(2*x + 1)**2/(x**2 + x - 1) + 12*m - 6*(2*x + 1)**4/(x**2 + x - 1)**2 + 24*(2*x + 1)**2/(x**2 + x - 1) - 12)/(x**2 + x - 1)**2 + m*(-m**2 + 9)*(2*x + 1)*(x**2 + x - 1)**m*(m**2*(2*x + 1)**2/(x**2 + x - 1) - 3*m*(2*x + 1)**2/(x**2 + x - 1) + 6*m + 2*(2*x + 1)**2/(x**2 + x - 1) - 6)/(x**2 + x - 1)**2 + m*(2*x + 1)*(x**2 - 1)*(x**2 + x - 1)**m*(m**4*(2*x + 1)**4/(x**2 + x - 1)**2 - 10*m**3*(2*x + 1)**4/(x**2 + x - 1)**2 + 20*m**3*(2*x + 1)**2/(x**2 + x - 1) + 35*m**2*(2*x + 1)**4/(x**2 + x - 1)**2 - 120*m**2*(2*x + 1)**2/(x**2 + x - 1) + 60*m**2 - 50*m*(2*x + 1)**4/(x**2 + x - 1)**2 + 220*m*(2*x + 1)**2/(x**2 + x - 1) - 180*m + 24*(2*x + 1)**4/(x**2 + x - 1)**2 - 120*(2*x + 1)**2/(x**2 + x - 1) + 120)/(x**2 + x - 1)**3\n", + "Which is equal to 0\n", + "4\n", + "The expression for yn is\n", + "9*m*x*(2*x + 1)*(x**2 + x - 1)**m*(m**4*(2*x + 1)**4/(x**2 + x - 1)**2 - 10*m**3*(2*x + 1)**4/(x**2 + x - 1)**2 + 20*m**3*(2*x + 1)**2/(x**2 + x - 1) + 35*m**2*(2*x + 1)**4/(x**2 + x - 1)**2 - 120*m**2*(2*x + 1)**2/(x**2 + x - 1) + 60*m**2 - 50*m*(2*x + 1)**4/(x**2 + x - 1)**2 + 220*m*(2*x + 1)**2/(x**2 + x - 1) - 180*m + 24*(2*x + 1)**4/(x**2 + x - 1)**2 - 120*(2*x + 1)**2/(x**2 + x - 1) + 120)/(x**2 + x - 1)**3 + m*(-m**2 + 16)*(x**2 + x - 1)**m*(m**3*(2*x + 1)**4/(x**2 + x - 1)**2 - 6*m**2*(2*x + 1)**4/(x**2 + x - 1)**2 + 12*m**2*(2*x + 1)**2/(x**2 + x - 1) + 11*m*(2*x + 1)**4/(x**2 + x - 1)**2 - 36*m*(2*x + 1)**2/(x**2 + x - 1) + 12*m - 6*(2*x + 1)**4/(x**2 + x - 1)**2 + 24*(2*x + 1)**2/(x**2 + x - 1) - 12)/(x**2 + x - 1)**2 + m*(x**2 - 1)*(x**2 + x - 1)**m*(m**5*(2*x + 1)**6/(x**2 + x - 1)**3 - 15*m**4*(2*x + 1)**6/(x**2 + x - 1)**3 + 30*m**4*(2*x + 1)**4/(x**2 + x - 1)**2 + 85*m**3*(2*x + 1)**6/(x**2 + x - 1)**3 - 300*m**3*(2*x + 1)**4/(x**2 + x - 1)**2 + 180*m**3*(2*x + 1)**2/(x**2 + x - 1) - 225*m**2*(2*x + 1)**6/(x**2 + x - 1)**3 + 1050*m**2*(2*x + 1)**4/(x**2 + x - 1)**2 - 1080*m**2*(2*x + 1)**2/(x**2 + x - 1) + 120*m**2 + 274*m*(2*x + 1)**6/(x**2 + x - 1)**3 - 1500*m*(2*x + 1)**4/(x**2 + x - 1)**2 + 1980*m*(2*x + 1)**2/(x**2 + x - 1) - 360*m - 120*(2*x + 1)**6/(x**2 + x - 1)**3 + 720*(2*x + 1)**4/(x**2 + x - 1)**2 - 1080*(2*x + 1)**2/(x**2 + x - 1) + 240)/(x**2 + x - 1)**3\n", + "Which is equal to 0\n", + "Hence Proved\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "print 'y^(1/m)+y^-(1/m)=2x'\n", + "print 'OR y^(2/m)-2xy^(1/m)+1'\n", + "print 'OR y=[ x+(xˆ2-1)]ˆm and y=[x-(xˆ2 −1)]ˆm'\n", + "x = sympy.Symbol('x')\n", + "m = sympy.Symbol('m')\n", + "print 'For y=[x+(xˆ2−1)]ˆm'\n", + "y=(x+(x**2-1))**m\n", + "print 'We have to prove (xˆ2−1)y(n+2)+(2n+1)xy(n+1)+(nˆ2−mˆ2)yn'\n", + "print 'Calculating various values for yn'\n", + "for n in range(1,5):\n", + " F=(x**2-1)*sympy.diff(y,x,n+2)+(2*n+1)*x*sympy.diff(y,x,n+1)+(n**2-m**2)*sympy.diff(y,x,n)\n", + " print n\n", + " print 'The expression for yn is'\n", + " print F\n", + " print 'Which is equal to 0'\n", + "print 'Hence Proved'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.11, page no. 144" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false, + "scrolled": true + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "For roles theorem F9x should be differentiable in (a, b) and f(a)=f(b)\n", + "Here f(x)=sin(x)/e^x\n", + "-1.0*2.71828182845905**(-x)*sin(x) + 2.71828182845905**(-x)*cos(x)\n", + "Putting this to zero we get tan(x)=1 ie x=pi/4\n", + "Value pi/2 lies b/w 0 and pi. Hence roles theroem is verified\n" + ] + } + ], + "source": [ + "import sympy, math\n", + "\n", + "print 'For roles theorem F9x should be differentiable in (a, b) and f(a)=f(b)'\n", + "print 'Here f(x)=sin(x)/e^x'\n", + "x = sympy.Symbol('x')\n", + "y = sympy.sin(x)/math.e**x\n", + "y1 = sympy.diff(y,x)\n", + "print y1\n", + "print 'Putting this to zero we get tan(x)=1 ie x=pi/4'\n", + "print 'Value pi/2 lies b/w 0 and pi. Hence roles theroem is verified'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.16 page no. 149" + ] + }, + { + "cell_type": "code", + "execution_count": 56, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Maclaurin's Series\n", + "f(x)=f(0)+xf1(0)+xˆ2/2!∗f2(0)+xˆ3/3!∗f3(0)+......\n", + "Enter the orde of differentiation: 6\n", + "-I*x**5*atanh(sqrt(-sqrt(105)/30 + 1/2))/120 - I*x**3*atanh(sqrt(3)/3)/6\n" + ] + } + ], + "source": [ + "import numpy, sympy, math\n", + "\n", + "print \"Maclaurin's Series\"\n", + "print 'f(x)=f(0)+xf1(0)+xˆ2/2!∗f2(0)+xˆ3/3!∗f3(0)+......'\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "y = sympy.tan(a)\n", + "n = int(raw_input(\"Enter the orde of differentiation: \"))\n", + "a = 1\n", + "t = sympy.solve(y)[0]\n", + "a = 0\n", + "for i in range(2,n+1):\n", + " y1 = sympy.diff (y,'a',i-1)\n", + " if sympy.solve(y1):\n", + " t = t+x**(i-1)*sympy.solve(y1)[0]/math.factorial(i-1)\n", + "print t" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.17, page no. 150" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Maclaurins series\n", + "f(x)=f(0)+xf1(0)+xˆ2/2!∗f2(0)+xˆ3/3!∗f3(0)+......\n", + "enter the number of expression in series:2\n", + "1.5707963267949*x\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"Maclaurins series\"\n", + "print \"f(x)=f(0)+xf1(0)+xˆ2/2!∗f2(0)+xˆ3/3!∗f3(0)+......\"\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "y = math.e**(sympy.sin(a))\n", + "n = int(raw_input('enter the number of expression in series:'))\n", + "a = 0\n", + "t = 0\n", + "a = 0\n", + "for i in range(2,n+1):\n", + " y1 = sympy.diff(y,'a',i-1) \n", + " t = t+x**(i-1)*sympy.solve(y1)[0]/math.factorial(i-1) \n", + "print t" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 4.18, page no. 150" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Maclaurins series\n", + "f(x)=f(0)+xf1(0)+xˆ2/2!∗f2(0)+xˆ3/3!∗f3(0)+......\n", + "enter the number of differentiation involved in maclaurins series :3\n", + "x**2*atan(RootOf(tan(a/2)**4 - 10*tan(a/2)**2 + 1, 0))\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"Maclaurins series\"\n", + "print \"f(x)=f(0)+xf1(0)+xˆ2/2!∗f2(0)+xˆ3/3!∗f3(0)+......\"\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "y = sympy.log(1+(sympy.sin(a))**2)\n", + "n = int(raw_input(\"enter the number of differentiation involved in maclaurins series :\"))\n", + "a = 0\n", + "t = 0\n", + "a = 0\n", + "for i in range(2,n+1):\n", + " y1 = sympy.diff(y,'a',i-1) \n", + " t = t+x**(i-1)*sympy.solve(y1)[0]/math.factorial(i-1) \n", + "print t" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 4.19, page no. 151" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Maclaurins series\n", + "f(x)=f(0)+xf1(0)+xˆ2/2!∗f2(0)+xˆ3/3!∗f3(0)+......\n", + "enter the number of expression in series :2\n", + "1.0*2.71828182845905**(a*asin(b))*a*x*(-b**2 + 1.0)**(-0.5)\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"Maclaurins series\"\n", + "print \"f(x)=f(0)+xf1(0)+xˆ2/2!∗f2(0)+xˆ3/3!∗f3(0)+......\"\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "b = sympy.Symbol('b')\n", + "y = math.e**(a*sympy.asin(b))\n", + "y1 = sympy.diff(y, 'b', 1)\n", + "n = int(raw_input(\"enter the number of expression in series :\"))\n", + "b = 0\n", + "t = 0\n", + "for i in range(2,n+1):\n", + " y1 = sympy.diff(y,'b',i-1) \n", + " t = t+x**(i-1)*y1.evalf()/math.factorial(i-1) \n", + "print t" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.20, page no. 152" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Advantage of scilab is that we can calculate log1.1 directly without using Taylor series\n", + "Use of taylor series are given in subsequent examples\n", + "log(1.1) = 0.0953101798043\n" + ] + } + ], + "source": [ + "import numpy,math,sympy\n", + "\n", + "print \"Use of taylor series are given in subsequent examples\"\n", + "y = math.log(1.1)\n", + "print \"log(1.1) = \",math.log (1.1) " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.21, page no. 152" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Taylor series\n", + "f(x+h)=f(x)+hf1(x)+hˆ2/2!∗f2(x)+hˆ3/3!∗f3(x)+......\n", + "To finf the taylor expansion of tan−1(x+h)\n", + "enter the number of expression in series : 2\n", + "h/(x**2 + 1) + atan(x)\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"Taylor series\"\n", + "print \"f(x+h)=f(x)+hf1(x)+hˆ2/2!∗f2(x)+hˆ3/3!∗f3(x)+......\"\n", + "print \"To finf the taylor expansion of tan−1(x+h)\"\n", + "x = sympy.Symbol('x')\n", + "h = sympy.Symbol('h')\n", + "y = sympy.atan ( x )\n", + "n = int(raw_input (\"enter the number of expression in series : \"))\n", + "t = y \n", + "for i in range (2,n+1):\n", + " y1 = sympy.diff (y,'x',i-1)\n", + " t = t+h**(i-1)*(y1)/math.factorial(i-1)\n", + "print t" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.22, page no. 153" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Here we need to find the limit off(x) at x=0\n", + "2.46828182845905\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"Here we need to find the limit off(x) at x=0\"\n", + "x = sympy.Symbol('x')\n", + "y = (x*math.e**x-sympy.log(1+x))/x**2\n", + "f = 1\n", + "while f==1:\n", + " yn = x*math.e**x-sympy.log(1+x)\n", + " yd = x**2;\n", + " yn1 = sympy.diff(yn,'x',1)\n", + " yd1 = sympy.diff(yd,'x',1)\n", + " x = 0\n", + " a = yn1.evalf(subs=dict(x=1))\n", + " b = yd1.evalf(subs=dict(x=1))\n", + " if a == b:\n", + " yn = yn1 \n", + " yd = yd1 \n", + " else:\n", + " f =0\n", + "h = a / b \n", + "print h" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.32, page no. 162" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Equation of tangent\n", + "Equation is g=0 where g is x - y\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"Equation of tangent\"\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "y = sympy.Symbol('y')\n", + "f = (a**(2/3)-x**(2/3))**(3/2)\n", + "s = sympy.diff(f,x)\n", + "Y1 = s*(-x)+y\n", + "X1 = -y/s*x\n", + "g = x-(Y1-s*(X1-x))\n", + "print \"Equation is g=0 where g is\",g" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example, 4.34, page no. 163" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Equation of tangent\n", + "y = a*(-t*cos(t) + sin(t)) + (-a*(t*sin(t) + cos(t)) + x)*cos(t)/sin(t)\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"Equation of tangent\"\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "y = sympy.Symbol('y')\n", + "t = sympy.Symbol('t')\n", + "xo = a*(sympy.cos(t)+t*sympy.sin(t))\n", + "yo = a*(sympy.sin(t)-t*sympy.cos(t))\n", + "s = sympy.diff(xo,t)/sympy.diff(yo,t)\n", + "y = yo+s*(x-xo)\n", + "print \"y = \",y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.35, page no. 163" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The two given curves are xˆ=4y and yˆ2=4x which intersects at (0,0) and (4,4)\n", + "for (4 ,4)\n", + "Angle between them is (radians):−\n", + "atan(x/2)\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"The two given curves are xˆ=4y and yˆ2=4x which intersects at (0,0) and (4,4)\"\n", + "print \"for (4 ,4)\"\n", + "x = 4\n", + "x = sympy.Symbol('x')\n", + "y1= x**2/4\n", + "y2 = 2*x**(1/2)\n", + "m1= sympy.diff(y1,x,1)\n", + "m2= sympy.diff(y2,x,1)\n", + "x = 4\n", + "print \"Angle between them is (radians):−\"\n", + "t= sympy.atan((m1-m2)/(1+m1*m2)) \n", + "print t" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.37, page no. 165" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "length of tangent\n", + "a*(((tan(t/2)**2/2 + 1/2)/tan(t/2) - sin(t))/cos(t) + 1)**0.5*sin(t)\n", + "checking for its dependency on t\n", + "verified and equal to a\n", + "subtangent\n", + "a*sin(t)*cos(t)/((tan(t/2)**2/2 + 1/2)/tan(t/2) - sin(t))\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "a = sympy.Symbol('a')\n", + "t = sympy.Symbol('t')\n", + "x = a*(sympy.cos(t)+sympy.log(sympy.tan(t/2)))\n", + "y = a*sympy.sin(t)\n", + "s = sympy.diff(x,t,1)/sympy.diff(y,t,1)\n", + "print \"length of tangent\"\n", + "l = y*(1+s)**(0.5)\n", + "print l\n", + "print \"checking for its dependency on t\"\n", + "f = 1\n", + "t = 0\n", + "k = sympy.solve(l)\n", + "for i in range(1,11):\n", + " t = i\n", + " if(sympy.solve(l)!=k):\n", + " f = 0\n", + "if(f==1):\n", + " print \"verified and equal to a\"\n", + "print \"subtangent\"\n", + "m = y/s\n", + "print m" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.39, page no. 168" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Angle of intersection\n", + "point of intersection of r=sint+cost and r=2 sint is t=pi/4\n", + "tanu=dQ/dr∗r\n", + "The angle at point of intersection in radians is : \n", + "atan(2*(-sin(Q) + cos(Q))*sin(Q))\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"Angle of intersection\"\n", + "print \"point of intersection of r=sint+cost and r=2 sint is t=pi/4\"\n", + "print \"tanu=dQ/dr∗r\"\n", + "Q = sympy.Symbol('Q')\n", + "r1 = 2*sympy.sin(Q)\n", + "r2 = sympy.sin(Q)+sympy.cos(Q)\n", + "u = sympy.atan(r1*sympy.diff(r2,Q,1))\n", + "Q = math.pi/4\n", + "u = u.evalf()\n", + "print \"The angle at point of intersection in radians is : \"\n", + "print u" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.41, page no. 170" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "tanu=dQ/dr∗r\n", + "atan(2*a/((-sin(Q) + cos(Q))*(-cos(Q) + 1)))\n", + "4.0*a**2*(4.0*a**2/((-sin(Q) + cos(Q))**2*(-cos(Q) + 1.0)**2) + 1.0)**(-0.5)/((-sin(Q) + cos(Q))*(-cos(Q) + 1.0)**2)\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"tanu=dQ/dr∗r\"\n", + "Q = sympy.Symbol('Q')\n", + "a = sympy.Symbol('a')\n", + "r = 2*a/(1-sympy.cos(Q))\n", + "u = sympy.atan(r/sympy.diff(r2,Q,1))\n", + "u = u.evalf()\n", + "print u\n", + "p = r*sympy.sin(u)\n", + "r = sympy.Symbol('r')\n", + "Q = sympy.acos(1-2*a/r)\n", + "p = p.evalf()\n", + "print p" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.43, page no. 172" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The radius of curvature is : -(1 + sin(t)**2/(cos(t) + 1)**2)*sin(t)/cos(t)\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "a = sympy.Symbol('a')\n", + "t = sympy.Symbol('t')\n", + "x = a*(t+sympy.sin(t))\n", + "y = a*(1-sympy.cos(t))\n", + "s2 = sympy.diff(y,t,2)/sympy.diff(x,t,2)\n", + "s1 = sympy.diff(y,t,1)/sympy.diff(x,t,1)\n", + "r = (1+s1**2)**(3/2)/s2\n", + "print \"The radius of curvature is :\",r" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.46, page no. 176" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "radius of curvature\n", + "(a**2*(-cos(t) + 1.0)**2 + a**2*sin(t)**2)/(a**2*(-cos(t) + 1.0)**2 - a**2*(-cos(t) + 1.0)*sin(t) + 2.0*a**2*sin(t)**2)\n", + "Which is proportional to rˆ0.5\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"radius of curvature\"\n", + "a = sympy.Symbol('a')\n", + "t = sympy.Symbol('t')\n", + "r = a*(1-sympy.cos(t))\n", + "r1 = sympy.diff(r,t,1) \n", + "l = (r**2+r1**2)**(3/2)/(r**2+2*r1**2-r*r1)\n", + "r = sympy.Symbol('r')\n", + "t = sympy.acos(1-r/a)\n", + "l = l.evalf()\n", + "print l\n", + "print \"Which is proportional to rˆ0.5\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.47, page no. 177" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The centre of curvature\n", + "the coordinates x,y are resp : \n", + "2.0*x*(1 + 1.0*(a*x)**0.5/x)**2 + x\n", + "-2.0*x**2*(a*x)**(-0.5)*(1 + 1.0*(a*x)**1.0/x**2) + 2*(a*x)**0.5\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"The centre of curvature\"\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "y = sympy.Symbol('y')\n", + "y = 2*(a*x)**0.5\n", + "y1 = sympy.diff(y,x,1)\n", + "y2 = sympy.diff(y,x,2)\n", + "xx = x-y1*(1+y1)**2/y2\n", + "yy = y+(1+y1**2)/y2\n", + "print \"the coordinates x,y are resp : \"\n", + "print xx\n", + "print yy" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Examle 4.48, page no. 177" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "centre of curvature of given cycloid\n", + "the coordinates x,y are resp : \n", + "a*(t - sin(t)) - (a*sin(t) + 1)**2*sin(t)/cos(t)\n", + "a*(-cos(t) + 1) + (a**2*sin(t)**2 + 1)/(a*cos(t))\n", + "which another parametric equation of cycloid\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"centre of curvature of given cycloid\"\n", + "a = sympy.Symbol('a')\n", + "t = sympy.Symbol('t')\n", + "x = a*(t-sympy.sin(t))\n", + "y = a*(1-sympy.cos(t))\n", + "y1 = sympy.diff(y,t,1)\n", + "y2 = sympy.diff(y,t,2)\n", + "xx = x-y1*(1+y1)**2/y2 \n", + "yy = y+(1+y1**2)/y2\n", + "print \"the coordinates x,y are resp : \"\n", + "print xx\n", + "print yy\n", + "print \"which another parametric equation of cycloid\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.52, page no. 180" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the maxima and minima of given function put f1(x)=0\n", + "[-1, 1/2, 1]\n" + ] + } + ], + "source": [ + "import sympy\n", + "print 'To find the maxima and minima of given function put f1(x)=0'\n", + "x = sympy.Symbol('x')\n", + "f=3*x**4-2*x**3-6*x**2+6*x+1\n", + "k = sympy.diff(f,x)\n", + "x = sympy.poly(0,x)\n", + "k = sympy.solve(k)\n", + "print k" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.61, page no. 188" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "to find the assymptote of given curve\n", + "assymptotes parallel to x−axis is given by f1=0 where f1 is : \n", + "[1, -1, -1, 1, 1, 1]\n", + "assymptotes parallel to y−axis is given by f 2=0 and f2 is : \n", + "x**2*y**2 - x**2*y - x*y**2 + x + y + 1\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "print \"to find the assymptote of given curve\"\n", + "x = sympy.Symbol('x')\n", + "y = sympy.Symbol('y')\n", + "f = x**2*y**2-x**2*y-x*y**2+x+y+1\n", + "f1 = sympy.poly(f,y,x)\n", + "f1 = f1.coeffs()\n", + "print \"assymptotes parallel to x−axis is given by f1=0 where f1 is : \"\n", + "print sympy.factor(f1)\n", + "f2 = sympy.poly(f,y,x)\n", + "print \"assymptotes parallel to y−axis is given by f 2=0 and f2 is : \"\n", + "print sympy.factor(f2)" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter5.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter5.ipynb new file mode 100644 index 00000000..2056bd4b --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter5.ipynb @@ -0,0 +1,317 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 : Partial Differentiation And Its Applications" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 5.5, page no. 195" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2*(4*x**2/(x**2 + y**2 + z**2) - 1)/(x**2 + y**2 + z**2)**2 + 2*(4*y**2/(x**2 + y**2 + z**2) - 1)/(x**2 + y**2 + z**2)**2 + 2*(4*z**2/(x**2 + y**2 + z**2) - 1)/(x**2 + y**2 + z**2)**2\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "x = sympy.Symbol('x')\n", + "y = sympy.Symbol('y')\n", + "z = sympy.Symbol('z')\n", + "v = (x**2+y**2+z**2)**(-1/2)\n", + "a = sympy.diff(v,x,2)\n", + "b = sympy.diff(v,y,2)\n", + "c = sympy.diff(v,z,2)\n", + "print a+b+c" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.14, page no. 203" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x*(-0.5*x**(-0.5)*(x + y)/(x**0.5 + y**0.5)**2 + 1/(x**0.5 + y**0.5))/sqrt(1 - (x + y)**2/(x**0.5 + y**0.5)**2) + y*(-0.5*y**(-0.5)*(x + y)/(x**0.5 + y**0.5)**2 + 1/(x**0.5 + y**0.5))/sqrt(1 - (x + y)**2/(x**0.5 + y**0.5)**2)\n", + "0\n", + "x**2*((0.25*x**(-1.5)*(x + y)/(x**0.5 + y**0.5)**2 + 0.5*x**(-1.0)*(x + y)/(x**0.5 + y**0.5)**3 - 1.0*x**(-0.5)/(x**0.5 + y**0.5)**2)/sqrt(1 - (x + y)**2/(x**0.5 + y**0.5)**2) + (-0.5*x**(-0.5)*(x + y)**2/(x**0.5 + y**0.5)**3 + (2*x + 2*y)/(2*(x**0.5 + y**0.5)**2))*(-0.5*x**(-0.5)*(x + y)/(x**0.5 + y**0.5)**2 + 1/(x**0.5 + y**0.5))/(1 - (x + y)**2/(x**0.5 + y**0.5)**2)**(3/2)) + 2*x*y*((0.5*x**(-0.5)*y**(-0.5)*(x + y)/(x**0.5 + y**0.5)**3 - 0.5*x**(-0.5)/(x**0.5 + y**0.5)**2 - 0.5*y**(-0.5)/(x**0.5 + y**0.5)**2)/sqrt(1 - (x + y)**2/(x**0.5 + y**0.5)**2) + (-0.5*x**(-0.5)*(x + y)**2/(x**0.5 + y**0.5)**3 + (2*x + 2*y)/(2*(x**0.5 + y**0.5)**2))*(-0.5*y**(-0.5)*(x + y)/(x**0.5 + y**0.5)**2 + 1/(x**0.5 + y**0.5))/(1 - (x + y)**2/(x**0.5 + y**0.5)**2)**(3/2)) + y**2*((0.25*y**(-1.5)*(x + y)/(x**0.5 + y**0.5)**2 + 0.5*y**(-1.0)*(x + y)/(x**0.5 + y**0.5)**3 - 1.0*y**(-0.5)/(x**0.5 + y**0.5)**2)/sqrt(1 - (x + y)**2/(x**0.5 + y**0.5)**2) + (-0.5*y**(-0.5)*(x + y)**2/(x**0.5 + y**0.5)**3 + (2*x + 2*y)/(2*(x**0.5 + y**0.5)**2))*(-0.5*y**(-0.5)*(x + y)/(x**0.5 + y**0.5)**2 + 1/(x**0.5 + y**0.5))/(1 - (x + y)**2/(x**0.5 + y**0.5)**2)**(3/2))\n", + "-(x + y)*cos(2*asin((x + y)/(x**0.5 + y**0.5)))/(4*(1 - (x + y)**2/(x**0.5 + y**0.5)**2)**(3/2)*(x**0.5 + y**0.5))\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "x = sympy.Symbol('x')\n", + "y = sympy.Symbol('y')\n", + "u = sympy.asin((x+y)/(x**0.5+y**0.5))\n", + "a = sympy.diff(u,x)\n", + "b = sympy.diff(u,y)\n", + "c = sympy.diff(a,x)\n", + "d = sympy.diff(b,y)\n", + "e = sympy.diff(b,x)\n", + "print x*a+y*b\n", + "print (1/2)*sympy.tan(u)\n", + "print (x**2)*c+2*x*y*e+(y**2)*d\n", + "print (-sympy.sin(u)*sympy.cos(2*u))/(4*(sympy.cos(u))**3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.25.1, page no. 204" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "r*sin(l)**2 + r*cos(l)**2\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "r = sympy.Symbol('r')\n", + "l = sympy.Symbol('l')\n", + "x = r*sympy.cos(l)\n", + "y = r*sympy.sin(l)\n", + "a = sympy.diff(x,r)\n", + "b = sympy.diff(x,l)\n", + "c = sympy.diff(y,r)\n", + "d = sympy.diff(y,l)\n", + "A = sympy.Matrix([[a,b],[c,d]])\n", + "print A.det()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.25.2, page no. 204" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "r*sin(l)**2 + r*cos(l)**2\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "r = sympy.Symbol('r')\n", + "l = sympy.Symbol('l')\n", + "z = sympy.Symbol('z')\n", + "x = r*sympy.cos(l)\n", + "y = r*sympy.sin(l)\n", + "m = z\n", + "a = sympy.diff(x,r)\n", + "b = sympy.diff(x,l)\n", + "c = sympy.diff(x,z)\n", + "d = sympy.diff(y,r)\n", + "e = sympy.diff(y,l)\n", + "f = sympy.diff(y,z)\n", + "g = sympy.diff(m,r)\n", + "h = sympy.diff(m,l)\n", + "i = sympy.diff(m,z)\n", + "A = sympy.Matrix([[a,b,c],[d,e,f],[g,h,i]])\n", + "print A.det()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.25.3, page no. 205" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "r**2*sin(l)**2*sin(m)**3 + r**2*sin(l)**2*sin(m)*cos(m)**2 + r**2*sin(m)**3*cos(l)**2 + r**2*sin(m)*cos(l)**2*cos(m)**2\n" + ] + } + ], + "source": [ + "import sympy,numpy\n", + "\n", + "r = sympy.Symbol('r')\n", + "l = sympy.Symbol('l')\n", + "m = sympy.Symbol('m')\n", + "x = r*sympy.cos(l)*sympy.sin(m)\n", + "y = r*sympy.sin(l)*sympy.sin(m)\n", + "z = r*sympy.cos(m)\n", + "a = sympy.diff(x,r)\n", + "b = sympy.diff(x,m)\n", + "c = sympy.diff(x,l)\n", + "d = sympy.diff(y,r)\n", + "e = sympy.diff(y,m)\n", + "f = sympy.diff(y,l)\n", + "g = sympy.diff(z,r)\n", + "h = sympy.diff(z,m)\n", + "i = sympy.diff(z,l)\n", + "A = sympy.Matrix([[a,b,c],[d,e,f],[g,h,i]])\n", + "print A.det()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.26, page no. 206" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "x1 = sympy.Symbol('x1')\n", + "x2 = sympy.Symbol('x2')\n", + "x3 = sympy.Symbol('x3')\n", + "y1 =(x2*x3)/x1\n", + "y2 =(x3*x1)/x2\n", + "y3 =(x1*x2)/x3\n", + "a = sympy.diff(y1,x1)\n", + "b = sympy.diff(y1,x2)\n", + "c = sympy.diff(y1,x3)\n", + "d = sympy.diff(y2,x1)\n", + "e = sympy.diff(y2,x2)\n", + "f = sympy.diff(y2,x3)\n", + "g = sympy.diff(y3,x1)\n", + "h = sympy.diff(y3,x2)\n", + "i = sympy.diff(y3,x3)\n", + "A = sympy.Matrix([[a,b,c],[d,e,f],[g,h,i]])\n", + "print A.det()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 5.30, page no. 210" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-1.0*x*y*(-x**2 + 1)**(-0.5)/sqrt(-y**2 + 1) + 1.0*x*y*(-y**2 + 1)**(-0.5)/sqrt(-x**2 + 1)\n" + ] + } + ], + "source": [ + "import sympy,numpy\n", + "\n", + "x = sympy.Symbol('x')\n", + "y = sympy.Symbol('y')\n", + "u = x*(1-y**2)**0.5+y*(1-x**2)**0.5\n", + "v = sympy.asin(x)+sympy.asin(y)\n", + "a = sympy.diff(u,x)\n", + "b = sympy.diff(u,y)\n", + "c = sympy.diff(v,x)\n", + "d = sympy.diff(v,y)\n", + "A = sympy.Matrix([[a,b],[c,d]])\n", + "print A.det()" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter6.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter6.ipynb new file mode 100644 index 00000000..302dbf98 --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter6.ipynb @@ -0,0 +1,742 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6 : Integration And Its Applications" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.1.1, page no. 199" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Indefinite integral\n", + "3*x/8 - sin(x)**3*cos(x)/4 - 3*sin(x)*cos(x)/8\n" + ] + } + ], + "source": [ + "import sympy,numpy\n", + "\n", + "print \"Indefinite integral\"\n", + "x = sympy.Symbol('x')\n", + "f = sympy.integrate((sympy.sin(x))**4,(x))\n", + "print f" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.1.2, page no. 200" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Indefinite integral\n", + "-sin(x)**7/7 + 3*sin(x)**5/5 - sin(x)**3 + sin(x)\n" + ] + } + ], + "source": [ + "import sympy,numpy\n", + "\n", + "print \"Indefinite integral\"\n", + "x = sympy.Symbol('x')\n", + "f = sympy.integrate((sympy.cos(x))**7,(x))\n", + "print f" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.2.1, page no. 202" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Definite integral\n", + "0.490873852123\n" + ] + } + ], + "source": [ + "import sympy,numpy,math\n", + "\n", + "print \"Definite integral\"\n", + "x = sympy.Symbol('x')\n", + "f = sympy.integrate((sympy.cos(x))**6,(x,0,math.pi/2))\n", + "print float(f)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.2.2, page no. 202" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Definite integral\n", + "zoo*a**6 + a**6*log(-2*a**2)/4 - 11*a**6/24\n" + ] + } + ], + "source": [ + "import sympy,numpy,math\n", + "\n", + "print \"Definite integral\"\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "g = x**7/(a**2-x**2)**1/2\n", + "f = sympy.integrate(g,(x,0,a))\n", + "print f" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.2.3, page no. 203" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Definite integral\n", + "4*a**4\n" + ] + } + ], + "source": [ + "import sympy,numpy,math\n", + "\n", + "print \"Definite integral\"\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "g = x**3*(2*a*x-x**2)**(1/2) \n", + "f = sympy.integrate(g,(x,0,2*a))\n", + "print f" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.2.4, page no. 204" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Definite integral\n", + "0.5*(a**2 + 0.5625)**(-n) + 0.5*(a**2 + 0.0625)**(-n)\n" + ] + } + ], + "source": [ + "from sympy.abc import x,a,n\n", + "from sympy.integrals import Integral\n", + "print \"Definite integral\"\n", + "g = 1./(a**2+x**2)**n \n", + "f = Integral(g,(x,0,1))\n", + "print f.as_sum(2).n()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.4.1, page no. 207" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Definite integral\n", + "0.0532891345937363\n" + ] + } + ], + "source": [ + "from sympy.abc import x,a,n\n", + "from sympy.integrals import Integral\n", + "import sympy, math\n", + "print \"Definite integral\"\n", + "g = (sympy.sin(6*x))**3*(sympy.cos(3*x))**7\n", + "f = Integral(g,(x,0,math.pi/6))\n", + "print f.as_sum(2).n()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.4.2, page no. 208" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Definite integral\n", + "0.0571428571429\n" + ] + } + ], + "source": [ + "import sympy,numpy,math\n", + "\n", + "print \"Definite integral\"\n", + "x = sympy.Symbol('x')\n", + "g = (sympy.sin(6*x))**3*(sympy.cos(3*x))**7\n", + "g = x**4*(1-x**2)**(3/2)\n", + "f = sympy.integrate(g,(x,0,1)) \n", + "print float(f)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.5, page no. 208" + ] + }, + { + "cell_type": "code", + "execution_count": 63, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Definite integral\n", + "Enter n : 0\n", + "Enter m : 1\n", + "1.0\n", + "1.0\n", + "Equal\n" + ] + } + ], + "source": [ + "import sympy,numpy,math\n", + "\n", + "print \"Definite integral\"\n", + "x = sympy.Symbol('x')\n", + "m = sympy.Symbol('m')\n", + "n = sympy.Symbol('n')\n", + "n = int(raw_input(\"Enter n : \"))\n", + "m = int(raw_input(\"Enter m : \"))\n", + "g =(sympy.cos(x))**m*sympy.cos(n*x)\n", + "f = sympy.integrate(g,(x,0,math.pi/2))\n", + "print float(f) \n", + "g2 =(sympy.cos(x))**(m-1)*sympy.cos((n-1)*x)\n", + "f2 = m/(m+n)*sympy.integrate(g2,(x,0,math.pi/2))\n", + "print float(f2)\n", + "print \"Equal\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.6.1, page no. 210" + ] + }, + { + "cell_type": "code", + "execution_count": 65, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Definite integral\n", + "Enter n : 1\n", + "Piecewise((x*exp(-I*x)*sin(x)/2 - I*x*exp(-I*x)*cos(x)/2 - exp(-I*x)*cos(x)/2, a == -I), (x*exp(I*x)*sin(x)/2 + I*x*exp(I*x)*cos(x)/2 - exp(I*x)*cos(x)/2, a == I), (a*exp(a*x)*sin(x)/(a**2 + 1) - exp(a*x)*cos(x)/(a**2 + 1), True))\n" + ] + } + ], + "source": [ + "import sympy,numpy,math\n", + "\n", + "print \"Definite integral\"\n", + "x = sympy.Symbol('x')\n", + "a = sympy.Symbol('a')\n", + "n = int(raw_input(\"Enter n : \"))\n", + "g = sympy.exp(a*x)*(sympy.sin(x))**n\n", + "f = sympy.integrate(g,(x))\n", + "print f" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.7.1, page no. 212" + ] + }, + { + "cell_type": "code", + "execution_count": 66, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(4*sin(x)**2 - 3)/(4*sin(x)**4 - 8*sin(x)**2 + 4) - log(sin(x)**2 - 1)/2\n" + ] + } + ], + "source": [ + "import sympy,numpy,math\n", + "\n", + "x = sympy.Symbol('x')\n", + "print sympy.integrate(sympy.tan(x)**5,(x))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.8, page no. 215" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Enter the value of n : 3\n", + "n(p+q)= 0.999999999999999\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "n = int(raw_input(\"Enter the value of n : \"))\n", + "p = sympy.integrate((sympy.tan(x))**(n-1),('x',0,math.pi/4))\n", + "q = sympy.integrate((sympy.tan(x))**(n+1),('x',0,math.pi/4))\n", + "print \"n(p+q)= \",\n", + "print n*(p+q)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.9.1, page no. 217" + ] + }, + { + "cell_type": "code", + "execution_count": 69, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1.33333333333333\n" + ] + } + ], + "source": [ + "import sympy,numpy,math\n", + "\n", + "x = sympy.Symbol('x')\n", + "g = sympy.sec(x)**4\n", + "print sympy.integrate(g,('x',0,math.pi/4))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.9.2, page no. 217" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.607986405500361\n" + ] + } + ], + "source": [ + "import sympy,numpy,math\n", + "x = sympy.Symbol('x')\n", + "print sympy.integrate('1/sin(x)**3',('x',math.pi/3,math.pi/2))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.10, page no. 220" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.000362418686373\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "from sympy.abc import x\n", + "from sympy.integrals import Integral\n", + "import sympy, math\n", + "g = x*sympy.sin(x)**6*sympy.cos(x)**4\n", + "f = Integral(g,(x,0,math.pi/6))\n", + "print float(f)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.12, page no. 221" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.785398163397\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "from sympy.abc import x\n", + "from sympy.integrals import Integral\n", + "x = sympy.Symbol('x')\n", + "a = math.pi/2\n", + "f = (sympy.sin(x)**0.5)/(sympy.sin(x)**0.5+sympy.cos(x)**0.5)\n", + "f = Integral(f,(x, 0, a))\n", + "print float(f)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.13, page no. 223" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The summation is equivalent to integration of 1/(1+xˆ2) from 0 to 1\n", + "0.785398163397\n" + ] + } + ], + "source": [ + "import sympy,numpy,math\n", + "\n", + "x = sympy.Symbol('x')\n", + "print \"The summation is equivalent to integration of 1/(1+xˆ2) from 0 to 1\"\n", + "g = 1/(1+x**2)\n", + "f = sympy.integrate(g,(x,0,1))\n", + "print float(f)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.14, page no. 223" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The summation is equivalent to integration of log(1+x) from 0 to 1\n", + "0.38629436112\n" + ] + } + ], + "source": [ + "import sympy,numpy,math\n", + "\n", + "x = sympy.Symbol('x')\n", + "print \"The summation is equivalent to integration of log(1+x) from 0 to 1\"\n", + "g = sympy.log(1+x)\n", + "f = sympy.integrate(g,(x,0,1))\n", + "print float(f) " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.15, page no. 225" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.0337339994178\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "from sympy.integrals import Integral\n", + "f = Integral(x*sympy.sin(x)**8*sympy.cos(x)**4,(x,0,math.pi))\n", + "print float(f)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.16, page no. 226" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-1.08879304515\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "from sympy.integrals import Integral\n", + "x = sympy.Symbol('x')\n", + "#f = sympy.integrate(sympy.log(sympy.sin(x)),('x',0,math.pi/2))\n", + "f = Integral(sympy.log(sympy.sin(x)), (x, 0, 1.5707963267949))\n", + "print float(f)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 6.24, page no. 234" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "from the graph, it is clear that the points of intersection are x=−4 and x =8.\n", + "So, our region of integration is from x=−4 to x=8\n", + "36\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAEZCAYAAACervI0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xd8VNW2wPHfSiihg0roTRAEBETEggiDSHmCYrt4UfSK\niGJB0ateEZRw8aqgIioqgtJUfKgIUkIVhiIiIL1DIFwRhdCkJSQk6/0xQ94kmZBJyJRk1vfzyYfM\nzClrhslZ56y9z96iqhhjjAk/EcEOwBhjTHBYAjDGmDBlCcAYY8KUJQBjjAlTlgCMMSZMWQIwxpgw\nZQnAmBAhIg4R+S3YcZjwYQnAFHgiEi8iZ0Xk0kzPrxORNBGpmcftXisis0TkqIgcE5EtIvK6iJTP\nn8iNCS5LAKYwUGAP0OP8EyLSBCjhfi3XRKQVsBhYBjRQ1QpAZ+Ac0CybdSLzsi9jgsUSgCksvgQe\n8nj8D2ASIAAi0lJE/hQROb+AiNwtIuuz2d5wYJyqDlPVBABV/U1VY1R1iXv9h0XkJxEZISKHgcEi\ncrmILBKRwyKSICJfikg5j33Gi8jL7quJoyIyTkSKe+5YRJ4XkYMickBEHr74j8YY7ywBmMJiJVBW\nRK50n4nfhyspAKCqq4EjQCePdR4EJmbekIiUAm4Apvqw3+uAOCAaeANXwvkPUAVoCNQAYjKtcz/Q\nEagL1AcGebxWGSgLVAV6Ax95JhBj8pMlAFOYfIHrKqADsBX4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QlAGOMCVOWAIwxJkz9HyYVVEuO\nlWV1AAAAAElFTkSuQmCC\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7faae1cad790>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%matplotlib inline\n", + "import matplotlib.pyplot as plt\n", + "import numpy\n", + "import math\n", + "\n", + "x = numpy.linspace(-5,10,70)\n", + "y1 = (x+8)/2\n", + "y2 = x**2/8\n", + "\n", + "plt.xlabel('X axis')\n", + "plt.ylabel('Y axis')\n", + "plt.title('My Graph')\n", + "plt.plot(x, y1, \"o-\" )\n", + "plt.plot(x, y2, \"+-\" )\n", + "plt.legend([\"(x+8)/2\",\"x**2/8\"])\n", + "print \"from the graph, it is clear that the points of intersection are x=−4 and x =8.\"\n", + "print \"So, our region of integration is from x=−4 to x=8\"\n", + "print sympy.integrate('(x+8)/2-x**2/8',('x',-4,8))" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter9.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter9.ipynb new file mode 100644 index 00000000..735ec6e3 --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter9.ipynb @@ -0,0 +1,476 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 9 : Infinite Series" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.1, page no. 302" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1/3\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "n = sympy.Symbol('n')\n", + "f = ((1/n)**2-2*(1/n))/(3*(1/n)**2+(1/n))\n", + "print sympy.limit(f,n,0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.1.3, page no. 303" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4\n" + ] + } + ], + "source": [ + "import sympy\n", + "n = sympy.Symbol('n')\n", + "f = 3+(-1)**n\n", + "print sympy.limit(f,n,100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.2.1, page no. 304" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1+2+3+4+5+6+7+....+n + . . . . . = oo\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "n = sympy.Symbol('n')\n", + "print \"1+2+3+4+5+6+7+....+n + . . . . . = \",\n", + "p = 1/n*(1/n+1)/2\n", + "print sympy.limit(p,n,0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.2.2, page no. 304" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "5−4−1+5−4−1+5−4−1+5−4−1+.........=0,5,1 according to the no. of terms.\n", + "clearly, in this case sum doesnt tend to a unique limit. hence, series is oscillatory.\n" + ] + } + ], + "source": [ + "print \"5−4−1+5−4−1+5−4−1+5−4−1+.........=0,5,1 according to the no. of terms.\"\n", + "print \"clearly, in this case sum doesnt tend to a unique limit. hence, series is oscillatory.\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.5.1, page no. 308" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2\n", + "both u and v converge and diverge together, hence u is convergent\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "n = sympy.Symbol('n')\n", + "v = 1/((1/n)**2)\n", + "u = (2/n-1)/(1/n*(1/n +1)*(1/n +2))\n", + "print sympy.limit(u/v,n,0)\n", + "print \"both u and v converge and diverge together, hence u is convergent\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.5.2, page no. 308" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "oo\n", + "both u and v converge and diverge together, hence u is divergent\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "n = sympy.Symbol('n')\n", + "v = 1/((1/n)**2)\n", + "u = ((1/n)**2)/((3/n+1)*(3/n+4)*(3/n+7))\n", + "print sympy.limit(u/v,n,0)\n", + "print \"both u and v converge and diverge together, hence u is divergent\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.7.1, page no. 312" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "u=((n+1)^0.5−1)/((n+2)^3−1)=>\n", + "0\n", + "since, v is convergent, so u is also conzavergent.\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "n = sympy.Symbol('n')\n", + "print \"u=((n+1)^0.5−1)/((n+2)^3−1)=>\"\n", + "u = ((1+1/(1/n))-(1/n)**(-0.5))/(((1/n)**5/2)*((1+2/(1/n))**3-(1/n)**(-3)))\n", + "v = (1/n)**(-5/2)\n", + "print sympy.limit(u/v,n,0)\n", + "print 'since, v is convergent, so u is also conzavergent.'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.7.3, page no. 313" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "-log(log(2)) + +inf\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "n = sympy.Symbol('n')\n", + "print sympy.integrate(1/(n*sympy.log(n)),(n,2,numpy.inf))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.8.1, page no. 314" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x**(-2)\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "n = sympy.Symbol('n')\n", + "x = sympy.Symbol('x')\n", + "u = (x**(2*(1/n)-2))/(((1/n)+1)*(1/n)**0.5)\n", + "v = (x**(2*(1/n)))/((1/n+2)*(1/n+1)**0.5)\n", + "print sympy.limit(u/v,n,0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.8.2, page no. 314" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1/x\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "n = sympy.Symbol('n')\n", + "x = sympy.Symbol('x')\n", + "u = ((2**(1/n)-2)*(x**(1/n-1)))/(2**(1/n)+1)\n", + "v = ((2**((1/n)+1)-2)*(x**(1/n)))/(2**(1/n+1)+1)\n", + "print sympy.limit(u/v,n,0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.10.1, page no. 316" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(x + 1)/(2*x)\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "n = sympy.Symbol('n')\n", + "x = sympy.Symbol('x')\n", + "u = 1/(1+x**(-n))\n", + "v = 1/(1+x**(-n-1))\n", + "print sympy.limit(u/v,n,0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.10.2, page no. 316" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "1\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "n = sympy.Symbol('n')\n", + "a = sympy.Symbol('a')\n", + "b = sympy.Symbol('b')\n", + "l = (b+1/n)/(a+1/n)\n", + "print sympy.limit(l,n,0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.11.1, page no. 317" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "u=((4.7....(3n+1))∗xˆn)/(1.2.....n)\n", + "v=((4.7....(3n+4)∗xˆ(n+1))/(1.2.....(n+1))\n", + "l=u/v=> 1/(3*x)\n" + ] + } + ], + "source": [ + "import numpy,sympy\n", + "\n", + "n = sympy.Symbol('n')\n", + "x = sympy.Symbol('x')\n", + "print \"u=((4.7....(3n+1))∗xˆn)/(1.2.....n)\"\n", + "print \"v=((4.7....(3n+4)∗xˆ(n+1))/(1.2.....(n+1))\"\n", + "print \"l=u/v=>\",\n", + "l = (1+n)/((3+4*n)*x)\n", + "print sympy.limit(l,n,0)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 9.11.2, page no. 318" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4/x**2\n" + ] + } + ], + "source": [ + "import numpy,sympy,math\n", + "\n", + "n = sympy.Symbol('n')\n", + "x = sympy.Symbol('x')\n", + "u = (((sympy.factorial(n))**2)*x**(2*n))/sympy.factorial(2*n)\n", + "v = (((sympy.factorial(n+1))**2)*x**(2*(n+1)))/sympy.factorial(2*(n+1))\n", + "print sympy.limit(u/v,n,numpy.inf )" + ] + } + ], + "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.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/screenshots/screen1.png b/Higher_Engineering_Mathematics_by_B._S._Grewal/screenshots/screen1.png Binary files differnew file mode 100644 index 00000000..f54af014 --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/screenshots/screen1.png diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/screenshots/screen2.png b/Higher_Engineering_Mathematics_by_B._S._Grewal/screenshots/screen2.png Binary files differnew file mode 100644 index 00000000..7a62e760 --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/screenshots/screen2.png diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/screenshots/screen3.png b/Higher_Engineering_Mathematics_by_B._S._Grewal/screenshots/screen3.png Binary files differnew file mode 100644 index 00000000..babda72b --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/screenshots/screen3.png diff --git a/sample_notebooks/ManikandanD/Chapter_2_Light_propagation_in_optical_fiber.ipynb b/sample_notebooks/ManikandanD/Chapter_2_Light_propagation_in_optical_fiber.ipynb new file mode 100644 index 00000000..fb6cc7a3 --- /dev/null +++ b/sample_notebooks/ManikandanD/Chapter_2_Light_propagation_in_optical_fiber.ipynb @@ -0,0 +1,430 @@ +{
+ "metadata": {
+ "name": "",
+ "signature": "sha256:e126fa636efa72af4b20cd3702da45f085d125811e3d4b6de05ba5fde96d2c77"
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 2:Light propagation in optical ber"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.1 , Page no:30"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#initialisation of variables\n",
+ "ncore=1.46; #refractive index of core\n",
+ "nclad=1; #refractive index of cladding\n",
+ "c=3e5; #velocity of light in Km/s\n",
+ "L=1; #length of path in Km\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "NA=math.sqrt(ncore**2-nclad**2); #Numerical aperture\n",
+ "delt_tau_by_L=(NA**2)/(2*c*ncore); #multipath pulse broadening in s/Km\n",
+ "delt_tau=delt_tau_by_L*L; #bandwidth distance product Hz\n",
+ "BL=(1/delt_tau)*L; #bandwidth distance product Hz\n",
+ "#case-2\n",
+ "ncore1=1.465; #refractive index of core\n",
+ "nclad1=1.45; #refractive index of cladding\n",
+ "NA1=math.sqrt(ncore1**2-nclad1**2); #Numerical aperture\n",
+ "delt_tau_by_L1=(NA1**2)/(2*c*ncore1); #multipath pulse broadening in s/m\n",
+ "BL1=(1/delt_tau_by_L1)*L; #bandwidth distance product Hz\n",
+ "\n",
+ "#RESULTS\n",
+ "print\"Numerical aperture=\",round(NA,5); #The answers vary due to round off error\n",
+ "print\"\\nMultipath pulse broadening=\",round(delt_tau_by_L*1e9,5),\"ns/Km\"; #The answer provided in the textbook is wrong//multiplication by 1e9 to convert s/Km to ns/Km \n",
+ "print\"\\nBandwidth distance product=\",round(BL*1e-6,5),\"GHz \"; #The answer provided in the textbook is wrong//multiplication by 1e-6 to convert Hz to MHz\n",
+ "print\"\\n\\nNumerical aperture=\",round(NA1,5);\n",
+ "print\"\\nMultipath pulse broadening=\",round(delt_tau_by_L1*1e9,5),\"ns/Km\"; #The answer provided in the textbook is wrong//multiplication by 1e9 to convert s/Km to ns/Km \n",
+ "print\"\\nBandwidth distance product=\",round(BL1*1e-9,5),\"GHz \"; #The answer provided in the textbook is wrong//multiplication by 1e-6 to convert Hz to GHz"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Numerical aperture= 1.06377\n",
+ "\n",
+ "Multipath pulse broadening= 1291.78082 ns/Km\n",
+ "\n",
+ "Bandwidth distance product= 0.77413 GHz \n",
+ "\n",
+ "\n",
+ "Numerical aperture= 0.20911\n",
+ "\n",
+ "Multipath pulse broadening= 49.74403 ns/Km\n",
+ "\n",
+ "Bandwidth distance product= 0.0201 GHz \n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.2 , Page no:30"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#initialisation of variables\n",
+ "lamda1=0.7; #wavelength in um\n",
+ "lamda2=1.3; #wavelength in um\n",
+ "lamda3=2; #wavelength in um\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "f_lambda1=(303.33*(lamda1**-1)-233.33); #equation for lambda1\n",
+ "f_lambda2=(303.33*(lamda2**-1)-233.33); #equation for lambda2\n",
+ "f_lambda3=(303.33*(lamda3**-1)-233.33); #equation for lambda3\n",
+ "\n",
+ "#RESULTS\n",
+ "print\"Material dispersion at Lambda 0.7um=\",round(f_lambda1,5);\n",
+ "print\"\\nMaterial dispersion at Lambda 1.3um=\",round(f_lambda2,5); #The answers vary due to round off error\n",
+ "print\"\\nMaterial dispersion at Lambda 2um=\",round(f_lambda3,5); #The answers vary due to round off error\n",
+ "print\"\\nIts is a standard silica fiber\";"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Material dispersion at Lambda 0.7um= 199.99857\n",
+ "\n",
+ "Material dispersion at Lambda 1.3um= 0.00077\n",
+ "\n",
+ "Material dispersion at Lambda 2um= -81.665\n",
+ "\n",
+ "Its is a standard silica fiber\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.3 , Page no:32"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#initialisation of variables\n",
+ "ncore=1.505; #refractive index of core\n",
+ "nclad=1.502; #refractive index of cladding\n",
+ "V=2.4; #v no. for single mode \n",
+ "lambda1=1300e-9; #operating wavelength in m\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "NA=math.sqrt(ncore**2-nclad**2); #numerical aperture\n",
+ "a=V*(lambda1)/(2*3.14*NA); #dimension of fiber core in m\n",
+ "\n",
+ "#RESULTS\n",
+ "print\"The numarical aperture =\",round(NA,5);\n",
+ "print\"\\n Dimension of fiber core =\",round(a*1e6,5),\"um\"; #multiplication by 1e6 to convert unit from m to um"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "The numarical aperture = 0.09498\n",
+ "\n",
+ " Dimension of fiber core = 5.23079 um\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.4 , Page no:33"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#initialisation of variables\n",
+ "V=2; #v no. for single mode \n",
+ "a=4; #radius of fiber in um\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "w=a*(0.65+1.619*V**(-3/2)+2.87*V**-6); #effective mode radius in um\n",
+ "\n",
+ "#RESULTS\n",
+ "print\"Effective mode radius =\",round(w,5),\"um\";"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Effective mode radius = 5.06899 um\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.6 , Page no:34"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#initialisation of variables\n",
+ "m=0; #for dominant mode\n",
+ "v=0; #for dominant mode\n",
+ "n1=1.5; #refractive index of core\n",
+ "delta=0.01; #core clad index difference\n",
+ "a=5; #fiber radius in um\n",
+ "lambda1=1.3; #wavelength of operation in um\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "k0=(2*3.14/lambda1); #constant in /m\n",
+ "beta=math.sqrt((k0**2)*(n1**2)-(2*k0*n1*math.sqrt(2*delta)/a)); #propagation constant in rad/um\n",
+ "\n",
+ "#RESULTS\n",
+ "print\"Propagation constant=\",round(beta,5),\"rad/um\"; #The answers vary due to round off error"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Propagation constant= 7.21781 rad/um\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.8 , Page no:34"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#initialisation of variables\n",
+ "M=1000; #modes supported\n",
+ "lambda1=1.3; #operating wavelength in um\n",
+ "n1=1.5; #refractive index of core\n",
+ "n2=1.48; #refractive index of cladding\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "V=math.sqrt(2*M); #normalised frequency V no.\n",
+ "NA=math.sqrt(n1**2-n2**2); #numerical apperture\n",
+ "R=lambda1*V/(2*3.14*NA); #radius of fiber in um\n",
+ "\n",
+ "#RESULTS\n",
+ "print\"Core Radius=\",round(R,5),\"um\"; #The answer provided in the textbook is wrong"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Core Radius= 37.92063 um\n"
+ ]
+ }
+ ],
+ "prompt_number": 6
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.9 , Page no:35"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#initialisation of variables\n",
+ "lambda1=1.3; #wavelength of operation in um\n",
+ "n1=1.5; #refractive index of core\n",
+ "n2=1.48; #refractive index of cladding\n",
+ "k0=2*3.14/lambda1; #constant in /m\n",
+ "\n",
+ "#CALCULATIONS\n",
+ "#case-1\n",
+ "b=0.5; #normalized propagation constant\n",
+ "k0=2*3.14/lambda1; #constant\n",
+ "beta=k0*math.sqrt(n2**2+b*(n1**2-n2**2)); #propagation constant\n",
+ "\n",
+ "#case-2\n",
+ "#given \n",
+ "lambda1=1.3; #wavelength of operation in um\n",
+ "n1=1.5; #refractive index of core\n",
+ "n2=1.48; #refractive index of cladding\n",
+ "k0=2*3.14/lambda1; #constant in /m\n",
+ "b=0.5; #normalized propagation constant\n",
+ "k0=2*3.14/lambda1; #constant\n",
+ "b1=(((n1+n2)/2)**2-n2**2)/(n1**2-n2**2); #normalized propagation constant\n",
+ "\n",
+ "#case-3\n",
+ "#given \n",
+ "lambda1=1.3; #wavelength of operation in um\n",
+ "n1=1.5; #refractive index of core\n",
+ "n21=1.0; #refractive index of cladding\n",
+ "k0=2*3.14/lambda1; #constant in /m\n",
+ "b=0.5; #normalized propagation constant\n",
+ "k0=2*3.14/lambda1; #constant\n",
+ "beta1=k0*math.sqrt(n21**2+b*(n1**2-n21**2)); #propagation constant\n",
+ "\n",
+ "#RESULTS\n",
+ "print\"Propagation constant=\",round(beta,5),\"rad/um\"; #The answers vary due to round off error\n",
+ "print\"\\nPropagation constant=\",round(b1,5); #The answers vary due to round off error\n",
+ "print\"\\nPropagation constant=\",round(beta1,5),\"rad/um\"; #The answers vary due to round off error"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Propagation constant= 7.19801 rad/um\n",
+ "\n",
+ "Propagation constant= 0.49832\n",
+ "\n",
+ "Propagation constant= 6.15805 rad/um\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 2.10 , Page no:35"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "import math\n",
+ "from __future__ import division\n",
+ "\n",
+ "#initialisation of variables\n",
+ "#case-1\n",
+ "n1=1.49; #refractive index of core\n",
+ "n2=1.46; #refractive index of cladding\n",
+ "c=3*10**5; #speed of light in Km/s\n",
+ "t1=n1/c; #time delay for one traveling along axis in s/Km\n",
+ "t2=(n1**2/n2)/c; #time delay for one traveling along path that is totally reflecting at the first interface in s/km\n",
+ "\n",
+ "#case-2\n",
+ "n11=1.47; #refractive index of core\n",
+ "n21=1.46; #refractive index of cladding\n",
+ "c1=3*10**5; #speed of light in Km/s\n",
+ "t11=n11/c1; #time delay for one traveling along axis in\n",
+ "t22=(n11**2/n21)/c1; #time delay for one traveling along path that is totally reflecting at the first interface\n",
+ "\n",
+ "\n",
+ "print\"time delay for traveling along axis =\",round(t1*1e6,5),\"us/Km\"; #multiplication by 1e6 to convert the unit from s/Km to us/Km\n",
+ "print\"\\ntime delay for traveling along path that is totally reflecting at the first interface =\",round(t2*1e6,5),\"us/Km\"; #multiplication by 1e6 to convert the unit from s/Km to us/Km\n",
+ "print\"\\ntime delay for traveling along axis =\",round(t11*1e6,5),\"us/Km\"; #multiplication by 1e6 to convert the unit from s/Km to us/Km\n",
+ "print\"\\ntime delay for traveling along path that is totally reflecting at the first interface =\",round(t22*1e6,5),\"us/Km\"; #multiplication by 1e6 to convert the unit from s/Km to us/Km\n",
+ "#The answer provided in the textbook is wrong it has got wrong unit"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "time delay for traveling along axis = 4.96667 us/Km\n",
+ "\n",
+ "time delay for traveling along path that is totally reflecting at the first interface = 5.06872 us/Km\n",
+ "\n",
+ "time delay for traveling along axis = 4.9 us/Km\n",
+ "\n",
+ "time delay for traveling along path that is totally reflecting at the first interface = 4.93356 us/Km\n"
+ ]
+ }
+ ],
+ "prompt_number": 8
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+}
\ No newline at end of file |