diff options
author | Trupti Kini | 2016-05-02 23:30:25 +0600 |
---|---|---|
committer | Trupti Kini | 2016-05-02 23:30:25 +0600 |
commit | 09174527d359bd85404d15d76fabd891c7e5ad6b (patch) | |
tree | 7f243aba0ba204ce510633f2b32607e2b13fb22f | |
parent | a50c96a8653eda4256bb1e27242273373ad94732 (diff) | |
download | Python-Textbook-Companions-09174527d359bd85404d15d76fabd891c7e5ad6b.tar.gz Python-Textbook-Companions-09174527d359bd85404d15d76fabd891c7e5ad6b.tar.bz2 Python-Textbook-Companions-09174527d359bd85404d15d76fabd891c7e5ad6b.zip |
Added(A)/Deleted(D) following books
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter1.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter10.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter11.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter13.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter14.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter15.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter17.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter18.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter19.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter21.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter22.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter23.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter25.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter26.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter3.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter4.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter5.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter6.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter7.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter9.ipynb
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch14PathOfAscent.png
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch14RandomNumberGenerator.png
A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch26EulerMethod.png
A sample_notebooks/testingtesting/fameetha.ipynb
24 files changed, 8065 insertions, 0 deletions
diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter1.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter1.ipynb new file mode 100644 index 00000000..4e34a107 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter1.ipynb @@ -0,0 +1,121 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# CHAPTER 1 : Mathematical Modeling And Engineering Problem Solving" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex : 1.1 Pg : 14" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Time(s) = 0\tv(m/s) = 0.00\n", + "Time(s) = 2\tv(m/s) = 16.40\n", + "Time(s) = 4\tv(m/s) = 27.77\n", + "Time(s) = 6\tv(m/s) = 35.64\n", + "Time(s) = 8\tv(m/s) = 41.10\n", + "Time(s) = 10\tv(m/s) = 44.87\n", + "Time(s) = inf\tv(m/s) = 53.39\n" + ] + } + ], + "source": [ + "from numpy import arange, exp, inf\n", + "g=9.8##m/s**2# acceleration due to gravity\n", + "m=68.1##kg\n", + "c=12.5##kg/sec# drag coefficient\n", + "v=[]\n", + "j=0\n", + "for i in arange(0,12,2):\n", + " v.append(g*m*(1-exp(-c*i/m))/c)\n", + " print \"Time(s) = %d\\t\"%i,\"v(m/s) = %0.2f\"%v[j]\n", + " j+=1\n", + "print \"Time(s) = %0.2f\\t\"%inf,\"v(m/s) = %0.2f\"%(g*m/c)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex : 1.2 Pg :17" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Time(s) = 0\tv(m/s) = 0.00\n", + "Time(s) = 2\tv(m/s) = 19.60\n", + "Time(s) = 4\tv(m/s) = 12.40\n", + "Time(s) = 6\tv(m/s) = 34.65\n", + "Time(s) = 8\tv(m/s) = 19.29\n", + "Time(s) = 10\tv(m/s) = 47.17\n", + "Time(s) = 12\tv(m/s) = 21.57\n", + "Time(s) = inf\tv(m/s) = 53.39\t\n" + ] + } + ], + "source": [ + "from numpy import arange, exp, inf\n", + "g=9.8##m/s**2# acceleration due to gravity\n", + "m=68.1##kg\n", + "c=12.5##kg/sec# drag coefficient\n", + "count=0#\n", + "v=[]\n", + "v.append(0)\n", + "print \"Time(s) = %d\\t\"%(0),\"v(m/s) = %0.2f\"%v[0]\n", + "\n", + "for i in arange(1,13,2):\n", + " v.append(v[(count-1)]+(g-c*v[(count)]/m)*(2))\n", + " print \"Time(s) = %d\\t\"%(i+1),\"v(m/s) = %0.2f\"%v[(count+1)]\n", + " count=count+1#\n", + "\n", + "print \"Time(s) = %0.2f\\t\"%inf,\"v(m/s) = %0.2f\\t\"%(g*m/c)\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter10.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter10.ipynb new file mode 100644 index 00000000..54d12f92 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter10.ipynb @@ -0,0 +1,259 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 10 : LU Decomposition and matrix inverse" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex10.1 Page 277" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A = [[ 3. -0.1 -0.2]\n", + " [ 0.1 7. -0.3]\n", + " [ 0.3 -0.2 10. ]]\n", + "\n", + "U = \n", + "[[ 3. -0.1 -0.2 ]\n", + " [ 0. 7.00333333 -0.29333333]\n", + " [ 0. 0. 10.01204188]]\n", + "\n", + "L calculated based on gauss elimination method = \n", + "[[ 1. 0. 0. ]\n", + " [ 0.03333333 1. 0. ]\n", + " [ 0.1 -0.02712994 1. ]]\n" + ] + } + ], + "source": [ + "from numpy import mat\n", + "from numpy.linalg import det\n", + "A = mat([[3,-0.1,-0.2],[0.1,7,-0.3],[0.3,-0.2,10]])\n", + "U = A#\n", + "print \"A =\",A\n", + "m = U[0,0]\n", + "n = U[1,0]\n", + "a = n/m#\n", + "U[1:2] = U[1:2] - U[0:1] / (m/n)#\n", + "n = U[2,0]\n", + "b = n/m\n", + "\n", + "U[2:3] = U[2:3] - U[0:1] / (m/n)#\n", + "m = U[1,1]\n", + "n = U[2,1]\n", + "c = n/m#\n", + "U[2:3] = U[2:3] - U[1:2] / (m/n)#\n", + "print \"\\nU = \\n\",U\n", + "L = mat([[1,0,0],[a,1,0],[b,c,1]])\n", + "print \"\\nL calculated based on gauss elimination method = \\n\",L" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex10.2 Page 279" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "X = \n", + "[[ 3. ]\n", + " [-2.5]\n", + " [ 7. ]]\n" + ] + } + ], + "source": [ + "from numpy import mat\n", + "A = mat([[3,-0.1,-0.2],[0.1,7,-0.3],[0.3,-0.2,10]])\n", + "B = mat([[7.85],[-19.3],[71.4]])\n", + "X = (A**-1) * B\n", + "print \"X = \\n\",X" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex10.3 Page 284" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "B=\n", + "[[ 0.33248872 0.00494409 0.00679813]\n", + " [-0.00518174 0.14290333 0.00418348]\n", + " [-0.01007834 0.00270975 0.09988014]]\n" + ] + } + ], + "source": [ + "from numpy import mat,array\n", + "A = mat([[3,-0.1,-0.2],[0.1,7,-0.3],[0.3,-0.2,10]])\n", + "B = (A**-1)\n", + "L = mat([[1,0,0],[0.033333,1,0],[0.1,-0.02713,1]])\n", + "U = mat([[3,-0.1,-0.2],[0,7.0033,-0.293333],[0,0,10.012]])\n", + "for i in range(1,4):\n", + " if i==1:\n", + " m = mat([[1],[0],[0]])\n", + " else:\n", + " if i==2:\n", + " m = mat([[0],[1],[0]])\n", + " else:\n", + " m = mat([[0],[0],[1]])\n", + " \n", + " \n", + " d = (L**-1) * m#\n", + " x = (U**-1) * d#\n", + " B[:,i-1] = x\n", + "\n", + "print \"B=\\n\",B" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex10.4 Page 291" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A = \n", + "[[ 1. 0.5 0.33333333]\n", + " [ 1. 0.66666667 0.5 ]\n", + " [ 1. 0.75 0.6 ]]\n", + "\n", + "Condition number for the matrix =\n", + "451.2\n" + ] + } + ], + "source": [ + "from numpy import mat\n", + "from __future__ import division\n", + "A = mat([[1,1/2,1/3],[1/2,1/3,1/4],[1/3,1/4,1/5]])\n", + "n = A[1,0]\n", + "A[1,:] = A[1,:]/n\n", + "n = A[2,0]\n", + "A[2,:] = A[2,:]/n\n", + "B = (A**-1)#\n", + "print \"A = \\n\",A\n", + "\n", + "m=range(1,4)\n", + "su=range(1,4)\n", + "for j in range(1,4):\n", + " a = 0#\n", + " for i in range(1,4):\n", + " m[i-1]= A[j-1,i-1]\n", + " su[j-1] = a + m[i-1]#\n", + " a = su[j-1]#\n", + "\n", + "\n", + "if su[0]< su[1]:\n", + " if su[1]< su[2]:\n", + " z = su[2]\n", + " else:\n", + " z = su[1]\n", + " \n", + "else:\n", + " if su[0] < su[2]:\n", + " z = su[2]#\n", + " else:\n", + " z = su[0]#\n", + " \n", + "m=range(1,4)\n", + "sm=range(1,4)\n", + "for j in range(1,4):\n", + " a = 0#\n", + " for i in range(1,4):\n", + " m[i-1]= B[j-1,i-1]\n", + " sm[j-1]= a + abs(m[i-1])\n", + " a = sm[j-1]#\n", + "\n", + "\n", + "if sm[0]< sm[1]:\n", + " if sm[1]< sm[2] :\n", + " y = sm[2]\n", + " else:\n", + " y = sm[1]\n", + " \n", + "else:\n", + " if sm[0]< sm[2]:\n", + " y = sm[2]\n", + " else:\n", + " y = sm[0]#\n", + " \n", + "\n", + "C = z*y#\n", + "print \"\\nCondition number for the matrix =\\n\",C\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter11.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter11.ipynb new file mode 100644 index 00000000..352fdcac --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter11.ipynb @@ -0,0 +1,303 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter - 11 : Special Matrices and Gauss-Seidel" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.1 Pg: 297" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "T1 = 151.165722019\n", + "T2 = 267.578072919\n", + "T3 = 236.681195836\n", + "T4 = 214.451566586\n" + ] + } + ], + "source": [ + "from numpy import mat\n", + "A = mat([[2.04,-1,0,0],[-1,2.04,-1,0],[0,-1,2.04,-1],[0,0,-1,2.04]])\n", + "B = mat([[40.8],[0.8],[0.8],[200.8]])\n", + "g = A[0,1]\n", + "f1 =A[0,0]\n", + "e2 = A[1,0]\n", + "f2 = A[0,0] - e2 * A[1,0]\n", + "e3 = A[1,0]/f2\n", + "f3 = A[0,0] - e3 * A[1,0]\n", + "e4 = A[1,0]/f3#\n", + "f4 = A[0,0] - e4 * A[1,0]\n", + "M = mat([[f1,g,0,0],[e2,f2,g,0],[0,e3,f3,g],[0,0,e4,f4]])\n", + "L = mat([[1,0,0,0],[M[1,0],1,0,0],[0,M[2,1],1,0],[0,0,M[3,2],1]])\n", + "U = mat([[M[0,0],g,0,0],[0,M[1,1],g,0],[0,0,M[2,2],g],[0,0,0,M[3,3]]])\n", + "r1 = B[0,0]\n", + "r2 = B[1,0] - e2*B[0,0]\n", + "r3 = B[2,0] - e3*r2#\n", + "r4= B[3,0] - e4*r3# \n", + "N = mat([[r1],[r2],[r3],[r4]])\n", + "T4 = r4/U[3,3]\n", + "T3 = (r3 - g*T4)/U[2,2]\n", + "T2 = (r2 - g*T3)/U[1,1]\n", + "T1 = (r1 - g*T2)/U[0,0]\n", + "print \"T1 = \",T1\n", + "print \"T2 = \",T2\n", + "print \"T3 = \",T3\n", + "print \"T4 = \",T4" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.2 Pg: 299" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "L = \n", + "[[ 2.44948974 0. 0. ]\n", + " [ 6.12372436 4.18330013 0. ]\n", + " [ 22.45365598 20.91650066 6.11010093]]\n" + ] + } + ], + "source": [ + "from numpy import mat,sqrt\n", + "A = mat([[6,15,55],[15,55,225],[55,225,979]])\n", + "sl = 0\n", + "l11 = sqrt(A[0,0])\n", + "#for second row\n", + "l21 = (A[1,0])/l11\n", + "l22 = (A[1,1] - l21**2)**(0.5)\n", + "#for third row\n", + "l31 = (A[2,0])/l11#\n", + "l32 = (A[2,1] - l21*l31)/l22#\n", + "l33 = (A[2,2] - l31**2 - l32**2)**(0.5)#\n", + "L = mat([[l11,0,0],[l21,l22,0],[l31,l32,l33]])\n", + "print \"\\nL = \\n\",L" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.3 Pg: 301" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x through two iterations = [2.6166666666666667]\n", + "y through two iterations = [-2.7945238095238096]\n", + "z through two iterations = [7.005609523809525]\n", + "error of x = 12.50234999 %\n", + "error of y = -11.7977361365 %\n", + "error of z = -0.075978454143 %\n" + ] + } + ], + "source": [ + "#3x - 0.1y - 0.2z = 7.85\n", + "#0.1x + 7y - 0.3z = -19.3\n", + "#0.3x - 0.2y + 10z = 71.4\n", + "Y = 0# \n", + "Z = 0#\n", + "x=range(1,3)\n", + "y=range(1,3)\n", + "z=range(1,3)\n", + "for i in range(1,3):\n", + " x[i-1]= (7.85 +0.1*Y+0.2*Z)/3#\n", + " X = x[i-1]\n", + " y[i-1]= (-19.3 - 0.1*X +0.3*Z)/7#\n", + " Y = y[i-1]#\n", + " z[i-1]= (71.4 - 0.3*X+0.2*Y)/10#\n", + " Z = z[i-1]\n", + " if i==2:\n", + " ex = (x[i-1] - x[(i-2)])*100/x[i-1]\n", + " ey = (y[i-1] - y[i-2])*100/y[i-1]\n", + " ez = (z[i-1] - z[i-2])*100/z[i-1]\n", + " \n", + "\n", + "print \"x through two iterations =\",x[0:1]\n", + "print \"y through two iterations =\",y[0:1]\n", + "print \"z through two iterations =\",z[0:1]\n", + "print \"error of x = \",ex,\"%\"\n", + "print \"error of y = \",ey,\"%\"\n", + "print \"error of z = \",ez,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.4 Pg: 307" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x = 0.999991\n", + "y = 1.000044\n", + "z = 0.99996\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "\n", + "from numpy import mat\n", + "A = mat([[1,0.5,1/3],[1,2/3,1/2],[1,3/4,3/5]])\n", + "B = mat([[1.833333],[2.166667],[2.35]])\n", + "U = A**-1\n", + "X = U*B#\n", + "x = X[0,0]\n", + "y = X[1,0]\n", + "z = X[2,0]\n", + "print \"x = \",x\n", + "print \"y = \",y\n", + "print \"z = \",z" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.5 Pg: 309" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x = 0.999991\n", + "y = 1.000044\n", + "z = 0.99996\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from numpy import mat\n", + "A = mat([[1,0.5,1/3],[1,2/3,1/2],[1,3/4,3/5]])\n", + "B = mat([[1.833333],[2.166667],[2.35]])\n", + "U = A**-1\n", + "X = U*B#\n", + "x = X[0,0]\n", + "y = X[1,0]\n", + "z = X[2,0]\n", + "print \"x = \",x\n", + "print \"y = \",y\n", + "print \"z = \",z" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:11.6 Pg: 310" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x = 0.999999\n", + "y = 1.000008\n", + "z = 0.99999\n" + ] + } + ], + "source": [ + "from numpy import mat\n", + "A = mat([[1,0.5,1/3],[1/2,1/3,1/4],[1/3,1/4,1/5]])\n", + "B = mat([[1.833333],[1.083333],[0.783333]])\n", + "U = A**-1\n", + "X = U*B#\n", + "x = X[0,0]\n", + "y = X[1,0]\n", + "z = X[2,0]\n", + "print \"x = \",x\n", + "print \"y = \",y\n", + "print \"z = \",z" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter13.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter13.ipynb new file mode 100644 index 00000000..c37c77de --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter13.ipynb @@ -0,0 +1,193 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter - 13 : One-Dimensional Unconstrained Optimization" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.1 Pg: 356" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "xl = [0, 0, 0, 0, 0, 0.9442719099991588, 0.9442719099991588, 0.9442719099991588, 0.9442719099991588, 0.9442719099991588, 0.9442719099991588]\n", + "\n", + "x2 = [1.5278640450004204, 1.5278640450004204, 0.0, 0.9442719099991588, 0.9442719099991588, 0.9442719099991588, 0.9442719099991588, 1.5278640450004206, 1.5278640450004206, 1.5278640450004206]\n", + "\n", + "x1 = [2.4721359549995796, 2.4721359549995796, 2.4721359549995796, 1.5278640450004208, 1.5278640450004208, 1.5278640450004208, 2.4721359549995796, 1.8885438199983178, 1.8885438199983178, 1.8885438199983178]\n", + "\n", + "xu = [4, 2.4721359549995796, 2.4721359549995796, 2.4721359549995796, 2.4721359549995796, 2.4721359549995796, 2.4721359549995796, 2.4721359549995796, 2.4721359549995796, 1.8885438199983178, 1.8885438199983178]\n" + ] + } + ], + "source": [ + "from math import sin\n", + "#f(x) = 2sinx - x**2/10\n", + "xl=[]\n", + "xu=[]\n", + "xl.append(0)\n", + "xu.append(4)\n", + "d=[]\n", + "x1=[]\n", + "x2=[]\n", + "m=[]\n", + "n=[]\n", + "for i in range(0,10):\n", + " d.append(((5)**(0.5) - 1)*(xu[i-1] - xl[i-1])/2)\n", + " x1.append(xl[i-1] + d[i-1])\n", + " x2.append(xu[i-1] - d[i-1])\n", + " m.append(2*sin(x1[i-1]) - (x1[i-1]**2)/10)\n", + " n.append(2*sin(x2[i-1]) - (x2[i-1]**2)/10)\n", + " if n[i-1] > m[i-1]:\n", + " xu.append(x1[(i-1)])\n", + " xl.append(xl[(i-1)])\n", + " else:\n", + " xl.append(x2[i-1])\n", + " xu.append(xu[i-1])\n", + " \n", + "\n", + "print \"xl =\",xl\n", + "print \"\\nx2 =\",x2\n", + "print \"\\nx1 =\",x1\n", + "print \"\\nxu =\",xu" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.2 Pg: 360" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x0 = [0, 1, 1, 1.3813008689454946, 1.382057051632978, 1.4273175717149764, 1.4274221422858844]\n", + "\n", + "x1 = [1, 1.5921843781407843, 1.3813008689454946, 1.382057051632978, 1.4273175717149764, 1.4274221422858844, 1.4275508501677177]\n", + "\n", + "x2 = [4, 4, 1.5921843781407843, 1.5921843781407843, 1.5921843781407843, 1.5921843781407843, 1.5921843781407843]\n" + ] + } + ], + "source": [ + "from math import sin\n", + "#f(x) = 2sinx - x**2/10\n", + "x0= [0]#\n", + "x1= [1]\n", + "x2= [4]#\n", + "m=[];n=[];r=[];x3=[];s=[]\n", + "for i in range(0,6):\n", + " m.append(2*sin(x0[(i)]) - (x0[(i)]**2)/10)\n", + " n.append(2*sin(x1[(i)]) - (x1[(i)]**2)/10)\n", + " r.append(2*sin(x2[(i)]) - (x2[(i)]**2)/10)\n", + " x3.append(((m[(i)]*(x1[(i)]** 2 -x2[(i)] ** 2)) + (n[(i)]*(x2[(i)] ** 2 -x0[(i)] ** 2)) + (r[(i)]*(x0[(i)] ** 2 -x1[(i)] ** 2)))/((2*m[(i)]*(x1[(i)] -x2[(i)]))+(2*n[(i)]*(x2[(i)] -x0[(i)]))+(2*r[(i)]*(x0[(i)] -x1[(i)]))))\n", + " s.append(2*sin(x3[(i)]) - (x3[(i)]**2)/10)\n", + " if x1[(i) ]> x3[(i) ]:\n", + " if n[(i)]<s[(i)]:\n", + " x0.append(x0[(i)])\n", + " x1.append(x3[(i)])\n", + " x2.append(x1[(i)])\n", + " else:\n", + " x0.append(x1[(i)])\n", + " x1.append(x3[(i)])\n", + " x2.append(x2[(i)])\n", + " \n", + " else:\n", + " if n[(i)]>s[(i)]:\n", + " x0.append(x0[(i)])\n", + " x1.append(x3[(i)])\n", + " x2.appedn(x1[(i)])\n", + " else:\n", + " x0.append(x1[(i)])\n", + " x1.append(x3[(i)])\n", + " x2.append(x2[(i)])\n", + " \n", + " \n", + "\n", + "\n", + "print \"x0 = \",x0\n", + "print \"\\nx1 = \",x1\n", + "print \"\\nx2 = \",x2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:13.3 Pg: 361" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x = [0.5, 2.2261962395657777, 1.1766358162650659, 1.465127166023216, 1.4238568730046828, 1.4279262963228776, 1.427513951598196, 1.427555600748671, 1.4275513926124817, 1.4275518177794067]\n" + ] + } + ], + "source": [ + "from math import sin, cos\n", + "#f(x) = 2sinx - x**2/10\n", + "x= [.5]\n", + "#f'(x) = 2cosx - x/5\n", + "#f\"(x) = -2sinx - 1/5\n", + "for i in range(1,10):\n", + " x.append(x[(i-1)] - (2*cos(x[(i-1)]) - x[(i-1)]/5)/(-2*sin(x[(i-1)]) - 1/5))\n", + "\n", + "print \"x = \",x" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter14.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter14.ipynb new file mode 100644 index 00000000..b3607eab --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter14.ipynb @@ -0,0 +1,260 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter-14 : Multidimensional Unconstrained Optimization" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.1 Pg: 368" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Iteration: 1\n", + "x: 1.53606983054\n", + "y: 1.86168445446\n", + "function value: -13.5786300816\n", + "------------------------------------------\n", + "Iteration: 1001\n", + "x: 1.76453990766\n", + "y: 1.86004762993\n", + "function value: -16.155728181\n", + "------------------------------------------\n", + "Iteration: 2001\n", + "x: -0.735800459375\n", + "y: 1.48176151402\n", + "function value: 1.11970176233\n", + "------------------------------------------\n", + "Iteration: 3001\n", + "x: -0.493690866305\n", + "y: 2.74840585243\n", + "function value: -2.08537362139\n", + "------------------------------------------\n", + "Iteration: 4001\n", + "x: 0.191618544017\n", + "y: 2.12536130424\n", + "function value: -3.47137052343\n", + "------------------------------------------\n", + "Iteration: 5001\n", + "x: 0.556097851317\n", + "y: 2.75235702552\n", + "function value: -9.05885931809\n", + "------------------------------------------\n", + "Iteration: 6001\n", + "x: -1.3315420382\n", + "y: 1.98026194153\n", + "function value: 1.11796226726\n", + "------------------------------------------\n", + "Iteration: 7001\n", + "x: -1.30334156994\n", + "y: 2.2803362443\n", + "function value: 0.930459972575\n", + "------------------------------------------\n", + "Iteration: 8001\n", + "x: -1.42505981694\n", + "y: 1.24322307994\n", + "function value: 0.604422816099\n", + "------------------------------------------\n", + "Iteration: 9001\n", + "x: -1.04901290775\n", + "y: 1.83044616216\n", + "function value: 1.16839305819\n", + "------------------------------------------\n" + ] + } + ], + "source": [ + "from numpy.random import rand\n", + "def f(x,y):\n", + " z=y-x-(2*(x**2))-(2*x*y)-(y**2)\n", + " return z\n", + "x1=-2#\n", + "x2=2#\n", + "y1=1#\n", + "y2=3#\n", + "fmax=-1*10**(-15)#\n", + "n=10000#\n", + "for j in range(0,n):\n", + " r=rand(1,2)\n", + " x=x1+(x2-x1)*r[0,0]\n", + " y=y1+(y2-y1)*r[0,1]\n", + " fn=f(x,y)#\n", + " if fn>fmax:\n", + " fmax=fn#\n", + " xmax=x#\n", + " ymax=y#\n", + " \n", + " if j%1000==0:\n", + " \n", + " print \"Iteration:\",(j+1)\n", + " print \"x:\",x\n", + " print \"y:\",y\n", + " print \"function value:\",fn\n", + " print \"------------------------------------------\"\n", + " \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.2 Pg: 374" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Elevation: 8\n", + "Theta: 1.107\n", + "slope: 8.94\n" + ] + } + ], + "source": [ + "from math import atan\n", + "def f(x,y):\n", + " z=x*y*y\n", + " return z\n", + "p1=[2, 2]\n", + "elevation=f(p1[0],p1[1])\n", + "dfx=p1[0]*p1[0]\n", + "dfy=2*p1[0]*p1[1]\n", + "theta=atan(dfy/dfx)\n", + "slope=(dfx**2 + dfy**2)**0.5#\n", + "print \"Elevation:\",elevation\n", + "print \"Theta: %0.3f\"%theta\n", + "print \"slope: %0.2f\"%slope" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.3 Pg: 380" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The final equation is= 180*h**2 + 72*h - 7\n" + ] + } + ], + "source": [ + "def f(x,y):\n", + " z=2*x*y + 2*x - x**2 - 2*y**2\n", + " return z\n", + "x=-1#\n", + "y=1#\n", + "dfx=2*y+2-2*x#\n", + "dfy=2*x-4*y#\n", + "#the function can thus be expressed along h axis as\n", + "#f((x+dfx*h),(y+dfy*h))\n", + "print \"The final equation is=\",\"180*h**2 + 72*h - 7\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:14.4 Pg: 381" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The final values are: [-1, 1]\n" + ] + } + ], + "source": [ + "def f(x,y):\n", + " z=2*x*y + 2*x - x**2 - 2*y**2\n", + " return z\n", + "x=-1#\n", + "y=1#\n", + "d2fx=-2#\n", + "d2fy=-4#\n", + "d2fxy=2#\n", + "\n", + "modH=d2fx*d2fy-(d2fxy)**2#\n", + "\n", + "for i in range(0,25):\n", + " dfx=2*y+2-2*x#\n", + " dfy=2*x - 4*y#\n", + " #the function can thus be expressed along h axis as\n", + " #f((x+dfx*h),(y+dfy*h))\n", + " def g(h):\n", + " d=2*(x+dfx*h)*(y+dfy*h) + 2*(x+dfx*h) - (x+dfx*h)**2 - 2*(y+dfy*h)**2\n", + " return d\n", + " #2*dfx*(y+dfy*h)+2*dfy*(x+dfx*h)+2*dfx-2*(x+dfx*h)*dfx-4*(y+dfy*h)*dfy=g'(h)=0\n", + " #2*dfx*y + 2*dfx*dfy*h + 2*dfy*x + 2*dfy*dfx*h + 2*dfx - 2*x*dfx - 2*dfx*dfx*h - 4*y*dfy - 4*dfy*dfy*h=0\n", + " #h(2*dfx*dfy+2*dfy*dfx-2*dfx*dfx-4*dfy*dfy)=-(2*dfx*y+2*dfy*x-2*x*dfx-4*y*dfy)\n", + " h=(2*dfx*y+2*dfy*x-2*x*dfx-4*y*dfy+2*dfx)/(-1*(2*dfx*dfy+2*dfy*dfx-2*dfx*dfx-4*dfy*dfy))#\n", + " x=x+dfx*h#\n", + " y=y+dfy*h#\n", + "print \"The final values are:\",[x, 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.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter15.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter15.ipynb new file mode 100644 index 00000000..1573bb78 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter15.ipynb @@ -0,0 +1,358 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter-15 : Constrained Optimization" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:15.1 Pg: 388" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Maximize z=150*x1+175*x2\n", + "subject to\n", + "7*x1+11*x2<=77 (Material constraint)\n", + "10*x1+8*x2<=80 (Time constraint)\n", + "x1<=9 (Regular storage constraint)\n", + "x2<=6 (Premium storage constraint)\n", + "x1,x2>=0 (Positivity constraint)\n" + ] + } + ], + "source": [ + "regular=[7, 10, 9 ,150]#\n", + "premium=[11, 8, 6, 175]#\n", + "res_avail=[77, 80]#\n", + "#total profit(to be maximized)=z=150*x1+175*x2\n", + "#total gas used=7*x1+11*x2 (has to be less than 77 m**3/week)\n", + "#similarly other constraints are developed\n", + "print \"Maximize z=150*x1+175*x2\"\n", + "print \"subject to\"\n", + "print \"7*x1+11*x2<=77 (Material constraint)\"\n", + "print \"10*x1+8*x2<=80 (Time constraint)\"\n", + "print \"x1<=9 (Regular storage constraint)\"\n", + "print \"x2<=6 (Premium storage constraint)\"\n", + "print \"x1,x2>=0 (Positivity constraint)\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:15.2 Pg: 389" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX8AAAEZCAYAAAB/6SUgAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl4VOd5/vHvg1iM2CXAbMZgEDGx8criFWRswCAlaa+0\nadw2e9I9ztrEcdpip0njbM3itL8mTZM4bZw0SZM4SAZiMCLgjcXgJTaWxGYb8MKITSwSkp7fH2c0\nM4xH+0jnjOb+XJeuaBZpHoh53nPec+73NXdHRETyy4CwCxARkb6n5i8ikofU/EVE8pCav4hIHlLz\nFxHJQ2r+IiJ5SM1fRCQPqflLXjKzr5pZtZkdN7PnzexdIdfzDjN71MxOmtmGMGuR/DAw7AJEQlIP\nlLt7tZnNB9aYWa27PxZSPTHgX4HZwOKQapA8oiN/6ZfMbIaZxczsyvjjSWb2upktBHD3u9y9Ov79\nFmATcG0bv+t5MytLeTww/ruuMLPzzOx/zOywmR0xsy1mNr4b9ax3918Ah7L8VyGSkZq/9Evuvhv4\nNPA/ZjYU+AHwA3f/Xfp746/PA55t49fdD9yW8ngZ8Jq77wTeA4wEpgBFwF8Cp3tSj0hfUPOXfsvd\nvwfUAluA84HPtvHW/wB2uvtv23j9fuCtZnZe/PGfAj+Jf98IFAMlHtjh7id6WI9Ir1Pzl/7ue8Al\nwL3ufjb9RTP7CvBm4B1t/YL4UfvzBANAIfAWggEB4L+BtcBPzeyAmX3JzNq7ltZuPSJ9Rc1f+i0z\nGw58g6Dh3m1mY9Jev5tgCmepu9d38Ot+QjD18zbg9+6+B8Ddm9z9c+5+CXAdUA68uzv1xGmZXekT\nav7Sn30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47/uQYBU9x9Vzf/akQy0pLOIiS2uNzg7vPCriVV/AJxmbt/JOxapH/R\ntI8IEN/TeIOZ3RR2LWk+SLBhvEhW6chfRCQP6chfRCQPqfmLiOQhNX8RkTyk5i8ikofU/EVE8pCa\nv4hIHvr/jNG1VBcwIEMAAAAASUVORK5CYII=\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7fa838951c50>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%matplotlib inline\n", + "from matplotlib.pyplot import plot,xlabel,ylabel,title ,show\n", + "x21=[];x22=[];x23=[];x24=[];x25=[];x26=[]\n", + "\n", + "for x1 in range(0,9):\n", + " x21.append(-(7/11)*x1+7)\n", + " x22.append((80-10*x1)/8)\n", + " x23.append(6)\n", + " x24.append(-150*x1/175)\n", + " x25.append((600-150*x1)/175)\n", + " x26.append((1400-150*x1)/175)\n", + "\n", + "x1=range(0,9)\n", + "\n", + "plot(x1,x24)\n", + "plot(x1,x25)\n", + "plot(x1,x26)\n", + "#h1=legend(['Z=0'#'Z=600'#'Z=1400'])\n", + "plot(x1,x21)#\n", + "plot(x1,x22)#\n", + "plot(x1,x23)#\n", + "title('x2 vs x1')\n", + "xlabel('x1 (tonnes)')\n", + "ylabel('x2 (tonnes)')\n", + "show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:15.3 Pg: 399" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The maximized profit is= 1413.888925\n" + ] + } + ], + "source": [ + "x1=[0,4.888889, 3.888889]\n", + "x2=[0,7, 11]#\n", + "x3=[0,10, 8]#\n", + "x4=[0,150, 175]#\n", + "x5=[0,77, 80, 9, 6]\n", + "profit=[0,x1[(1)]*x4[(1)], x1[(2)]*x4[(2)]]#\n", + "total=[0,x1[(1)]*x3[(1)]+x1[(2)]*x3[(2)], x1[(1)]*x3[(1)]+x1[(2)]*x3[(2)], x1[(1)], x1[(2)], profit[(1)]+profit[(2)]]\n", + "e=1000#\n", + "\n", + "while e>total[(5)]:\n", + " if total[(1)]<=x5[(1)]:\n", + " if total[(2)]<=x5[(2)]:\n", + " if total[(3)]<=x5[(3)]:\n", + " if total[(4)]<=x5[(4)]:\n", + " l=1#\n", + " \n", + " \n", + " \n", + " \n", + " if l==1:\n", + " x1[(1)]=x1[(1)]+4.888889\n", + " x1[(2)]=x1[(2)]+3.888889# \n", + " profit=[0,x1[(1)]*x4[(1)], x1[(2)]*x4[(2)]]\n", + " total[(5)]=profit[(1)]+profit[(2)]\n", + " \n", + "\n", + "print \"The maximized profit is=\",total[(5)]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:15.4 Pg: 401" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The final value of velocity=19.980\n", + "6 The final no. of load parcels= 6\n", + "The chute radius=2.944 m\n", + "The minimum cost = 4377.264 $\n" + ] + } + ], + "source": [ + "from math import pi,exp\n", + "\n", + "Mt=2000##kg\n", + "g=9.8##m/s**2\n", + "c0=200##$\n", + "c1=56##$/m\n", + "c2=0.1##$/m**2\n", + "vc=20##m/s\n", + "kc=3##kg/(s*m**2)\n", + "z0=500##m\n", + "t=27#\n", + "r=2.943652#\n", + "n=6#\n", + "A=2*pi*r*r#\n", + "l=(2**0.5)*r#\n", + "c=3*A#\n", + "m=Mt/n#\n", + "def f(t):\n", + " y=(z0+g*m*m/(c*c)*(1-exp(-c*t/m)))*c/(g*m)#\n", + " return y\n", + "\n", + "while abs(f(t)-t)>0.00001:\n", + " t=t+0.00001\n", + " \n", + "v=g*m*(1-exp(-c*t/m))/c#\n", + "print \"The final value of velocity=%0.3f\"%v\n", + "print n,\"The final no. of load parcels=\",n\n", + "print \"The chute radius=%0.3f m\"%r\n", + "print \"The minimum cost = %0.3f $\"%((c0+c1*l+c2*A*A)*n)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:15.5 Pg: 406" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Optimization terminated successfully.\n", + " Current function value: -1.775726\n", + " Iterations: 26\n", + " Function evaluations: 52\n", + "After maximization:\n", + "x= [ 1.4275625]\n", + "f(x)= [-1.77572565]\n" + ] + } + ], + "source": [ + "from scipy.optimize import fmin\n", + "from math import sin\n", + "def fx(x):\n", + " y=-(2*sin(x))+x**2/10\n", + " return y\n", + "x=fmin(fx,0)\n", + "print \"After maximization:\"\n", + "print \"x=\",x\n", + "print \"f(x)=\",fx(x)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:15.6 Pg: 407" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Optimization terminated successfully.\n", + " Current function value: -2.000000\n", + " Iterations: 45\n", + " Function evaluations: 86\n", + "After maximization:\n", + "x= [ 1.99993372 0.99996476]\n", + "f(x)= -1.99999999779\n" + ] + } + ], + "source": [ + "from scipy.optimize import fmin\n", + "def fx(x):\n", + " f=-(2*x[0]*x[1]+2*x[0]-x[0]**2-2*x[1]**2)\n", + " return f\n", + "x=fmin(fx,[-1, 1])\n", + "print \"After maximization:\"\n", + "print \"x=\",x\n", + "print \"f(x)=\",fx(x)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:15.7 Pg: 408" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Optimization terminated successfully.\n", + " Current function value: -1.775726\n", + " Iterations: 26\n", + " Function evaluations: 52\n", + "After maximization:\n", + "x= [ 1.4275625]\n", + "f(x)= [-1.77572565]\n" + ] + } + ], + "source": [ + "from scipy.optimize import fmin\n", + "from math import sin\n", + "\n", + "def fx(x):\n", + " y=-(2*sin(x)-x**2/10)\n", + " return y\n", + "x=fmin(fx,0)\n", + "print \"After maximization:\"\n", + "print \"x=\",x\n", + "print \"f(x)=\",fx(x)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter17.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter17.ipynb new file mode 100644 index 00000000..14e89b11 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter17.ipynb @@ -0,0 +1,607 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter-17 : Least-squares Regression" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:17.1 Pg: 458" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "sum of product of x and y = 119.5\n", + "sum of square of x = 140\n", + "sum of all the x = 28\n", + "sum of all the y = 24.0\n", + "a1 = 0.839285714286\n", + "a0 = 0.0714285714286\n", + "The equation of the line obtained is y = a0 + a1*x\n" + ] + } + ], + "source": [ + "x = [1,2,3,4,5,6,7]#\n", + "y = [0.5,2.5,2,4,3.5,6,5.5]#\n", + "n = 7#\n", + "s = 0#\n", + "xsq = 0#\n", + "xsum = 0#\n", + "ysum = 0#\n", + "\n", + "for i in range(0,7):\n", + " s = s + (x[i])*y[i]\n", + " xsq = xsq + x[i]**2\n", + " xsum = xsum + x[i]\n", + " ysum = ysum + y[i]\n", + "\n", + "print \"sum of product of x and y =\",s\n", + "print \"sum of square of x = \",xsq\n", + "print \"sum of all the x = \",xsum\n", + "print \"sum of all the y = \",ysum\n", + "a = xsum/n#\n", + "b = ysum/n#\n", + "a1 = (n*s - xsum*ysum)/(n*xsq -xsum**2)#\n", + "a0 = b - a*a1#\n", + "print \"a1 = \",a1\n", + "print \"a0 = \",a0\n", + "print \"The equation of the line obtained is y = a0 + a1*x\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:17.2 Pg: 462" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "sum of all y = 24.0\n", + "\n", + "(yi - yavg)**2 = [0.010204081632653073, 2.010204081632653, 1.510204081632653, 3.510204081632653, 3.010204081632653, 5.510204081632653, 5.010204081632653]\n", + "\n", + "total (yi - yavg)**2 = 20.5714285714\n", + "\n", + "(yi - a0 - a1*x)**2 = [-0.4107142857142855, -0.9285714285714284, -5.625, -9.5, -17.55357142857143, -24.285714285714285, -35.69642857142857]\n", + "\n", + "total (yi - a0 - a1*x)**2 = -94.0\n", + "\n", + "sy = 1.85164019955\n", + "r = 2.35996704308\n", + "The result indicate that 86.8 percent of the original uncertainty has been explained by linear model\n" + ] + } + ], + "source": [ + "x = [1,2,3,4,5,6,7]#\n", + "y = [0.5,2.5,2,4,3.5,6,5.5]#\n", + "n = 7#\n", + "s = 0#\n", + "ssum = 0#\n", + "xsq = 0#\n", + "xsum = 0#\n", + "ysum = 0#\n", + "msum = 0#\n", + "for i in range(0,7):\n", + " s = s + x[i]*y[i]\n", + " xsq = xsq + x[i]**2\n", + " xsum = xsum + x[i]\n", + " ysum = ysum + y[i]\n", + "\n", + "a = xsum/n#\n", + "b = ysum/n#\n", + "a1 = (n*s - xsum*ysum)/(n*xsq -xsum**2)#\n", + "a0 = b - a*a1#\n", + "m=[];si=[]\n", + "for i in range(0,7):\n", + " m.append(y[i] - ysum/7**2)\n", + " msum = msum +m[i]#\n", + " si.append(y[i] - a0 - a1*x[i]**2)\n", + " ssum = ssum + si[i]\n", + "\n", + "print \"sum of all y =\",ysum\n", + "print \"\\n(yi - yavg)**2 = \",m\n", + "print \"\\ntotal (yi - yavg)**2 = \",msum\n", + "print \"\\n(yi - a0 - a1*x)**2 = \",si\n", + "print \"\\ntotal (yi - a0 - a1*x)**2 = \",ssum\n", + "sy = (msum / (n-1))**(0.5)#\n", + "#sxy = (ssum/(n-2))**(0.5)#\n", + "print \"\\nsy = \",sy\n", + "#print \"sxy = \",sxy\n", + "r2 = (msum - ssum)/(msum)#\n", + "r = r2**0.5#\n", + "print \"r = \",r\n", + "print \"The result indicate that 86.8 percent of the original uncertainty has been explained by linear model\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:17.3 Pg: 463" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "time = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]\n", + "\n", + "measured v = [10, 16.3, 23, 27.5, 31, 35.6, 39, 41.5, 42.9, 45, 46, 45.5, 46, 49, 50]\n", + "\n", + "using equation(1.10) v1 = [8.953182207901257, 16.404980802870615, 22.607166909502304, 27.769291463870154, 32.06576523242002, 35.641751563129084, 38.61807096510561, 41.09528322582064, 43.15708498693595, 44.87313757134839, 46.30142060418256, 47.490190948641704, 48.479613142547706, 49.30311642251821, 49.988524185047744]\n", + "\n", + "using equation((17.3)) v2 = [11.240084210526316, 18.57057391304348, 23.729066666666665, 27.556335483870967, 30.5088, 32.855630769230764, 34.765841860465116, 36.35091063829787, 37.68734117647059, 38.82938181818182, 39.81656949152543, 40.678399999999996, 41.43732537313433, 42.11073802816901, 42.712320000000005]\n" + ] + }, + { +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AAAElFTkSuQmCC\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7f2a3c39d2d0>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%matplotlib inline\n", + "from matplotlib.pyplot import plot, title,xlabel,ylabel,show\n", + "from math import exp\n", + "s = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]#\n", + "v = [10,16.3,23,27.5,31,35.6,39,41.5,42.9,45,46,45.5,46,49,50]#\n", + "g = 9.8#m/s**2\n", + "m = 68.1##kg\n", + "c = 12.5#kg/s\n", + "v1=[]\n", + "v2=[]\n", + "for i in range(0,15):\n", + " v1.append(g*m*(1 - exp(-c*s[(i)]/m))/c)\n", + " v2.append(g*m*s[(i)]/(c*(3.75+s[(i)])))\n", + "\n", + "print \"time = \",s\n", + "print \"\\nmeasured v =\",v\n", + "print \"\\nusing equation(1.10) v1 = \",v1\n", + "print \"\\nusing equation((17.3)) v2 = \",v2\n", + "plot(v,v1)#\n", + "title('v vs v1')\n", + "xlabel('v')\n", + "ylabel('v1')#\n", + "show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:17.4 Pg: 468" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 0.501187233627\n", + "x= [1, 2, 3, 4, 5]\n", + "y= [0.5011872336272722, 1.6857861925123965, 3.4273795077270295, 5.670286264671531, 8.379102586654781]\n", + "m= [0.0, 0.3010299956639812, 0.47712125471966244, 0.6020599913279624, 0.6989700043360189]\n", + "n= [-0.30000000000000004, 0.226802492411967, 0.5349621957594092, 0.7536049848239341, 0.9231975075880328]\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAEZCAYAAACU3p4jAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH0JJREFUeJzt3XmYVNW1/vHvYpJBI46gAUUR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w\nRUSKhAJfRKRIKPBFRIqEAl9EpEgo8EVEioQCX0SkSCjwRUSKxP8BeDy/tYtuJRUAAAAASUVORK5C\nYII=\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7f7763106d50>" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEZCAYAAACAZ8KHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHDxJREFUeJzt3X+8XHV95/HXmwBd0Y2AsBADiCvBoAVWV0OwrkwFagwI\nWdiCgFHAXVm2FMoKDUFWb13agHWFprgsxegjjcWAgBghkCJmKoXwI4r8KElJdKMkmCBQaERrEu+n\nf5xDGG/u3HvOvXPmzDnzfj4e9/GYM/O9535mcjOf+/2e9zmjiMDMzCyrncouwMzMqsWNw8zMcnHj\nMDOzXNw4zMwsFzcOMzPLxY3DzMxyceOwWpC0TtLRZdcxXpLOlHRv2XWYjcSNw+oi0i8zK5gbh5mZ\n5eLGYbUj6bckXS1pQ/p1laRdWx7/Y0nPSFov6b9KGpT074fZz+9LWjnkvv8p6bZhxp4q6eEh910o\n6Zvp7ZmS/kHSP6c/95MZn8t7JD0s6UVJD0k6suWxN0v6brrPuyV9UdKiNvuZI+kBSRPS7XMlPdH6\nuphl5cZhdfQpYBpwePo1DbgMQNIM4ELgaGAK0KD9Etc3gTdLmtpy32xg4TBjlwBvlXRQy32nA3+T\n3l4AfCIiJgJvB74z2pOQtCdwB3A1sCfwBeAOSXukQ24AHkgfGwA+MsJz+RzwK+AySVOAPwXOiIgt\no9VhNpQbh9XR6cBnI+K5iHgO+BOSN3yAU4AvR8SqiPgl8BlAw+0kfVO9ieQNGUlvB94E3D7M2F+S\nNJrT0rFTgLeSNBSALcDbJU2MiJci4pEMz+M44B8j4m8iYjAiFgOrgRMkHQC8C/h0RGyLiPvSn9Xu\nuQTwUeD8tM4rI+LRDDWY7cCNw+rojcCPW7Z/kt4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T0/p3Say2tkvS3ku6QdPKQ791Z0kOSjkq350m6vIznYZZXZS45YtaDTiK5mN1hJB/E9XB6gbv3\nAm+KiEPSz4NZBSxo/cb0UhBnAjdLOp/kctY9cYkWs9G4cZiN3XuBGyK5bs+zkv4OeDfJJeVvAoiI\nTZKWD/fNEfGkpK8C3yK5OOS2LtVtNi5eqjIbu6D9515k/TyMQ4F/Irk6rFkluHGYjd29wKnpMY29\ngfeRfGzufcDJ6TGQfUg+T3sHkk4i+bzqo4C/lPT67pRtNj5eqjLLLwAi4huSjgQeTe+7OCKelXQL\nyafBPUnyIT/fB15q3YGkvYB5wPsjYoOka4C/AM7s2rMwGyNfVt2sAJJeGxEvS3oDySzkPRHxbNl1\nmXWCZxxmxbhd0u4kn7r2WTcNqxPPOMzMLBcfHDczs1zcOMzMLBc3DjMzy8WNw8zMcnHjMDOzXNw4\nzMwsl38FAoe+bnMSv0IAAAAASUVORK5CYII=\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7f7762cd79d0>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from math import log10\n", + "%matplotlib inline\n", + "from matplotlib.pyplot import plot, title,xlabel,ylabel,show\n", + "\n", + "#y = a*x**b\n", + "a1 = -0.3000#\n", + "a = 10**(a1)#\n", + "b = 1.75#\n", + "print \"a=\",a\n", + "x=[];y=[];m=[];n=[];\n", + "for i in range(0,5):\n", + " x.append(i+1)\n", + " y.append(a*x[(i)]**b)\n", + " m.append(log10(x[(i)]))\n", + " n.append(log10(y[(i)]))\n", + "\n", + "print \"x=\",x\n", + "print \"y=\",y\n", + "print \"m=\",m\n", + "print \"n=\",n\n", + "plot(x,y)\n", + "title('y vs x')\n", + "xlabel('x')\n", + "ylabel('y')\n", + "show()\n", + "plot(m,n)\n", + "title('log y vs log x')\n", + "xlabel('log x')\n", + "ylabel('log y')\n", + "show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:17.5 Pg: 471" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "sum y = 152.6\n", + "sum x = 15\n", + "xavg = 2\n", + "yavg = 25.4333333333\n", + "sum x**2 = 55\n", + "sum x**3 = 225\n", + "sum x**4 = 979\n", + "sum x*y = 585.6\n", + "sum x**2 * y = 2488.8\n", + "(yi - yavg)**2 = [4.41, 41.173611111111114, 60.58027777777777, 60.580277777777745, 33.446944444444505, 1332.2500000000005]\n", + "(yi - a0 - a1*x - a2*x**2)**2 = [0.14331632653056853, 1.0028591836732743, 1.0816000000005044, 0.80486530612177265, 0.61959387755180939, 0.094336734693502053]\n", + "The standard error of the estimate based on regression polynomial = 1.11752277062\n", + "Percentage of original uncertainty that has been explained by the model = 99.7555161238 %\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEZCAYAAACQK04eAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHQFJREFUeJzt3XmYFfWV//H3AQRxiYqOQAQU9xh1RHEN4sWIAio6ZsYl\nRjEuGc1PJTFR0Ex+duIyLjMucUncxSgq0YigKPtFXCIgiyKiEYPiQoNRVEAiy5k/vtU2aZu2G7vu\nt+6tz+t5+qHu7brdp+8Dnz6cqvqWuTsiIpIfLWIXICIipaXgFxHJGQW/iEjOKPhFRHJGwS8ikjMK\nfhGRnFHwi4jkjIJfRCRnFPwiIjmj4JdcMbMdzOzvZtYtefxtM1tsZj3r2XeQmf2pznM3mtmNyfZp\nZjbPzD41s7fM7If1fI0OZrbMzNqt9dzeZrbIzFo2/08o8vVMSzZI3pjZmcDPge7AcGCWu19Uz35d\ngNeA9u6+NAnqBcCxwKvA+0B3d/+rmbUHtnT3OfV8nSeBke7+h+Tx9UALdx+Yzk8o0jB1/JI77n4n\n8CYwBWgP/God+70DTAf+LXnqUGC5u09JHq8B9jCztu5eXV/oJ+4DfgSQ/PI4Efh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FricnM5pvZ\ny8l7MaXBfbPU8ScXdr0OHAa8B0wlx7N/MzsYWArc5+57xK4nFjPrAHRw95lmtgnwEnBsjv9ebOTu\ny5NjZc8Cv3T3Z2PXFYuZXQDsA2zq7v1j1xOLmf0N2MfdP/q6fbPW8evCrrW4+2Tg49h1xObuC919\nZrK9FHgN+HbcquJx9+XJZmvCMbKv/YdeqcysE9APuBPQco6NfA+yFvy6sEsaZGbbAd2AF+NWEo+Z\ntTCzmUA1MNHd58SuKaLrgQuBNbELyQAHxpnZNDM7q6Edsxb82Zk7SeYkY55HgIFJ559L7r7G3fcC\nOgE9zawQuaQozOwoYJG7z0DdPsD33L0b0Bf4f8mouF5ZC/73gM5rPe5M6Pol58xsA+BR4H53Hx67\nnixw90+AJ4HusWuJ5CCgfzLbfhA41Mzui1xTNO7+QfLnYuAxwui8XlkL/mnATma2nZm1Bk4ARkSu\nSSIzMwPuAua4+w2x64nJzLYys82T7bZAb2BG3KricPdL3L2zu3cFTgQmuPupseuKwcw2MrNNk+2N\ngcOBdZ4NmKngd/dVQM2FXXOAh/N65gaAmT0IPA/sbGYLzOzHsWuK5HvAj4BeyalqM8ysT+yiIukI\nTEhm/C8CI919fOSasiLPo+L2wOS1/l484e5j1rVzpk7nFBGR9GWq4xcRkfQp+EVEckbBLyKSMwp+\nEZGcUfCLiOSMgl9EJGcU/CIiOaPgFxHJGQW/SCOZ2b5mNsvM2pjZxslNYXaLXZdIU+nKXZEmMLPL\ngA2BtsACd786ckkiTabgF2mCZJXQacDnwIGuf0BShjTqEWmarYCNgU0IXb9I2VHHL9IEZjYCGAps\nD3R09/MilyTSZK1iFyBSLszsVOAf7v6QmbUAnjezgrsXI5cm0iTq+EVEckYzfhGRnFHwi4jkjIJf\nRCRnFPwiIjmj4BcRyRkFv4hIzij4RURyRsEvIpIz/wdyyqrOJ80ArAAAAABJRU5ErkJggg==\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7f777c4e0a90>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%matplotlib inline\n", + "from matplotlib.pyplot import plot, title,xlabel,ylabel,show\n", + "from numpy import mat\n", + "x = [0,1,2,3,4,5]#\n", + "y = [2.1,7.7,13.6,27.2,40.9,61.1]#\n", + "sumy = 0#\n", + "sumx = 0#\n", + "m = 2#\n", + "n = 6#\n", + "xsqsum = 0#\n", + "xcsum = 0#\n", + "x4sum = 0#\n", + "xysum = 0#\n", + "x2ysum = 0#\n", + "rsum = 0#\n", + "usum = 0#\n", + "r=[];s=0\n", + "for i in range(0,6):\n", + " s = s + x[i]*y[i]\n", + " sumy = sumy+y[(i)]\n", + " sumx = sumx+x[(i)]\n", + " r.append((y[(i)] - s/n)**2)\n", + " xsqsum = xsqsum + x[(i)]**2\n", + " xcsum = xcsum +x[(i)]**3\n", + " x4sum = x4sum + x[(i)]**4\n", + " xysum = xysum + x[(i)]*y[(i)]\n", + " x2ysum = x2ysum + y[(i)]*x[(i)]**2\n", + " rsum = r[(i)] + rsum\n", + "\n", + "print \"sum y =\",sumy\n", + "print \"sum x =\",sumx\n", + "xavg = sumx/n#\n", + "yavg = sumy/n#\n", + "print \"xavg = \",xavg\n", + "print \"yavg = \",yavg\n", + "print \"sum x**2 =\",xsqsum\n", + "print \"sum x**3 =\",xcsum\n", + "print \"sum x**4 =\",x4sum\n", + "print \"sum x*y =\",xysum\n", + "print \"sum x**2 * y =\",x2ysum\n", + "J = mat([[n,sumx,xsqsum],[sumx,xsqsum,xcsum],[xsqsum,xcsum,x4sum]])\n", + "I = mat([[sumy],[xysum],[x2ysum]])\n", + "X = (J**-1)* I\n", + "a0 = X[0,0]\n", + "a1 = X[1,0]\n", + "a2 = X[2,0]\n", + "u=[]\n", + "for i in range(0,6):\n", + " u.append((y[(i) ]- a0 - a1*x[(i)] - a2*x[(i)]**2)**2)\n", + " usum = usum + u[i]\n", + "\n", + "print \"(yi - yavg)**2 = \",r\n", + "print \"(yi - a0 - a1*x - a2*x**2)**2 = \",u\n", + "plot(x,y)#\n", + "title('x vs y')\n", + "xlabel('x')\n", + "ylabel('y') \n", + "syx = (usum/(n-3))**0.5#\n", + "print \"The standard error of the estimate based on regression polynomial =\",syx\n", + "R2 = (rsum - usum)/(rsum)#\n", + "print \"Percentage of original uncertainty that has been explained by the model = \",R2*100,'%'" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:17.6 Pg: 475" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a0= -0.850183257587\n", + "a1= 7.17727605923\n", + "a2= 2.80543175487\n", + "Thus, y = a0 + a1*x1 + a2*x2\n" + ] + } + ], + "source": [ + "from numpy import mat\n", + "x1 = [0,2,2.5,1,4,7]\n", + "x2 = [0,1,2,3,6,2]\n", + "x1sum = 0#\n", + "x2sum = 0#\n", + "ysum = 0#\n", + "x12sum = 0#\n", + "x22sum = 0#\n", + "x1ysum = 0#\n", + "x2ysum = 0#\n", + "x1x2sum = 0#\n", + "n = 6#\n", + "x12=[];x22=[];x1x2=[];x1y=[];x2y=[]\n", + "for i in range(0,6):\n", + " y.append(5 + 4*x1[(i)] - 3*x2[(i)])\n", + " x12.append(x1[(i)]**2)\n", + " x22.append(x2[(i)]**2)\n", + " x1x2.append(x1[(i)] * x2[(i)])\n", + " x1y.append(x1[(i)] * y[(i)])\n", + " x2y.append(x2[(i)] * y[(i)])\n", + " x1sum = x1sum + x1[(i)]\n", + " x2sum = x2sum + x2[(i)]\n", + " ysum = ysum + y[(i)]\n", + " x1ysum = x1ysum + x1y[(i)]#\n", + " x2ysum = x2ysum + x2y[(i)]#\n", + " x1x2sum = x1x2sum + x1x2[(i)]#\n", + " x12sum = x12sum + x12[(i)]#\n", + " x22sum = x22sum + x22[(i)]#\n", + "\n", + "X = mat([[n,x1sum,x2sum],[x1sum,x12sum,x1x2sum],[x2sum,x1x2sum,x22sum]])\n", + "Y = mat([[ysum],[x1ysum],[x2ysum]])\n", + "Z = (X**-1)*Y\n", + "a0 = Z[0,0]\n", + "a1 = Z[1,0]\n", + "a2 = Z[2,0]\n", + "print \"a0=\",a0\n", + "print \"a1=\",a1\n", + "print \"a2=\",a2\n", + "print \"Thus, y = a0 + a1*x1 + a2*x2\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:17.7 Pg: 479" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a0= -0.858655686175\n", + "a1= 1.03160389481\n", + "standard error of co efficient a0 = 0.716371758333\n", + "standard error of co efficient a1 = 0.0186248847544\n", + "interval of a0 = [-2.4062823089821084, 0.68897093663270859]\n", + "interval of a1 = [0.99136728978321009, 1.0718404998372961]\n" + ] + } + ], + "source": [ + "from numpy import mat,exp,transpose,shape,array\n", + "#y = -0.859 + 1.032*x\n", + "Z = mat([[1,10],[1,16.3],[1,23],[1,27.5],[1,31],[1,35.6],[1,39],[1,41.5],[1,42.9],[1,45],[1,46],[1,45.5],[1,46],[1,49],[1,50]])\n", + "Y=[]\n", + "for i in range(0,15):\n", + " Y.append(9.8*68.1*(1-exp(-12.5*(i+1)/68.1))/12.5)\n", + "Y=array(Y)\n", + "Y=Y.reshape(15,1)\n", + "M = transpose(Z)\n", + "R = M*Z#\n", + "S = M*Y#\n", + "P = (R**-1)#\n", + "X = (R**-1)*S#\n", + "a0 = X[0,0]\n", + "a1 = X[1,0]\n", + "print \"a0=\",a0\n", + "print \"a1=\",a1\n", + "sxy = 0.863403#\n", + "sa0 = ((P[0,0]) * sxy**2)**0.5\n", + "sa1 = (P[1,1] * sxy**2)**0.5\n", + "print \"standard error of co efficient a0 = \",sa0\n", + "print \"standard error of co efficient a1 = \",sa1\n", + "TINV = 2.160368#\n", + "a0 = [a0 - TINV*(sa0),a0 + TINV*(sa0)]#\n", + "a1 = [a1 - TINV*(sa1),a1 + TINV*(sa1)]#\n", + "print \"interval of a0 = \",a0\n", + "print \"interval of a1 = \",a1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:17.8 Pg: 481" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Z0 = [[ 0.22119922 0.1947002 ]\n", + " [ 0.52763345 0.35427491]\n", + " [ 0.7134952 0.358131 ]\n", + " [ 0.82622606 0.3041044 ]\n", + " [ 0.89460078 0.23714826]]\n", + "D = [[ 0.05880078]\n", + " [ 0.04236655]\n", + " [-0.0334952 ]\n", + " [-0.08622606]\n", + " [-0.10460078]]\n", + "X = [[-0.27147736]\n", + " [ 0.50193087]]\n", + "The value of a0 after 1st iteration = 0.728522640015\n", + "The value of a1 after 1st iteration = 1.5019308677\n" + ] + } + ], + "source": [ + "from math import exp\n", + "from numpy import array,transpose,mat\n", + "x = [0.25,0.75,1.25,1.75,2.25]#\n", + "y = [0.28,0.57,0.68,0.74,0.79]#\n", + "a0 = 1#\n", + "a1 = 1#\n", + "sr = 0.0248#\n", + "pda0=[];pda1=[]\n", + "for i in range(0,5):\n", + " pda0.append(1 - exp(-a1 * x[(i)]))\n", + " pda1.append(a0 * x[(i)]*exp(-a1*x[(i)]))\n", + "\n", + "Z0 = mat([[pda0[0],pda1[0]],[pda0[1],pda1[1]],[pda0[2],pda1[2]],[pda0[3],pda1[3]],[pda0[4],pda1[4]]])\n", + "print \"Z0 = \",Z0\n", + "R = transpose(Z0)*Z0\n", + "S = (R**-1)\n", + "y1=[];D=[]\n", + "for i in range(0,5):\n", + " y1.append(a0 * (1-exp(-a1*x[(i)])))\n", + " D.append(y[(i)] - y1[(i)])\n", + "D=array(D) \n", + "D=D.reshape(5,1)\n", + "print \"D = \",D\n", + "M = transpose(Z0)*D\n", + "X = S *M#\n", + "print \"X = \",X\n", + "a0 = a0 + X[0,0]\n", + "a1 = a1 + X[1,0]\n", + "print \"The value of a0 after 1st iteration = \",a0\n", + "print \"The value of a1 after 1st iteration = \",a1" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter18.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter18.ipynb new file mode 100644 index 00000000..e44e3a7b --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter18.ipynb @@ -0,0 +1,268 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter-18 : Interpolation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:18.1 Pg: 490" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "value of ln2 for interpolation region 1 to 6 = 0.3583518\n", + "error by interpolation for interval[1,6] = 48.3007635246 %\n", + "value of ln2 for interpolation region 1 to 6 = 0.462098\n", + "error by interpolation for interval[1,6] = 33.3333506995 %\n" + ] + } + ], + "source": [ + "from math import log\n", + "#f1(x) = f0(x) +(f(x1) - f(x0) *(x - x0)/ (x1 - x0)\n", + "x = 2#\n", + "x0 = 1#\n", + "x1 = 6#\n", + "m = 1.791759#\n", + "n = 0#\n", + "r = log(2)#\n", + "f = 0 + (m - n) * (x - x0) / (x1 - x0)#\n", + "print \"value of ln2 for interpolation region 1 to 6 =\",f\n", + "e = (r - f) * 100/r#\n", + "print \"error by interpolation for interval[1,6] =\",e,\"%\"\n", + "x2 = 4#\n", + "p = 1.386294#\n", + "f = 0 + (p - n) * (x - x0) / (x2 - x0)#\n", + "print \"value of ln2 for interpolation region 1 to 6 =\",f\n", + "e = (r - f) * 100/r#\n", + "print \"error by interpolation for interval[1,6] =\",e,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:18.2 Pg: 492" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "b0 = 0\n", + "b1 = 0.462098\n", + "b2 = -0.0518731\n", + "f(2) = 0.5658442\n", + "error = 18.3659378744 %\n" + ] + } + ], + "source": [ + "from math import log\n", + "x = 2#\n", + "x0 = 1#\n", + "m = 0#\n", + "x1 = 4#\n", + "n = 1.386294#\n", + "x2 = 6#\n", + "p = 1.791759#\n", + "b0 = m#\n", + "b1 = (n - m)/(x1 - x0)#\n", + "b2 = ((p - n)/(x2 - x1) - (n - m)/(x1 - x0))/(x2 - x0)#\n", + "print \"b0 = \",b0\n", + "print \"b1 = \",b1\n", + "print \"b2 = \",b2\n", + "f = b0 + b1*(x - x0) + b2*(x - x0)*(x - x1)#\n", + "print \"f(2) = \",f\n", + "r = log(2)#\n", + "e = (r -f)*100/r#\n", + "print \"error = \",e,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:18.3 Pg: 494" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "b0 = 0\n", + "b1 = 0.462098\n", + "b2 = -0.0518731\n", + "b3 = 0.0078654\n", + "f(2) = 0.6287674\n", + "error = 9.28803901474 %\n" + ] + } + ], + "source": [ + "from math import log\n", + "x = 2#\n", + "x0 = 1#\n", + "m = 0#\n", + "x1 = 4#\n", + "n = 1.386294#\n", + "x3 = 5#\n", + "p = 1.609438#\n", + "x2 = 6#\n", + "o = 1.791759#\n", + "f01 = (m - n)/(x0 - x1)#\n", + "f12 = (n - o)/(x1 - x2)#\n", + "f23 = (p - o)/(x3 - x2)#\n", + "f210 = (f12 - f01)/(x2 - x0)#\n", + "f321 = (f23 - f12)/(x3 - x1)#\n", + "f0123 = (f321 - f210) / (x3 - x0)#\n", + "b0 = m#\n", + "b1 = f01#\n", + "b2 = f210#\n", + "b3 = f0123#\n", + "print \"b0 = \",b0\n", + "print \"b1 = \",b1\n", + "print \"b2 = \",b2\n", + "print \"b3 = \",b3\n", + "f = b0 + b1*(x - x0) + b2*(x - x0)*(x - x1) + b3*(x - x0)*(x - x1)*(x - x2)#\n", + "print \"f(2) = \",f\n", + "r = log(2)#\n", + "e = (r -f)*100/r#\n", + "print \"error = \",e,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:18.4 Pg: 496" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "error R2 = 0.0629232\n" + ] + } + ], + "source": [ + "x = 2#\n", + "x0 = 1#\n", + "m = 0#\n", + "x1 = 4#\n", + "n = 1.386294#\n", + "x3 = 5#\n", + "p = 1.609438#\n", + "x2 = 6#\n", + "o = 1.791759#\n", + "f01 = (m - n)/(x0 - x1)#\n", + "f12 = (n - o)/(x1 - x2)#\n", + "f23 = (p - o)/(x3 - x2)#\n", + "f210 = (f12 - f01)/(x2 - x0)#\n", + "f321 = (f23 - f12)/(x3 - x1)#\n", + "f0123 = (f321 - f210) / (x3 - x0)#\n", + "b0 = m#\n", + "b1 = f01#\n", + "b2 = f210#\n", + "b3 = f0123#\n", + "R2 = b3 * (x - x0) * (x - x1)*(x-x2)#\n", + "print \"error R2 = \",R2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:18.6 Pg: 501" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "first order polynomial f1(2) = 0.462098\n", + "second order polynomial f2(2) = 0.5658442\n" + ] + } + ], + "source": [ + "x = 2#\n", + "x0 = 1#\n", + "m = 0#\n", + "x1 = 4#\n", + "n = 1.386294#\n", + "x2 = 6#\n", + "p = 1.791759#\n", + "f1 = (x - x1)*m/((x0 - x)) + (x- x0) * n/(x1 - x0)#\n", + "print \"first order polynomial f1(2) = \",f1\n", + "f2 = (x - x1)*(x - x2)*m/((x0 - x1)*(x0 - x2)) + (x - x0)*(x - x2)*n/((x1-x0)*(x1-x2)) + (x - x0)*(x - x1)*p/((x2 - x0)*(x2 - x1))#\n", + "print \"second order polynomial f2(2) = \",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.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter19.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter19.ipynb new file mode 100644 index 00000000..cbe17ebc --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter19.ipynb @@ -0,0 +1,268 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "# Chapter-19 : Fourier Approximation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:19.1 Pg: 529" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The least square fit is y=A0+A1*cos(w0*t)+A2*sin(w0*t), where\n", + "A0= 1.70003783298\n", + "A1= 0.500211429839\n", + "B1= -0.866058310862\n", + "Alternatively, the least square fit can be expressed as\n", + "y=A0+C1*cos(w0*t + theta), where\n", + "A0= 1.70003783298\n", + "Theta= 1.04703092349\n", + "C1= 1.00013422717\n", + "Or\n", + "y=A0+C1*sin(w0*t + theta + pi/2), where\n", + "A0= 1.70003783298\n", + "Theta= 1.04703092349\n", + "C1= 1.00013422717\n" + ] + } + ], + "source": [ + "from math import sin,cos,atan\n", + "def f(t):\n", + " y=1.7+cos(4.189*t+1.0472)\n", + " return y\n", + "deltat=0.15#\n", + "t1=0#\n", + "t2=1.35#\n", + "omega=4.189#\n", + "Del=(t2-t1)/9#\n", + "t=[]\n", + "for i in range(1,11):\n", + " t.append(t1+Del*(i-1))\n", + "\n", + "sumy=0#\n", + "suma=0#\n", + "sumb=0#\n", + "y=[];a=[];b=[]\n", + "for i in range(1,11):\n", + " y.append(f(t[i-1]))\n", + " a.append(y[(i-1)]*cos(omega*t[(i-1)]))\n", + " b.append(y[i-1]*sin(omega*t[i-1]))\n", + " sumy=sumy+y[i-1]\n", + " suma=suma+a[i-1]\n", + " sumb=sumb+b[i-1]\n", + "\n", + "A0=sumy/10#\n", + "A1=2*suma/10#\n", + "B1=2*sumb/10#\n", + "print \"The least square fit is y=A0+A1*cos(w0*t)+A2*sin(w0*t), where\"\n", + "print \"A0=\",A0\n", + "print \"A1=\",A1\n", + "print \"B1=\",B1\n", + "theta=atan(-B1/A1)#\n", + "C1=(A1**2 + B1**2)**0.5#\n", + "print \"Alternatively, the least square fit can be expressed as\"\n", + "print \"y=A0+C1*cos(w0*t + theta), where\"\n", + "print \"A0=\",A0\n", + "print \"Theta=\",theta\n", + "print \"C1=\",C1\n", + "print \"Or\"\n", + "print \"y=A0+C1*sin(w0*t + theta + pi/2), where\"\n", + "print \"A0=\",A0\n", + "print \"Theta=\",theta\n", + "print \"C1=\",C1\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:19.2 Pg: 532" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The fourier approximtion is:\n", + "4/(pi)*cos(w)*t) - 4/(3*pi)*cos(3*(w)*t) + 4/(5*pi)*cos(5*(w)*t) - 4/(7*pi)*cos(7*(w)*t) + .....\n" + ] + } + ], + "source": [ + "a0=0#\n", + "#f(t)=-1 for -T/2 to -T/4\n", + "#f(t)=1 for -T/4 to T/4\n", + "#f(t)=-1 for T/4 to T/2\n", + "#ak=2/T* (integration of f(t)*cos(w0*t) from -T/2 to T/2)\n", + "#ak=2/T*((integration of f(t)*cos(w0*t) from -T/2 to -T/4) + (integration of f(t)*cos(w0*t) from -T/4 to T/4) + (integration of f(t)*cos(w0*t) from T/4 to T/2))\n", + "#Therefore, \n", + "#ak=4/(k*pi) for k=1,5,9,.....\n", + "#ak=-4/(k*pi) for k=3,7,11,.....\n", + "#ak=0 for k=even integers\n", + "#similarly we find the b's.\n", + "#all the b's=0\n", + "print \"The fourier approximtion is:\"\n", + "print \"4/(pi)*cos(w)*t) - 4/(3*pi)*cos(3*(w)*t) + 4/(5*pi)*cos(5*(w)*t) - 4/(7*pi)*cos(7*(w)*t) + .....\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:19.3 Pg: 550" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEZCAYAAABxbJkKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHTpJREFUeJzt3XmUVOW57/HvAziTgEoERRTHqMcJByQoWNcgtugF43IC\njUcTr8M5ijFiCJJEstRDnI5jVGJEcUCicKQFcdZyiB5QAVFAoqIIGtoBB5Ag3fRz/3hLbYtu6KF2\nv1W1f5+1aqWqenf1Uyuyf/sdt7k7IiKSTm1iFyAiIvEoBEREUkwhICKSYgoBEZEUUwiIiKSYQk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kwhICKSYgoBEZEUUwiIiKSYQkCkGczsQDN7zcw2MrPNcjfO2SN2XSJNpRXDIs1kZpcC\nGwObAIvd/YrIJYk0mUJApJlyu6S+AvwL+InrH5OUIHUHiTRfJ2AzoD2hNSBSctQSEGkmM3sIGA/s\nCGzt7udFLkmkyYp2K2mRYmZmpwJfu/uE3HbSL5pZxt2zkUsTaRK1BEREUkxjAiIiKaYQEBFJMYWA\niEiKKQRERFJMISAikmIKARGRFFMIiIikmEJARCTF/j9XY7PcJHdyzQAAAABJRU5ErkJggg==\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7f1a75daff90>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from numpy import arange,log\n", + "%matplotlib inline\n", + "from matplotlib.pyplot import plot, title,xlabel,ylabel,show\n", + "x=arange(0.5,5.6,0.5)\n", + "y=[]\n", + "for i in range(1,12):\n", + " y.append(0.9846*log(x[i-1])+1.0004)\n", + "\n", + "plot(x,y)\n", + "title(\"y vs x\")\n", + "xlabel(\"x\")\n", + "ylabel(\"y\")\n", + "show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:19.6 Pg: 555" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The cubic polynomial is y=a0 + a1*x + a2*x**2 + a3*x**3, where a0, a1, a2 and a3 are\n", + "[[ 1.67644593 0.76697402 0.5511316 0.46451844]\n", + " [ 2.56065822 1.84003582 1.55086475 1.40157818]\n", + " [ 3.36495108 2.83613174 2.5631251 2.40990305]\n", + " [ 3.94388659 3.56424723 3.35117872 3.23471752]]\n" + ] + } + ], + "source": [ + "from numpy import nditer,mat,divide\n", + "x=[0.05, 0.12, 0.15, 0.3, 0.45 ,0.7 ,0.84 ,1.05]\n", + "y=[0.957, 0.851, 0.832, 0.72 ,0.583, 0.378, 0.295, 0.156]\n", + "sx=sum(x)#\n", + "sxx=0\n", + "for xx in x:\n", + " sxx+=xx*xx\n", + "sx3=0\n", + "for xx in x:\n", + " sx3+=xx*xx*xx\n", + "sx4=0\n", + "for xx in x:\n", + " sx4+=xx*xx*xx*xx\n", + "\n", + "sx5=0\n", + "for xx in x:\n", + " sx5+=xx*xx*xx*xx*xx\n", + " \n", + "sx6=0\n", + "for xx in x:\n", + " sx6+=xx*xx*xx*xx*xx*xx\n", + "\n", + "n=8#\n", + "sy=sum(y)#\n", + "sxy=0\n", + "for xx,yy in nditer([x,y]):\n", + " sxy+=xx*yy\n", + " \n", + " \n", + "sx2y=0\n", + "for xx,yy in nditer([x,y]):\n", + " sx2y+=xx*xx*yy\n", + "\n", + "sx3y=0\n", + "for xx,yy in nditer([x,y]):\n", + " sx3y+=xx*xx*xx*yy\n", + "\n", + "m=mat([[n, sx, sxx ,sx3],[sx, sxx, sx3, sx4],[sxx, sx3, sx4, sx5],[sx3, sx4, sx5, sx6]])\n", + "p=mat([[sy],[sxy],[sx2y],[sx3y]])\n", + "a=divide(m,p)\n", + "print \"The cubic polynomial is y=a0 + a1*x + a2*x**2 + a3*x**3, where a0, a1, a2 and a3 are\"\n", + "print a" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter21.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter21.ipynb new file mode 100644 index 00000000..507735ab --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter21.ipynb @@ -0,0 +1,725 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 21 Newtin-cotes integration formula" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex : 21.1 Pg : 612" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The Error Et= 1.468\n", + "The percent relative error et= 89.467 %\n", + "The approximate error estimate without using the true value= 2.56\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "def f(x):\n", + " y=(0.2+25*x-200*x**2+675*x**3-900*x**4+400*x**5)\n", + " return y\n", + "tval=1.640533#\n", + "a=0#\n", + "b=0.8#\n", + "fa=f(a)#\n", + "fb=f(b)#\n", + "l=(b-a)*((fa+fb)/2)#\n", + "Et=tval-l##error\n", + "et=Et*100/tval##percent relative error\n", + "\n", + "#by using approximate error estimate\n", + "\n", + "#the second derivative of f\n", + "def g(x):\n", + " y=-400+4050*x-10800*x**2+8000*x**3\n", + " return y\n", + "\n", + "from sympy.mpmath import quad\n", + "f2x=quad(g,[0,0.8])/(b-a)##average value of second derivative\n", + "Ea=-(1/12)*(f2x)*(b-a)**3#\n", + "print \"The Error Et=\",round(Et,3)\n", + "print \"The percent relative error et=\",round(et,3),\"%\"\n", + "print \"The approximate error estimate without using the true value=\",Ea" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex : 21.2 Pg : 613" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The Error Et= 0.572\n", + "The percent relative error et= 34.85 %\n", + "The approximate error estimate without using the true value= 0.64\n" + ] + } + ], + "source": [ + "def f(x):\n", + " y=(0.2+25*x-200*x**2+675*x**3-900*x**4+400*x**5)\n", + " return y\n", + "a=0#\n", + "b=0.8#\n", + "tval=1.640533#\n", + "n=2#\n", + "h=(b-a)/n#\n", + "fa=f(a)#\n", + "fb=f(b)#\n", + "fh=f(h)#\n", + "l=(b-a)*(fa+2*fh+fb)/(2*n)#\n", + "Et=tval-l##error\n", + "et=Et*100/tval##percent relative error\n", + "\n", + "#by using approximate error estimate\n", + "\n", + "#the second derivative of f\n", + "def g(x):\n", + " y=-400+4050*x-10800*x**2+8000*x**3\n", + " return y\n", + "f2x=quad(g,[0,0.8])/(b-a)##average value of second derivative\n", + "Ea=-(1/12)*(f2x)*(b-a)**3/(n**2)#\n", + "print \"The Error Et=\",round(Et,3)\n", + "print \"The percent relative error et=\",round(et,3),\"%\"\n", + "print \"The approximate error estimate without using the true value=\",Ea" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex :21.3 Pg : 614" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "No. of segments= 10\n", + "Segment size= 1.0\n", + "Estimated d= 288.749146143 m\n", + "0.237014701487 et(%)\n", + "---------------------------------------------------------\n", + "No. of segments= 20\n", + "Segment size= 0.5\n", + "Estimated d= 289.263574224 m\n", + "0.0592795228803 et(%)\n", + "---------------------------------------------------------\n", + "No. of segments= 50\n", + "Segment size= 0.2\n", + "Estimated d= 298.382319223 m\n", + "et(%) -3.09125177877\n", + "---------------------------------------------------------\n", + "No. of segments= 100\n", + "Segment size= 0.1\n", + "Estimated d= 293.915596452 m\n", + "et(%) -1.54799665905\n", + "---------------------------------------------------------\n", + "No. of segments= 100\n", + "Segment size= 0.1\n", + "Estimated d= 293.915596452 m\n", + "et(%) -1.54799665905\n", + "---------------------------------------------------------\n", + "No. of segments= 200\n", + "Segment size= 0.05\n", + "Estimated d= 289.43343055 m\n", + "et(%) 0.000594070904571\n", + "---------------------------------------------------------\n", + "No. of segments= 200\n", + "Segment size= 0.05\n", + "Estimated d= 289.43343055 m\n", + "et(%) 0.000594070904571\n", + "---------------------------------------------------------\n", + "No. of segments= 500\n", + "Segment size= 0.02\n", + "Estimated d= 290.332334709 m\n", + "et(%) -0.309977799375\n", + "---------------------------------------------------------\n", + "No. of segments= 1000\n", + "Segment size= 0.01\n", + "Estimated d= 289.883809248 m\n", + "et(%) -0.155012011658\n", + "---------------------------------------------------------\n", + "No. of segments= 2000\n", + "Segment size= 0.005\n", + "Estimated d= 289.435129352 m\n", + "et(%) 7.13401428866e-06\n", + "---------------------------------------------------------\n", + "No. of segments= 2000\n", + "Segment size= 0.005\n", + "Estimated d= 289.435129352 m\n", + "et(%) 7.13401428866e-06\n", + "---------------------------------------------------------\n", + "No. of segments= 5000\n", + "Segment size= 0.002\n", + "Estimated d= 289.435143766 m\n", + "et(%) 2.15393877364e-06\n", + "---------------------------------------------------------\n", + "No. of segments= 5000\n", + "Segment size= 0.002\n", + "Estimated d= 289.435143766 m\n", + "et(%) 2.15393877364e-06\n", + "---------------------------------------------------------\n", + "No. of segments= 10000\n", + "Segment size= 0.001\n", + "Estimated d= 289.480018962 m\n", + "et(%) -0.0155022506708\n", + "---------------------------------------------------------\n" + ] + } + ], + "source": [ + "g=9.8##m/s**2# acceleration due to gravity\n", + "m=68.1##kg\n", + "c=12.5##kg/sec# drag coefficient\n", + "def f(t):\n", + " from numpy import exp\n", + " v=g*m*(1-exp(-c*t/m))/c\n", + " return v\n", + "tval=289.43515##m\n", + "a=0#\n", + "b=10#\n", + "fa=f(a)#\n", + "fb=f(b)#\n", + "from numpy import arange, exp\n", + "for i in arange(10,21,10):\n", + " n=i#\n", + " h=(b-a)/n#\n", + " print \"No. of segments=\",i\n", + " print \"Segment size=\",h\n", + " j=a+h#\n", + " s=0#\n", + " while j<b:\n", + " s=s+f(j)#\n", + " j=j+h#\n", + " \n", + " l=(b-a)*(fa+2*s+fb)/(2*n)#\n", + " Et=tval-l##error\n", + " et=Et*100/tval##percent relative error\n", + " print \"Estimated d=\",l,\"m\"\n", + " print et,\"et(%)\"\n", + " print \"---------------------------------------------------------\"\n", + "\n", + "for i in arange(50,101,50):\n", + " n=i#\n", + " h=(b-a)/n#\n", + " print \"No. of segments=\",i\n", + " print \"Segment size=\",h\n", + " j=a+h#\n", + " s=0#\n", + " while j<b:\n", + " s=s+f(j)#\n", + " j=j+h#\n", + " \n", + " l=(b-a)*(fa+2*s+fb)/(2*n)#\n", + " Et=tval-l##error\n", + " et=Et*100/tval##percent relative error\n", + " print \"Estimated d=\",l,\"m\"\n", + " print \"et(%)\",et\n", + " print \"---------------------------------------------------------\"\n", + "\n", + "for i in arange(100,201,100):\n", + " n=i#\n", + " h=(b-a)/n#\n", + " print \"No. of segments=\",i\n", + " print \"Segment size=\",h\n", + " j=a+h#\n", + " s=0#\n", + " while j<b:\n", + " s=s+f(j)#\n", + " j=j+h#\n", + " \n", + " l=(b-a)*(fa+2*s+fb)/(2*n)#\n", + " Et=tval-l##error\n", + " et=Et*100/tval##percent relative error\n", + " print \"Estimated d=\",l,\"m\"\n", + " print \"et(%)\",et\n", + " print \"---------------------------------------------------------\"\n", + "\n", + "for i in arange(200,501,300):\n", + " n=i#\n", + " h=(b-a)/n#\n", + " print \"No. of segments=\",i\n", + " print \"Segment size=\",h\n", + " j=a+h#\n", + " s=0#\n", + " while j<b:\n", + " s=s+f(j)#\n", + " j=j+h#\n", + " \n", + " l=(b-a)*(fa+2*s+fb)/(2*n)#\n", + " Et=tval-l##error\n", + " et=Et*100/tval##percent relative error\n", + " print \"Estimated d=\",l,\"m\"\n", + " print \"et(%)\",et\n", + " print \"---------------------------------------------------------\"\n", + "\n", + "for i in arange(1000,2001,1000):\n", + " n=i#\n", + " h=(b-a)/n#\n", + " print \"No. of segments=\",i\n", + " print \"Segment size=\",h\n", + " j=a+h#\n", + " s=0#\n", + " while j<b:\n", + " s=s+f(j)#\n", + " j=j+h#\n", + " \n", + " l=(b-a)*(fa+2*s+fb)/(2*n)#\n", + " Et=tval-l##error\n", + " et=Et*100/tval##percent relative error\n", + " print \"Estimated d=\",l,\"m\"\n", + " print \"et(%)\",et\n", + " print \"---------------------------------------------------------\"\n", + "\n", + "for i in arange(2000,5001,3000):\n", + " n=i#\n", + " h=(b-a)/n#\n", + " print \"No. of segments=\",i\n", + " print \"Segment size=\",h\n", + " j=a+h#\n", + " s=0#\n", + " while j<b:\n", + " s=s+f(j)#\n", + " j=j+h#\n", + " \n", + " l=(b-a)*(fa+2*s+fb)/(2*n)#\n", + " Et=tval-l##error\n", + " et=Et*100/tval##percent relative error\n", + " print \"Estimated d=\",l,\"m\"\n", + " print \"et(%)\",et\n", + " print \"---------------------------------------------------------\"\n", + "\n", + "for i in arange(5000,10001,5000):\n", + " n=i#\n", + " h=(b-a)/n#\n", + " print \"No. of segments=\",i\n", + " print \"Segment size=\",h\n", + " j=a+h#\n", + " s=0#\n", + " while j<b:\n", + " s=s+f(j)#\n", + " j=j+h#\n", + " \n", + " l=(b-a)*(fa+2*s+fb)/(2*n)#\n", + " Et=tval-l##error\n", + " et=Et*100/tval##percent relative error\n", + " print \"Estimated d=\",l,\"m\"\n", + " print \"et(%)\",et\n", + " print \"---------------------------------------------------------\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex : 21.4 Pg : 618" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "l= 1.37\n", + "The Error Et= 0.27\n", + "The percent relative error et= 16.645 %\n", + "The approximate error estimate without using the true value= 0.273\n" + ] + } + ], + "source": [ + "def f(x):\n", + " y=(0.2+25*x-200*x**2+675*x**3-900*x**4+400*x**5)\n", + " return y\n", + "a=0#\n", + "b=0.8#\n", + "tval=1.640533#\n", + "n=2#\n", + "h=(b-a)/n#\n", + "fa=f(a)#\n", + "fb=f(b)#\n", + "fh=f(h)#\n", + "l=(b-a)*(fa+4*fh+fb)/(3*n)#\n", + "print\"l=\", round(l,2)\n", + "Et=tval-l##error\n", + "et=Et*100/tval##percent relative error\n", + "\n", + "#by using approximate error estimate\n", + "\n", + "#the fourth derivative of f\n", + "def g(x):\n", + " y=-21600+48000*x\n", + " return y\n", + "\n", + "f4x=quad(g,[0,0.8])/(b-a)##average value of fourth derivative\n", + "Ea=-(1/2880)*(f4x)*(b-a)**5#\n", + "print \"The Error Et=\",round(Et,2)\n", + "print \"The percent relative error et=\",round(et,3),\"%\"\n", + "print \"The approximate error estimate without using the true value=\",round(Ea,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex : 23.5 Pg : 620" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "l= 1.62\n", + "The Error Et= 0.02\n", + "The percent relative error et= 1.04 %\n", + "The approximate error estimate without using the true value= 0.017\n" + ] + } + ], + "source": [ + "def f(x):\n", + " y=(0.2+25*x-200*x**2+675*x**3-900*x**4+400*x**5)\n", + " return y\n", + "a=0#\n", + "b=0.8#\n", + "tval=1.640533#\n", + "n=4#\n", + "h=(b-a)/n#\n", + "fa=f(a)#\n", + "fb=f(b)#\n", + "j=a+h#\n", + "s=0#\n", + "count=1#\n", + "while j<b:\n", + " if (-1)**count==-1:\n", + " s=s+4*f(j)#\n", + " else:\n", + " s=s+2*f(j)#\n", + " \n", + " count=count+1#\n", + " j=j+h#\n", + "\n", + "l=(b-a)*(fa+s+fb)/(3*n)#\n", + "print\"l=\", round(l,2)\n", + "Et=tval-l##error\n", + "et=Et*100/tval##percent relative error\n", + "\n", + "#by using approximate error estimate\n", + "\n", + "#the fou:rth derivative of f\n", + "def g(x):\n", + " y=-21600+48000*x\n", + " return y\n", + "f4x=quad(g,[0,0.8])/(b-a)##average value of fourth derivative\n", + "Ea=-(1/(180*4**4))*(f4x)*(b-a)**5#\n", + "print \"The Error Et=\",round(Et,2)\n", + "print \"The percent relative error et=\",round(et,3),\"%\"\n", + "print \"The approximate error estimate without using the true value=\",round(Ea,3)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex :23.6 Pg : 625" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Part A:\n", + "l= 1.519\n", + "The Error Et= 0.12\n", + "The percent relative error et= 7.398 %\n", + "The approximate error estimate without using the true value= 0.121\n", + "---------------------------------------------------\n", + "Part B:\n", + "l= 1.645\n", + "The Error Et= -0.005\n", + "The percent relative error et= -0.277 %\n" + ] + } + ], + "source": [ + "def f(x):\n", + " y=(0.2+25*x-200*x**2+675*x**3-900*x**4+400*x**5)\n", + " return y\n", + "a=0#\n", + "b=0.8#\n", + "tval=1.640533#\n", + "#part a\n", + "n=3#\n", + "h=(b-a)/n#\n", + "fa=f(a)#\n", + "fb=f(b)#\n", + "j=a+h#\n", + "s=0#\n", + "count=1#\n", + "while j<b:\n", + " s=s+3*f(j)#\n", + " count=count+1#\n", + " j=j+h#\n", + "\n", + "l=(b-a)*(fa+s+fb)/(8)#\n", + "print \"Part A:\"\n", + "print \"l=\",round(l,3)\n", + "Et=tval-l##error\n", + "et=Et*100/tval##percent relative error\n", + "\n", + "#by using approximate error estimate\n", + "\n", + "#the fourth derivative of f\n", + "def g(x):\n", + " y=-21600+48000*x\n", + " return y\n", + "f4x=quad(g,[0,0.8])/(b-a)##average value of fourth derivative\n", + "Ea=-(1/6480)*(f4x)*(b-a)**5#\n", + "print \"The Error Et=\",round(Et,2)\n", + "print \"The percent relative error et=\",round(et,3),\"%\"\n", + "print \"The approximate error estimate without using the true value=\",round(Ea,3)\n", + "#part b\n", + "n=5#\n", + "h=(b-a)/n#\n", + "l1=(a+2*h-a)*(fa+4*f(a+h)+f(a+2*h))/6#\n", + "l2=(a+5*h-a-2*h)*(f(a+2*h)+3*(f(a+3*h)+f(a+4*h))+fb)/8#\n", + "l=l1+l2#\n", + "print \"---------------------------------------------------\"\n", + "print \"Part B:\"\n", + "print \"l=\", round(l,3)\n", + "Et=tval-l##error\n", + "et=Et*100/tval##percent relative error\n", + "print \"The Error Et=\", round(Et,3)\n", + "print \"The percent relative error et=\", round(et,3), \"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex : 23.7 Pg : 626" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "l= 1.59480096\n", + "The Error Et= 0.04573204\n", + "The percent relative error et= 2.78763304365 %\n" + ] + } + ], + "source": [ + "def f(x):\n", + " y=(0.2+25*x-200*x**2+675*x**3-900*x**4+400*x**5)\n", + " return y\n", + "tval=1.640533#\n", + "x=[0, 0.12, 0.22, 0.32, 0.36, 0.4 ,0.44 ,0.54 ,0.64 ,0.7 ,0.8]\n", + "func=[]\n", + "for i in range(0,11):\n", + " func.append(f(x[i]))#\n", + "\n", + "l=0#\n", + "for i in range(0,10):\n", + " l=l+(x[i+1]-x[i])*(func[i]+func[i+1])/2#\n", + "\n", + "print \"l=\",l\n", + "Et=tval-l##error\n", + "et=Et*100/tval##percent relative error\n", + "print \"The Error Et=\",Et\n", + "print \"The percent relative error et=\",et,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex : 23.8 Pg : 230" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "l= 1.60364091733\n", + "The Error Et= 0.0368920826667\n", + "The percent relative error et= 2.2487863802 %\n" + ] + } + ], + "source": [ + "def f(x):\n", + " y=(0.2+25*x-200*x**2+675*x**3-900*x**4+400*x**5)\n", + " return y\n", + "tval=1.640533#\n", + "x=[0, 0.12, 0.22, 0.32, 0.36, 0.4 ,0.44 ,0.54, 0.64, 0.7, 0.8]\n", + "func =[]\n", + "for i in range(0,11):\n", + " func.append(f(x[i]))\n", + "\n", + "l1=(x[1]-x[0])*((f(x[0])+f(x[1]))/2)#\n", + "l2=(x[3]-x[1])*(f(x[3])+4*f(x[2])+f(x[1]))/6#\n", + "l3=(x[6]-x[3])*(f(x[3])+3*(f(x[4])+f(x[5]))+f(x[6]))/8#\n", + "l4=(x[8]-x[6])*(f(x[6])+4*f(x[7])+f(x[8]))/6\n", + "l5=(x[9]-x[8])*((f(x[9])+f(x[8]))/2)#\n", + "l6=(x[10]-x[9])*((f(x[10])+f(x[9]))/2)#\n", + "l=l1+l2+l3+l4+l5+l6#\n", + "print \"l=\",l\n", + "Et=tval-l##error\n", + "et=Et*100/tval##percent relative error\n", + "print \"The Error Et=\",Et\n", + "print \"The percent relative error et=\",et,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex : 23.9 Pg : 629" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The average termperature is= 53.0\n" + ] + } + ], + "source": [ + "def f(x,y):\n", + " t=2*x*y+2*x-x**2-2*y**2+72\n", + " return t\n", + "Len=8##m,length\n", + "wid=6##m,width\n", + "a=0#\n", + "b=Len#\n", + "n=2#\n", + "h=(b-a)/n#\n", + "a1=0#\n", + "b1=wid#\n", + "h1=(b1-a1)/n#\n", + "\n", + "fa=f(a,0)#\n", + "fb=f(b,0)#\n", + "fh=f(h,0)#\n", + "lx1=(b-a)*(fa+2*fh+fb)/(2*n)#\n", + "\n", + "fa=f(a,h1)#\n", + "fb=f(b,h1)#\n", + "fh=f(h,h1)#\n", + "lx2=(b-a)*(fa+2*fh+fb)/(2*n)#\n", + "\n", + "fa=f(a,b1)#\n", + "fb=f(b,b1)#\n", + "fh=f(h,b1)#\n", + "lx3=(b-a)*(fa+2*fh+fb)/(2*n)#\n", + "\n", + "l=(b1-a1)*(lx1+2*lx2+lx3)/(2*n)#\n", + "\n", + "avg_temp=l/(Len*wid)#\n", + "print\"The average termperature is=\", avg_temp" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter22.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter22.ipynb new file mode 100644 index 00000000..50a8dfb0 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter22.ipynb @@ -0,0 +1,334 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter-22 : Integration of Equations" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:22.1 Pg: 624" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Error of the improved integral for segment 1 and 2 = 16.6449765615 %\n", + "Error of the improved integral for segment 4 and 2 = 1.04029198641 %\n" + ] + } + ], + "source": [ + "h = [0,0.8,0.4,0.2]#\n", + "I = [0,0.1728,1.0688,1.4848]#\n", + "E = [0,89.5,34.9,9.5]#\n", + "I1 = 4 * I[(2)] / 3 - I[(1)] / 3#\n", + "t = 1.640533#\n", + "et1 = t - I1 #\n", + "Et1 = et1 * 100/t#\n", + "print \"Error of the improved integral for segment 1 and 2 = \",Et1,\"%\"\n", + "I2 = 4 * I[(3)] / 3 - I[(2)] / 3#\n", + "et2 = t - I2 #\n", + "Et2 = et2 * 100/t#\n", + "print \"Error of the improved integral for segment 4 and 2 = \",Et2,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:22.2 Pg: 645" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Obtained integral which is the correct answer till the seventh decimal 1.64053366667\n" + ] + } + ], + "source": [ + "I1 = 1.367467#\n", + "I2 = 1.623467#\n", + "I = 16 * I2 /15 - I1 / 15#\n", + "print \"Obtained integral which is the correct answer till the seventh decimal\",I" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:22.3 Pg: 645" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Integral obtained using gauss legendre formulae = 1.9648\n", + "error = -19.7659541137 %\n" + ] + } + ], + "source": [ + "#f(x) = 0.2 + 25*x - 200*x**2 + 675*x**3 - 900*x**4 + 400*x**5\n", + "# for using two point gauss legendre formulae, the intervals have to be changed to -1 and 1\n", + "#therefore, x = 0.4 + 0.4 * xd\n", + "#thus the integral is transferred to \n", + "#(0.2 + 25*(0.4+0.4*x) - 200*(0.4 + 0.4*x)**2 + 675*(0.4 + 0.4*x)**3 - 900*(0.4 + 0.4*x)**4 + 400*(0.4 + 0.4*x)**5)*0.4\n", + "#for three point gauss legendre formulae\n", + "x1 = -(1/3) ** 0.5#\n", + "x2 = (1/3) ** 0.5#\n", + "I1 = (0.2 + 25*(0.4+0.4*x1) - 200*(0.4 + 0.4*x1)**2 + 675*(0.4 + 0.4*x1)**3 - 900*(0.4 + 0.4*x1)**4 + 400*(0.4 + 0.4*x1)**5)*0.4#\n", + "I2 = (0.2 + 25*(0.4+0.4*x2) - 200*(0.4 + 0.4*x2)**2 + 675*(0.4 + 0.4*x2)**3 - 900*(0.4 + 0.4*x2)**4 + 400*(0.4 + 0.4*x2)**5)*0.4#\n", + "I = I1 + I2#\n", + "print \"Integral obtained using gauss legendre formulae =\",I\n", + "t = 1.640533#\n", + "e = (t - I)*100/t#\n", + "print \"error = \",e,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Ex:22.4 Pg: 647" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "integral obtained using three point gauss legendre formulae = 1.64053334735\n" + ] + } + ], + "source": [ + "# f(x) = 0.2 + 25*x - 200*x**2 + 675*x**3 - 900*x**4 + 400*x**5\n", + "# for using three point gauss legendre formulae, the intervals have to be changed to -1 and 1\n", + "#therefore, x = 0.4 + 0.4 * xd\n", + "#thus the integral is transferred to \n", + "#(0.2 + 25*(0.4+0.4*x) - 200*(0.4 + 0.4*x)**2 + 675*(0.4 + 0.4*x)**3 - 900*(0.4 + 0.4*x)**4 + 400*(0.4 + 0.4*x)**5)*0.4\n", + "#for three point gauss legendre formulae\n", + "x1 = -0.7745967#\n", + "x2 = 0#\n", + "x3 = 0.7745967#\n", + "c0 = 0.5555556#\n", + "c1 = 0.8888889#\n", + "c2 = 0.5555556#\n", + "I1 = (0.2 + 25*(0.4+0.4*x1) - 200*(0.4 + 0.4*x1)**2 + 675*(0.4 + 0.4*x1)**3 - 900*(0.4 + 0.4*x1)**4 + 400*(0.4 + 0.4*x1)**5)*0.4#\n", + "I2 = (0.2 + 25*(0.4+0.4*x2) - 200*(0.4 + 0.4*x2)**2 + 675*(0.4 + 0.4*x2)**3 - 900*(0.4 + 0.4*x2)**4 + 400*(0.4 + 0.4*x2)**5)*0.4#\n", + "I3 = (0.2 + 25*(0.4+0.4*x3) - 200*(0.4 + 0.4*x3)**2 + 675*(0.4 + 0.4*x3)**3 - 900*(0.4 + 0.4*x3)**4 + 400*(0.4 + 0.4*x3)**5)*0.4#\n", + "I = c0 * I1 + c1 * I2 + c2 * I3#\n", + "print \"integral obtained using three point gauss legendre formulae = \",I" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:22.5 Pg: 647" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "integral by two point method = 320.657652324\n", + "integral by three point method = 289.439308244\n", + "integral by four point method = 289.435164941\n", + "integral by five point method = 289.435160633\n" + ] + } + ], + "source": [ + "from math import exp\n", + "#f(t) = g*m*(int(0,10,(1-exp(-c*t/m))))/c\n", + "#for using gauss quadrature method, limits are changed to -1 to 1 by replcing x = 5 + 5*xd\n", + "#the new integral obtained is\n", + "#(1 - exp(-c*(5 + 5*x)/m ))*5\n", + "g = 9.8#\n", + "c = 12.5#\n", + "m = 68.1#\n", + "#for two point method\n", + "x1 = -(1/3)**0.5#\n", + "x2 = (1/3)**0.5#\n", + "I1 = g*m*(1 - exp(-c*(5 + 5*x1)/m ))*5 / c#\n", + "I2 = g*m*(1 - exp(-c*(5 + 5*x2)/m ))*5 / c#\n", + "I = I1 + I2#\n", + "print \"integral by two point method = \",I\n", + "x1 = -0.7745967#\n", + "x2 = 0#\n", + "x3 = 0.7745967#\n", + "c0 = 0.5555556#\n", + "c1 = 0.8888889#\n", + "c2 = 0.5555556#\n", + "I1 = g*m*(1 - exp(-c*(5 + 5*x1)/m ))*5 / c#\n", + "I2 = g*m*(1 - exp(-c*(5 + 5*x2)/m ))*5 / c#\n", + "I3 = g*m*(1 - exp(-c*(5 + 5*x3)/m ))*5 / c#\n", + "I = c0*I1 + c1 * I2 + c2 * I3#\n", + "print \"integral by three point method =\",I\n", + "x1 = -0.861136312#\n", + "x2 = -0.339981044#\n", + "x3 = 0.339981044#\n", + "x4 = 0.861136312#\n", + "c1 = 0.3478548#\n", + "c2 = 0.6521452#\n", + "c3 = 0.6521452#\n", + "c4 = 0.3478548#\n", + "I1 = g*m*(1 - exp(-c*(5 + 5*x1)/m ))*5 / c#\n", + "I2 = g*m*(1 - exp(-c*(5 + 5*x2)/m ))*5 / c#\n", + "I3 = g*m*(1 - exp(-c*(5 + 5*x3)/m ))*5 / c#\n", + "I4 = g*m*(1 - exp(-c*(5 + 5*x4)/m ))*5 / c#\n", + "I = c1*I1 + c2 * I2 + c3 * I3 + c4 * I4#\n", + "print \"integral by four point method =\",I\n", + "x1 = -0.906179846#\n", + "x2 = -0.538469310#\n", + "x3 = 0#\n", + "x4 = 0.538469310#\n", + "x5 = 0.906179846\n", + "c1 = 0.2369269#\n", + "c2 = 0.4786287#\n", + "c3 = 0.5688889#\n", + "c4 = 0.4786287#\n", + "c5 = 0.2369269# \n", + "I1 = g*m*(1 - exp(-c*(5 + 5*x1)/m ))*5 / c#\n", + "I2 = g*m*(1 - exp(-c*(5 + 5*x2)/m ))*5 / c#\n", + "I3 = g*m*(1 - exp(-c*(5 + 5*x3)/m ))*5 / c#\n", + "I4 = g*m*(1 - exp(-c*(5 + 5*x4)/m ))*5 / c#\n", + "I5 = g*m*(1 - exp(-c*(5 + 5*x5)/m ))*5 / c#\n", + "I = c1*I1 + c2 * I2 + c3 * I3 + c4 * I4 + c5 * I5#\n", + "print \"integral by five point method =\",I" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:22.6 Pg: 649" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "the value of first integral = 0.0\n", + "The value of second integral = 1.93292644948\n", + "Therefore the final result can be computed as : 0.771126085603\n", + "error = 8.34112853886 %\n" + ] + } + ], + "source": [ + "from math import exp,pi\n", + "#N(x) = (int(-infinity,-2,exp(-(x**2)/2)) + int(-2,1,exp(-(x**2)/2)))/(2*pi)**0.5\n", + "#first integral can be solved as\n", + "#int(-infinity,-2,exp(-(x**2)/2)) = int(-0.5,0,exp(-1/(2*t**2))/t**2)\n", + "h = 1/8#\n", + "#int(-0.5,0,exp(-1/(2*t**2))/t**2) = h*(f(x-7/16) + f(x-5/16) + f(x-3/16) + f(x-1/16)) \n", + "t1 = -7/16#\n", + "t2 = -5/16#\n", + "t3 = -3/16#\n", + "t4 = -1/16#\n", + "m1 = exp(-1/(2*t1**2))/t1**2#\n", + "m2 = exp(-1/(2*t2**2))/t2**2#\n", + "m3 = exp(-1/(2*t3**2))/t3**2#\n", + "m4 = exp(-1/(2*t4**2))/t4**2#\n", + "I1 = h*(m1 + m2 + m3 + m4)#\n", + "print \"the value of first integral = \",I1\n", + "#simpsons 1/3rd sule is applied for the second integral\n", + "h1 = 0.5#\n", + "x1 = -2#\n", + "x2 = -1.5#\n", + "x3 = -1#\n", + "x4 = -0.5#\n", + "x5 = 0#\n", + "x6 = 0.5#\n", + "x7 = 1#\n", + "n1 = exp(-(x1**2)/2)#\n", + "n2 = exp(-(x2**2)/2)#\n", + "n3 = exp(-(x3**2)/2)#\n", + "n4 = exp(-(x4**2)/2)#\n", + "n5 = exp(-(x5**2)/2)#\n", + "n6 = exp(-(x6**2)/2)#\n", + "n7 = exp(-(x7**2)/2)#\n", + "I2 =(1-(-2)) * (n1 + 4 *(n2 + n4 + n6) + 2*(n3 + n5) + n7)/(18)#\n", + "print \"The value of second integral = \",I2\n", + "f = (I1 + I2)/(2 * pi)**0.5#\n", + "print \"Therefore the final result can be computed as :\",f\n", + "N = 0.8413#\n", + "e = (N - f) * 100 / N#\n", + "print \"error = \",e,\"%\"" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter23.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter23.ipynb new file mode 100644 index 00000000..fd068f1e --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter23.ipynb @@ -0,0 +1,271 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter-23 : Numerical Differentiation" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:23.1 Pg: 656" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x = [ 0. 0.25 0.5 0.75 1. ]\n", + "f(x) = [0, 1.2, 1.103515625, 0.92499999999999993, 0.63632812499999991, 0.19999999999999996]\n", + "by forward difference : -0.859375\n", + "error in forward difference method = 5.82191780822 %\n", + "by backward difference -0.878125\n", + "error in backward difference method = 3.76712328767 %\n", + "by central difference : -0.9125\n", + "error in central difference method = -2.43336553343e-14 %\n" + ] + } + ], + "source": [ + "from numpy import arange\n", + "#f(x) = -0.1*x**4 - 0.15*x**3 - 0.5 * x**2 - 0.25 *x + 1.2\n", + "h = 0.25#\n", + "t = -0.9125#\n", + "x = arange(0,1.1,h)\n", + "print \"x = \",x\n", + "fx=[0]\n", + "for xx in x:\n", + " fx.append(-0.1*xx**4 - 0.15*xx**3 - 0.5 * xx**2 - 0.25 *xx + 1.2)\n", + "print \"f(x) = \",fx\n", + "fd = (- fx[(5)] + 4*fx[(4)] - 3 * fx[(3)])/(2 * h)\n", + "efd = (t - fd) * 100 / t#\n", + "print \"by forward difference : \",fd\n", + "print \"error in forward difference method = \",efd,\"%\"\n", + "bd = (3 * fx[(3)] - 4 * fx[(2)] + fx[(1)])/ (2*h)\n", + "ebd = (t - bd) * 100 / t#\n", + "print \"by backward difference\",bd\n", + "print \"error in backward difference method = \",ebd,\"%\"\n", + "cdm = (-fx[(5)] + 8*(fx[(4)]) -8*fx[(2)] + fx[(1)] ) / (12*h)\n", + "ecdm = (t - cdm) * 100 / t\n", + "print \"by central difference : \",cdm\n", + "print \"error in central difference method = \",ecdm,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:23.2 Pg: 657" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x with h = 0.5 is [ 0. 0.5 1. ]\n", + "f(x) with h = 0.5 is [0, 1.2, 0.92499999999999993, 0.19999999999999996]\n", + "by central difference ( h = 0.5 ) -1.0\n", + "error in central difference method ( h = 0.5 ) = -9.58904109589 %\n", + "x with h = 0.25 is [ 0. 0.25 0.5 0.75 1. ]\n", + "fx with h = 0.25 is [0, 1.2, 1.103515625, 0.92499999999999993, 0.63632812499999991, 0.19999999999999996]\n", + "by central difference ( h = 0.25 ) = -0.934375 error in central difference method ( h = 0.25 ) = -2.39726027397 %\n", + "improved estimate = -0.9125\n" + ] + } + ], + "source": [ + "from numpy import arange\n", + "#f(x) = -0.1*x**4 - 0.15*x**3 - 0.5 * x**2 - 0.25 *x + 1.2\n", + "h = 0.5#\n", + "t = -0.9125#\n", + "x = arange(0,1.1,h)\n", + "print \"x with h = 0.5 is\",x\n", + "fx=[0]\n", + "for xx in x:\n", + " fx.append(-0.1*xx**4 - 0.15*xx**3 - 0.5 * xx**2 - 0.25 *xx + 1.2)\n", + "print \"f(x) with h = 0.5 is\",fx\n", + "cdm = (fx[(3)] - fx[(1)])/ 1#\n", + "ecdm = (t - cdm) * 100 / t#\n", + "print \"by central difference ( h = 0.5 ) \",cdm\n", + "print \"error in central difference method ( h = 0.5 ) = \",ecdm,\"%\"\n", + "h1 = 0.25#\n", + "x1 = arange(0,1.1,h1)\n", + "print \"x with h = 0.25 is\",x1\n", + "fx1=[0]\n", + "for xx in x1:\n", + " fx1.append(-0.1*xx**4 - 0.15*xx**3 - 0.5 * xx**2 - 0.25 *xx + 1.2)\n", + "print \"fx with h = 0.25 is\",fx1\n", + "cdm1 = (fx1[(4)] - fx1[(2)])/ (2*h1)\n", + "ecdm1 = (t - cdm1) * 100 / t#\n", + "print \"by central difference ( h = 0.25 ) = \",cdm1,\n", + "print \"error in central difference method ( h = 0.25 ) = \",ecdm1,\"%\"\n", + "D = 4 * cdm1 /3 - cdm / 3#\n", + "print \"improved estimate =\",D" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:23.3 Pg: 658" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(dT/dz) = -1.33333333333 C/cm\n", + "q(z = 0) = 70.56 W/m**2\n" + ] + } + ], + "source": [ + "#q(z = 0) = -k*p*C*(dT/dz)/(z = 0)\n", + "k = 3.5 * 10** - 7##m**2/s\n", + "p = 1800##kg/m**3\n", + "C = 840# #(J/(kg.C))\n", + "x = 0#\n", + "fx0 = 13.5#\n", + "fx1 = 12#\n", + "fx2 = 10#\n", + "x0 = 0#\n", + "x1 = 1.25#\n", + "x2 = 3.75#\n", + "dfx = fx0 *(2*x - x1 - x2)/((x0 - x1)*(x0 - x2)) + fx1 *(2*x - x0 - x2)/((x1 - x0)*(x1 - x2)) + fx2 *(2*x - x1 - x0)/((x2 - x1)*(x2 - x0))#\n", + "print \"(dT/dz) = \",dfx,\"C/cm\"\n", + "q = - k * p *C * dfx*100#\n", + "print \"q(z = 0) =\",q,\"W/m**2\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:23.4 Pg: 662" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Q= 1.64053333333333\n", + "intergral= -1.40920096\n", + "diff(x)= [ 0.12 0.1 0.1 0.04 0.04 0.04 0.1 0.1 0.06 0.1 ]\n", + "d= [ 9.247744 -0.04488 4.38152 8.287744 9.527424 9.674624\n", + " 6.64312 -3.25368 -13.648816 -21.31 ]\n" + ] + } + ], + "source": [ + "from sympy.mpmath import quad\n", + "from numpy import trapz,diff\n", + "def f(x):\n", + " y=0.2+25*x-200*x**2+675*x**3-900*x**4+400*x**5\n", + " return y\n", + "a=0#\n", + "b=0.8#\n", + "Q=quad(f,[0,0.8])\n", + "print \"Q=\",Q\n", + "x=[0, 0.12 ,0.22 ,0.32 ,0.36 ,0.4 ,0.44 ,0.54 ,0.64, 0.7 ,0.8]\n", + "y=[]\n", + "for xx in x:\n", + " y.append(f(xx))\n", + "integral=trapz(x,y)\n", + "print \"intergral=\",integral\n", + "print \"diff(x)=\",diff(x)\n", + "d=diff(y)/diff(x)#\n", + "print \"d=\",d" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:23.5 Pg: 664" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Computed= 1.64053333333333\n", + "Error estimate= 2.03185997099678e-5\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from sympy.mpmath import quad\n", + "def f(x):\n", + " y=0.2+25*x-200*x**2+675*x**3-900*x**4+400*x**5\n", + " return y\n", + "a=0#\n", + "b=0.8#\n", + "Qt=1.640533#\n", + "Q=quad(f,[0,0.8])\n", + "print \"Computed=\",Q\n", + "Er=abs(Q-Qt)*100/Qt\n", + "print \"Error estimate=\",Er" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter25.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter25.ipynb new file mode 100644 index 00000000..e4e7a3f4 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter25.ipynb @@ -0,0 +1,178 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter-25 : Runge-Kutta Methods" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:25.1 Pg: 708" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x = [ 0. 0.5 1. 1.5 2. 2.5 3. 3.5 4. ]\n", + "\n", + "true values of y = [1.0, 3.21875, 3.0, 2.21875, 2.0, 2.71875, 4.0, 4.71875, 3.0]\n", + "\n", + "y by euler method = [1.0, 5.25, 5.875, 5.125, 4.5, 4.75, 5.875, 7.125, 7.0]\n", + "\n", + "error = [0.0, -63.106796116504853, -95.833333333333329, -130.98591549295776, -125.0, -74.712643678160916, -46.875, -50.993377483443709, -133.33333333333334]\n" + ] + } + ], + "source": [ + "from numpy import arange\n", + "#dy/dx = -2*x**3 + 12*x**2 - 20*x + 8.5\n", + "#therefore, y = -0.5*x**4 + 4*x**3 - 10*x**2 + 8.5 + c\n", + "x1 = 0#\n", + "y1 = 1#\n", + "h = 0.5#\n", + "c =-(-0.5*x1**4 + 4*x1**3 - 10*x1**2 + 8.5*x1 - y1)#\n", + "x = arange(0,4.1,0.5)\n", + "print \"x = \",x\n", + "y=[]\n", + "for xx in x:\n", + " y.append(-0.5*xx**4 + 4*xx**3 - 10*xx**2 + 8.5*xx + c)\n", + "print \"\\ntrue values of y = \",y\n", + "fxy=[]\n", + "for xx in x:\n", + " fxy.append(-2*xx**3 + 12*xx**2 - 20*xx + 8.5)\n", + "y2=[y[0]]\n", + "e = [(y[0] - y2[0]) * 100 / y[0]]\n", + "for i in range(1,9):\n", + " y2.append(y2[(i-1)] + fxy[(i-1)]*h)\n", + " e.append((y[(i)] - y2[(i)])*100/y[(i)])\n", + "\n", + "print \"\\ny by euler method =\",y2\n", + "print \"\\nerror =\",e" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:25.2 Pg: 712" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total truncation error = -2.03125\n" + ] + } + ], + "source": [ + "#f(x,y) = dy/dx = -2*x**3 + 12*x**2 - 20*x + 8.5\n", + "#f'(x,y) = -6*x**2 + 24*x - 20\n", + "#f\"(x,y) = -12*x + 24\n", + "#f\"'(x,y) = -12\n", + "x = 0#\n", + "Et2 = (-6*x**2 + 24*x - 20) * 0.5**2 / 2\n", + "Et3 = (-12*x + 24) * (0.5)**3 / 6#\n", + "Et4 = (-12) *(0.5 ** 4) / 24#\n", + "Et = Et2 + Et3 + Et4#\n", + "print \"Total truncation error =\",Et" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:25.3 Pg: 713" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x = [ 0. 0.25 0.5 0.75 1. 1.25 1.5 1.75 2. 2.25 2.5 2.75\n", + " 3. 3.25 3.5 3.75 4. ]\n", + "\n", + "true values of y = [1.0, 2.560546875, 3.21875, 3.279296875, 3.0, 2.591796875, 2.21875, 1.998046875, 2.0, 2.248046875, 2.71875, 3.341796875, 4.0, 4.529296875, 4.71875, 4.310546875, 3.0]\n", + "\n", + "y by euler method = [1.0, 3.125, 4.1796875, 4.4921875, 4.34375, 3.96875, 3.5546875, 3.2421875, 3.125, 3.25, 3.6171875, 4.1796875, 4.84375, 5.46875, 5.8671875, 5.8046875, 5.0]\n", + "\n", + "error = [0.0, -22.04424103737605, -29.854368932038835, -36.986301369863014, -44.791666666666664, -53.127354935945739, -60.2112676056338, -62.267839687194524, -56.25, -44.569939183318851, -33.045977011494251, -25.073056691992985, -21.09375, -20.741699008193187, -24.337748344370862, -34.662437698232893, -66.666666666666671]\n" + ] + } + ], + "source": [ + "from numpy import arange\n", + "#dy/dx = -2*x**3 + 12*x**2 - 20*x + 8.5\n", + "#therefore, y = -0.5*x**4 + 4*x**3 - 10*x**2 + 8.5 + c\n", + "x1 = 0#\n", + "y1 = 1#\n", + "h = 0.25#\n", + "c =-(-0.5*x1**4 + 4*x1**3 - 10*x1**2 + 8.5*x1 - y1)#\n", + "xx = arange(0,4.1,h)\n", + "print \"x = \",xx\n", + "y=[]\n", + "for x in xx:\n", + " y.append(-0.5*x**4 + 4*x**3 - 10*x**2 + 8.5*x + c)\n", + "print \"\\ntrue values of y = \",y\n", + "fxy=[]\n", + "for x in xx:\n", + " fxy.append(-2*x**3 + 12*x**2 - 20*x + 8.5)\n", + "y2= [y[0]]\n", + "e = [(y[0] - y2[0]) * 100 / y[0]]\n", + "for i in range(1,17):\n", + " y2.append(y2[(i-1)] + fxy[(i-1)]*h)\n", + " e.append((y[(i)] - y2[(i)])*100/y[(i)])\n", + "\n", + "print \"\\ny by euler method =\",y2\n", + "print \"\\nerror =\",e" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter26.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter26.ipynb new file mode 100644 index 00000000..b52f1078 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter26.ipynb @@ -0,0 +1,401 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter-26 : Stiffness & Multi step Methods" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:26.1 Pg: 754" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "image/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wF/25XPJlwTpHSczGwY4Zd0cVmh4kRv\nasepg5qKjys+TnGeAtuZ7l5sF7ee1nWuu283s+OAJ8xsvbsvS6iman82zv1OdPe30zpOZnY+cCUw\nsauf7Yae1AUpHit3nw/MN7NJwP1m9ic9/LpVrwk4tfBWWsfpVuAGd3czM9p+N6T5by+qJujicUoz\nJN4CTmz3/ERCInbU5oRCm34VfDbput4CcPfthT/fNbOHCV3Dnv6gVlJTHJ+Nbb/u/nbhz8SPU2FS\n+E6g0d0/6MpnU6gr1WPVroZlZtYXOLbQLvWfqWJNZvZ5d38vxeP0VcK1XgCDgYvNrKWr308SNbn7\ngi4fp2pM7nRz8qUv8Dph8uUwOp8gHkfbJGOnn02prv7AwMLjAcBy4MIkamrXtpnPTlzHcqx6WFNq\nxwk4iTDpN66730/CdaV5rE6h7TT5s4HX0/6Z6qCm1P/tFdrfC1yW9nHqoKYuH6ce/wPo4Td7MbCh\n8I/jxsJr1wDXtGtzW+H9l4GzO/ps2nUBJxf+wl4CXqlmXZ3VBAwljFPuBj4AtgBHxXmsultTysfp\nLuA9YE1hW1ULP1NRdaV8rH5c+JprCP/THBP3sepuTWkep5K2n/5CTvM4RdXUneOki+lERCSSbl8q\nIiKRFBIiIhJJISEiIpEUEiIiEkkhISIikRQSIiISSSEh0k1m9jkz+0HadYjESSEh0n3HAH+TdhEi\ncVJIiHTfvwKnFG7eckvaxYjEQVdci3STmX0JeNTdz0y7FpG4qCch0n1JL2MvkjiFhIiIRFJIiHTf\nXmBg2kWIxEkhIdJN7v4esNzMfquJa+mtNHEtIiKR1JMQEZFICgkREYmkkBARkUgKCRERiaSQEBGR\nSAoJERGJpJAQEZFICgkREYn0P5bbRGIvXNRJAAAAAElFTkSuQmCC\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7fbf23882f10>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%matplotlib inline\n", + "from matplotlib.pyplot import plot,xlabel,ylabel,show,title,legend\n", + "from numpy import arange,exp\n", + "def f(t,y):\n", + " yp=-1000*y+3000-2000*exp(-t)\n", + " return yp\n", + "y0=0#\n", + "#explicit euler\n", + "h1=0.0005#\n", + "y1 =[y0]\n", + "count=1#\n", + "t=arange(0,0.0061,0.0001)\n", + "for i in arange(0,0.00591,0.0001):\n", + " y1.append(y1[(count-1)]+f(i,y1[(count-1)])*h1)\n", + " count=count+1#\n", + "\n", + "plot(t,y1)\n", + "h2=0.0015#\n", + "y2=[y0]#\n", + "count=1#\n", + "t=arange(0,0.0061,0.0001)\n", + "for i in arange(0,0.00591,0.0001):\n", + " y2.append(y2[(count-1)]+f(i,y2[(count-1)])*h2)\n", + " count=count+1#\n", + "\n", + "plot(t,y2)\n", + "title(\"y vs t\")\n", + "xlabel(\"t\")\n", + "ylabel(\"y\")\n", + "h=legend([\"h-0.0005\",\"h=0.0015\"])\n", + "show()\n", + "#implicit order\n", + "h3=0.05#\n", + "y3=[y0]#\n", + "count=1#\n", + "t=arange(0,0.401,0.01)\n", + "for j in arange(0,0.40,0.01):\n", + " y3.append((y3[(count-1)]+3000*h3-2000*h3*exp(-(j+0.01)))/(1+1000*h3))\n", + " count=count+1#\n", + "\n", + "plot(t,y3)\n", + "title(\"y vs t\")\n", + "xlabel(\"t\")\n", + "ylabel(\"y\")\n", + "show()\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:26.2 Pg: 758" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "f(x,y) = 4*exp(0.8*x) - 0.5*y\n", + "the first corrector yields y = 15.7669298488\n", + "error = -6.21810039929 %\n" + ] + } + ], + "source": [ + "from math import exp\n", + "print \"f(x,y) = 4*exp(0.8*x) - 0.5*y\"\n", + "#f'(x,y) = 4*exp(0.8*x) - 0.5*y\n", + "h = 1#\n", + "x=range(0,5)\n", + "y = [2]\n", + "x1 = -1#\n", + "y1 = -0.3929953#\n", + "y10 = y1 + (4*exp(0.8*x[0]) - 0.5*y[0])*2\n", + "y11 = y[0] + (4*exp(0.8*x[0]) - 0.5*y[0] + 4*exp(0.8*x[0]) - 0.5*y10)*h/2\n", + "y12 = y[0] + (3 + 4*exp(0.8*x[1]) - 0.5*y11)*h/2#\n", + "t = 6.360865#\n", + "y20 = y[0] + (4*exp(0.8*x[1]) - 0.5*t) *2\n", + "y21 = t + (4*exp(0.8*x[1]) - 0.5*t + 4*exp(0.8*x[2]) - 0.5*y20)*h/2\n", + "print \"the first corrector yields y = \",y21\n", + "t = 14.84392\n", + "e = (t - y21)*100/t#\n", + "print \"error = \",e,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:26.3 Pg: 762" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Ec (x = 1) = -0.150772\n", + "true error (x = 1) = -0.166234\n", + "Ec (x = 2) = -0.371756\n", + "true error (x = 2) = -0.45832\n" + ] + } + ], + "source": [ + "x1 = 1#\n", + "x2 = 2#\n", + "y1 = 6.194631#\n", + "y2 = 14.84392#\n", + "y10 = 5.607005#\n", + "y11 = 6.360865#\n", + "y20 = 13.44346#\n", + "y21 = 15.30224#\n", + "Ec1 = -(y11 - y10)/5#\n", + "print \"Ec (x = 1) = \",Ec1\n", + "e1 = y1 - y11#\n", + "print \"true error (x = 1) = \",e1\n", + "Ec2 = -(y21 - y20)/5#\n", + "print \"Ec (x = 2) = \",Ec2\n", + "e2 = y2 - y21#\n", + "print \"true error (x = 2) = \",e2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:26.4 Pg: 763" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ym = 6.210093\n", + "error = -0.249603245133 %\n", + "y20 = 13.5942344279\n", + "error = 8.41883796235 %\n", + "y20 = 14.1973224279\n", + "error = 4.35597586123 %\n", + "y2 = 14.8882708856\n", + "error = -0.2987814916 %\n" + ] + } + ], + "source": [ + "x0 = 0#\n", + "x1 = 1#\n", + "x2 = 2#\n", + "y1 = 6.194631#\n", + "y2 = 14.84392#\n", + "y10 = 5.607005#\n", + "y11 = 6.360865#\n", + "y1m = y11 - (y11 - y10)/5#\n", + "e = (y1 - y1m)*100/y1#\n", + "print \"ym =\",y1m\n", + "print \"error = \",e,\"%\"\n", + "y20 =2+(4*exp(0.8*x1) - 0.5*y1m)*2#\n", + "e2 = (y2 - y20)*100/y2#\n", + "print \"y20 = \",y20\n", + "print \"error = \",e2,\"%\"\n", + "y2o = y20 + 4* (y11 - y10)/5#\n", + "e2 = (y2 - y2o)*100/y2#\n", + "print \"y20 = \",y2o\n", + "print \"error = \",e2,\"%\"\n", + "y21 = 15.21178#\n", + "y23 = y21 - (y21 - y20)/5#\n", + "print \"y2 = \",y23\n", + "e3 = (y2 - y23)*100/y2#\n", + "print \"error = \",e3,\"%\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:26.5 Pg: 773" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "f(x,y) = 4*exp(0.8*x) - 0.5*y\n", + "x = [ 1. 2. 3. 4.]\n", + "y0 = [2, 6.0227228499844756, 20.083112587836688, 41.872835141608761]\n", + "corrected y1 = [6.9056637734795867, 19.136474376155903, 38.385462010990274, 82.755745651588995]\n" + ] + } + ], + "source": [ + "from numpy import arange,exp\n", + "print \"f(x,y) = 4*exp(0.8*x) - 0.5*y\"\n", + "#f'(x,y) = 4*exp(0.8*x) - 0.5*y\n", + "h = 1#\n", + "x = arange(-3,4.1,h)\n", + "y=[-4.547302,-2.306160,-0.3929953,2,2]\n", + "y1=[0,0,0,0]\n", + "for i in range(3,7):\n", + " y.append(y[(i-3)] + 4*h*(2*(4*exp(0.8*x[(i)]) - 0.5*y[(i)]) - 4*exp(0.8*x[(i-1)]) + 0.5*y[(i-1)] + 2*(4*exp(0.8*x[(i-2)]) - 0.5*y[(i-2)]))/3)\n", + " y1.append(y[(i-1)] + h*(4*exp(0.8*x[(i-1)]) - 0.5*y[(i-1)] +4 * (4*exp(0.8*x[(i)]) - 0.5*y[(i)]) + 4*exp(0.8*x[(i+1)]) - 0.5*y[(i+1)])/3)\n", + "\n", + "print \"x = \",x[4:8]\n", + "print \"y0 = \",y[4:8]\n", + "print \"corrected y1 = \",y1[4:8]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:26.6 Pg: 774" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "f(x,y) = 4*exp(0.8*x) - 0.5*y\n", + "x = [ 1. 2. 3. 4.]\n", + "y0 = [2, 6.0075392692969114, 6.2532143855636217, 14.488238413222703]\n", + "y1 = [6.0075392692969114, 6.2532143855636217, 14.488238413222703, 16.39224775082873]\n" + ] + } + ], + "source": [ + "print \"f(x,y) = 4*exp(0.8*x) - 0.5*y\"\n", + "#f'(x,y) = 4*exp(0.8*x) - 0.5*y\n", + "h = 1#\n", + "x = arange(-3,4.1,h)\n", + "y = [-4.547302,-2.306160,-0.3929953,2]\n", + "m= [0,0,0,0,y[3]]\n", + "for i in range(3,7):\n", + " y.append(y[(i)] + h *(55* (4*exp(0.8*x[(i)]) - 0.5*y[(i)]) / 24 - 59 * (4*exp(0.8*x[(i-1)]) - 0.5*y[(i-1)]) / 24 + 37*(4*exp(0.8*x[(i-2)]) - 0.5*y[(i-2)])/24 - 9*(4*exp(0.8*x[(i-3)]) - 0.5*y[(i-3)])/24))\n", + " m.append(y[(i+1)])\n", + " y.append(y[(i)] + h*(9*(4*exp(0.8*x[(i+1)]) - 0.5*y[(i+1)])/24 +19*(4*exp(0.8*x[(i)]) - 0.5*y[(i)])/24 - 5*(4*exp(0.8*x[(i-1)]) - 0.5*y[(i-1)])/24 + (4*exp(0.8*x[(i-2)]) - 0.5*y[(i-2)])/24))\n", + "\n", + "print \"x = \",x[4:8]\n", + "print \"y0 = \",m[4:8]\n", + "print \"y1 = \",y[4:8]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:26.7 Pg: 775" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "x = [ 0. 0.5 1. 1.5 2. 2.5 3. 3.5 4. 4.5 5. 5.5 6. 6.5 7.\n", + " 7.5 8. 8.5 9. 9.5]\n", + "\n", + "y0(milnes method) = [1, 0.62312747952608971, 0.60341314566242521, 0.35581682815742122, 0.3173461560388694, -0.073744603832379019, 0.05769466447055438, 0.097016353530268939, 0.21274204327392865, -0.36734037063735558, 0.09724068674400127, 0.43888095058828192, 0.3040024218422181, -0.1934006684100632, -0.1160863384290636, 0.32478026608871907, -0.052055689173705413, -0.36964931180484378, 0.00024232753216428538, 0.55995471612928904]\n", + "\n", + "corrected y1(milnes method) = [1, 0.62312747952608971, 0.60341314566242521, 0.35581682815742122, 0.3173461560388694, -0.073744603832379019, 0.05769466447055438, 0.097016353530268939, 0.21274204327392865, -0.36734037063735558, 0.09724068674400127, 0.43888095058828192, 0.3040024218422181, -0.1934006684100632, -0.1160863384290636, 0.32478026608871907, -0.052055689173705413, -0.36964931180484378, 0.00024232753216428538, 0.55995471612928904]\n", + "\n", + "y0(fourth order adams method) = [1, 0.27152768648678072, 0.65650943823969443, -0.097035945241965349, 0.90661897200241937, -0.41645854530303128, -0.006339328628468005, 0.0808211944939453, -0.031548281043396395, -0.01627399436000334, 0.0039276970657568626, -0.002208005756050492, -0.0027943948998587478, -0.00042783320198906672, -0.00032845203812321728, -0.00042142028381515442, -0.00017932875240256902, -8.560953717861569e-05, -7.1995388648036731e-05, -4.2020211202092437e-05]\n", + "\n", + "y1(fourth order adams method) = [1, 0.56419948638876194, 0.68342664355034821, -0.010131383289966767, -0.11667598191807985, -0.0076991693311919962, -0.015405634984349756, -0.02283279228603189, -0.0093238635936440419, -0.0046392587796136846, -0.0040348813308916029, -0.0023127486894963844, -0.0011969855369064737, -0.00079981133060367615, -0.00049813831748820084, -0.00028031874518611127, -0.00017096177282523818, -0.00010605960387014003, -6.2547086111287706e-05, -3.7396246727791117e-05]\n" + ] + } + ], + "source": [ + "from numpy import arange,exp\n", + "#dy/dx = -y\n", + "#y = exp(-x)\n", + "h = 0.5#\n", + "x = arange(-1.5,10.1,h)\n", + "y=[exp(-x[0]),exp(-x[1]),exp(-x[2]),1]\n", + "m=[0,0,0,y[3]]\n", + "for i in range(3,23):\n", + " y.append(y[(i-3)] + 4*h*(2*(-y[(i)]) + y[(i-1)] + 2*(-y[(i-2)]))/3)\n", + " m.append(y[(i+1)])\n", + " y.append(y[(i-1)] + h*(-y[(i-1)] +4 * (-y[(i)]) + (-y[(i+1)]))/3)\n", + "\n", + "print \"\\nx = \",x[3:23]\n", + "print \"\\ny0(milnes method) = \",m[3:23]\n", + "print \"\\ncorrected y1(milnes method) = \",y[3:23]\n", + "for i in range(3,23):\n", + " y[(i+1)] = y[(i)] + h *(55* (-y[(i)]) / 24 - 59 * (-y[(i-1)]) / 24 + 37*(-y[(i-2)])/24 - 9*(-y[(i-3)])/24)#\n", + " m[(i+1)] = y[(i+1)]\n", + " y[(i+1)] = y[(i)] + h*(9*(-y[(i+1)])/24 +19*(-y[(i)])/24 - 5*(-y[(i-1)])/24 + (-y[(i-2)])/24)#\n", + "\n", + "print \"\\ny0(fourth order adams method) = \",m[3:23]\n", + "print \"\\ny1(fourth order adams method) = \",y[3:23]" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter3.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter3.ipynb new file mode 100644 index 00000000..b0cdc8c4 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter3.ipynb @@ -0,0 +1,382 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# CHAPTER 3 : Approximations and Round off Errors" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex : 3.1 Pg : 56" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a. The true error is\n", + "for the bridge : 1 cm\n", + "for the rivet : 1 cm\n", + "b. The percent relative error is\n", + "for the bridge : 0.01 cm\n", + "for the rivet : 10.0 cm\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "lbm=9999# #cm, measured length of bridge\n", + "lrm=9##cm, measured length of rivet\n", + "lbt=10000##cm, true length of bridge\n", + "lrt=10##cm,true length of rivet\n", + "#calculating true error below#\n", + "Etb=lbt-lbm##cm, true error in bridge\n", + "Etr=lrt-lrm##cm, true error in rivet\n", + "#calculating percent relative error below\n", + "etb=Etb*100/lbt##percent relative error for bridge\n", + "etr=Etb*100/lrt##percent relative error for rivet\n", + "print \"a. The true error is\"\n", + "print \"for the bridge : \",Etb,\"cm\"\n", + "print \"for the rivet : \",Etr,\"cm\"\n", + "print \"b. The percent relative error is\"\n", + "print \"for the bridge : \",etb,\"cm\"\n", + "print \"for the rivet : \",etr,\"cm\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex 3.2 : Pg : 58" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Terms\t\t\tResult\t\t\t\tet(%)\t\t\t\tea(%)\n", + "----------------------------------------------------------------------------------------------------\n", + "1 \t\t\t1.00000 \t\t\t39.3469240702 \t\t\t100\n", + "----------------------------------------------------------------------------------------------------\n", + "2 \t\t\t2.00000 \t\t\t-21.3061518595 \t\t\t50.0\n", + "----------------------------------------------------------------------------------------------------\n", + "3 \t\t\t2.50000 \t\t\t-51.6326898244 \t\t\t20.0\n", + "----------------------------------------------------------------------------------------------------\n", + "4 \t\t\t2.62500 \t\t\t-59.2143243156 \t\t\t4.7619047619\n", + "----------------------------------------------------------------------------------------------------\n", + "5 \t\t\t2.64583 \t\t\t-60.4779300642 \t\t\t0.787401574803\n", + "----------------------------------------------------------------------------------------------------\n", + "6 \t\t\t2.64844 \t\t\t-60.6358807827 \t\t\t0.0983284169125\n", + "----------------------------------------------------------------------------------------------------\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "from math import factorial\n", + "n=3##number of significant figures\n", + "es=0.5*(10**(2-n))##percent, specified error criterion\n", + "x=0.5#\n", + "f=[]\n", + "f.append(1)##first estimate f=e**x = 1\n", + "ft=1.648721##true value of e**0.5=f\n", + "et=[]\n", + "et.append((ft-f[0])*100/ft)\n", + "ea=[]\n", + "ea.append(100)\n", + "i=1\n", + "while ea[i-1]>=es:\n", + " f.append(f[(i-1)]+(x**(i-1))/(factorial(i-1)))\n", + " et.append((ft-f[(i)])*100/ft)\n", + " ea.append((f[(i)]-f[(i-1)])*100/f[(i)])\n", + " i=i+1#\n", + "\n", + "print \"Terms\\t\\t\\tResult\\t\\t\\t\\tet(%)\\t\\t\\t\\tea(%)\"\n", + "print '-'*100\n", + "for j in range(0,i-1):\n", + " print j+1,'\\t\\t\\t%0.5f'%f[j],'\\t\\t\\t',et[j],'\\t\\t\\t',ea[j]\n", + " print '-'*100" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex 3.3 Pg: 60" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Thus a 16-bit computer word can store decimal integers ranging from -32767 to 32767\n" + ] + } + ], + "source": [ + "n=16##no of bits\n", + "num=0#\n", + "for i in range(0,(n-1)):\n", + " num=num+(1*(2**i))#\n", + "\n", + "print \"Thus a 16-bit computer word can store decimal integers ranging from\",(-1*num),\"to\",num" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex 3.4: Pg :63" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The smallest possible positive number for this system is : 0.0625\n" + ] + } + ], + "source": [ + "n=7##no. of bits\n", + "#the maximum value of exponents is given by\n", + "max=1*(2**1)+1*(2**0)#\n", + "#mantissa is found by\n", + "mantissa=1*(2**-1)+0*(2**-3)+0*(2**-3)#\n", + "num=mantissa*(2**(max*-1))##smallest possible positive number for this system\n", + "print \"The smallest possible positive number for this system is : \",num" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex 3.5: Pg :65" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "value of epsilon= 0.25\n" + ] + } + ], + "source": [ + "b=2##base\n", + "t=3##number of mantissa bits\n", + "E=2**(1-t)##epsilon\n", + "print \"value of epsilon=\",E" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex 3.6: Pg :68" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Input a number: 15\n", + "The number summed up 100,000 times is= 1500000\n" + ] + } + ], + "source": [ + "num=input(\"Input a number: \")\n", + "Sum=0#\n", + "for i in range(0,100000):\n", + " Sum=Sum+num#\n", + "\n", + "print \"The number summed up 100,000 times is=\",Sum" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex 3.7: Pg :71" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of the quadratic equation (x**2)+(3000.001*x)+3=0 are = -0.000999999999976 & -3000.0\n" + ] + } + ], + "source": [ + "a=1#\n", + "b=3000.001#\n", + "c=3#\n", + "#the roots of the quadratic equation x**2+3000.001*x+3=0 are found as\n", + "D=(b**2)-4*a*c#\n", + "x1=(-b+(D**0.5))/(2*a)#\n", + "x2=(-b-(D**0.5))/(2*a)#\n", + "print \"The roots of the quadratic equation (x**2)+(3000.001*x)+3=0 are = \",x1,'&',x2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex 3.8: Pg :73" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Input value of x:1.25\n", + "sum: 1 term: 1 i: 0\n", + "-------------------------------------\n", + "sum: 2.25 term: 1.25 i: 1\n", + "-------------------------------------\n", + "sum: 3.03125 term: 0.78125 i: 2\n", + "-------------------------------------\n", + "sum: 3.35677083333 term: 0.325520833333 i: 3\n", + "-------------------------------------\n", + "sum: 3.45849609375 term: 0.101725260417 i: 4\n", + "-------------------------------------\n", + "sum: 3.48392740885 term: 0.0254313151042 i: 5\n", + "-------------------------------------\n", + "sum: 3.4892255995 term: 0.0052981906467 i: 6\n", + "-------------------------------------\n", + "sum: 3.49017170497 term: 0.000946105472625 i: 7\n", + "-------------------------------------\n", + "sum: 3.49031953395 term: 0.000147828980098 i: 8\n", + "-------------------------------------\n", + "sum: 3.49034006576 term: 2.05318027913e-05 i: 9\n", + "-------------------------------------\n", + "sum: 3.49034263223 term: 2.56647534892e-06 i: 10\n", + "-------------------------------------\n", + "sum: 3.49034292388 term: 2.91644926013e-07 i: 11\n", + "-------------------------------------\n", + "sum: 3.49034295426 term: 3.03796797931e-08 i: 12\n", + "-------------------------------------\n", + "sum: 3.49034295718 term: 2.92112305703e-09 i: 13\n", + "-------------------------------------\n", + "sum: 3.49034295744 term: 2.60814558663e-10 i: 14\n", + "-------------------------------------\n", + "sum: 3.49034295746 term: 2.17345465553e-11 i: 15\n", + "-------------------------------------\n", + "sum: 3.49034295746 term: 1.69801144963e-12 i: 16\n", + "-------------------------------------\n", + "sum: 3.49034295746 term: 1.24853783061e-13 i: 17\n", + "-------------------------------------\n", + "sum: 3.49034295746 term: 8.67040160146e-15 i: 18\n", + "-------------------------------------\n", + "sum: 3.49034295746 term: 5.7042115799e-16 i: 19\n", + "-------------------------------------\n", + "Exact Value: 3.49034295746\n" + ] + } + ], + "source": [ + "from math import exp\n", + "def f(x):\n", + " y=exp(x)\n", + " return y\n", + "Sum=1#\n", + "test=0#\n", + "i=0#\n", + "term=1#\n", + "x=input(\"Input value of x:\")\n", + "while Sum!=test:\n", + " print \"sum:\",Sum,\"term:\",term,\"i:\",i\n", + " print \"-------------------------------------\"\n", + " i=i+1#\n", + " term=term*x/i#\n", + " test=Sum#\n", + " Sum=Sum+term#\n", + "\n", + "print \"Exact Value:\",f(x)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter4.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter4.ipynb new file mode 100644 index 00000000..ac35f0f7 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter4.ipynb @@ -0,0 +1,513 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 4 : Truncation Errors and the Taylor Series" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example: 4.1 Page No:79" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of f at x=0 : 1.2\n", + "The value of f at x=1 due to zero order approximation : 1.2\n", + "Truncation error : -1.0\n", + "----------------------------------------------\n", + "The value of first derivative of f at x=0 : -0.4\n", + "The value of f at x=1 due to first order approximation : 0.8\n", + "Truncation error : -0.6\n", + "----------------------------------------------\n", + "The value of second derivative of f at x=0 : -1.8\n", + "The value of f at x=1 due to second order approximation : -0.1\n", + "Truncation error : 0.3\n", + "----------------------------------------------\n", + "The value of third derivative of f at x=0 : -0.9\n", + "The value of f at x=1 due to third order approximation : -0.25\n", + "Truncation error : 0.45\n", + "----------------------------------------------\n", + "The value of fourth derivative of f at x=0 : -2.4\n", + "The value of f at x=1 due to fourth order approximation : -0.35\n", + "Truncation error : 0.55\n", + "----------------------------------------------\n" + ] + } + ], + "source": [ + "from math import factorial\n", + "from scipy.misc import derivative\n", + "def f(x):\n", + " y=-0.1*x**4-0.15*x**3-0.5*x**2-0.25*x+1.2#\n", + " return y\n", + "xi=0#\n", + "xf=1#\n", + "h=xf-xi#\n", + "fi=f(xi)##function value at xi\n", + "ffa=f(xf)##actual function value at xf\n", + "\n", + "#for n=0, i.e, zero order approximation\n", + "ff=fi#\n", + "Et_1=ffa-ff##truncation error at x=1\n", + "print \"The value of f at x=0 :\",fi\n", + "print \"The value of f at x=1 due to zero order approximation :\",ff\n", + "print \"Truncation error :\",Et_1\n", + "print \"----------------------------------------------\"\n", + "\n", + "#for n=1, i.e, first order approximation\n", + "def f1(x):\n", + " y=derivative(f,x)\n", + " return y\n", + "f1i=f1(xi)##value of first derivative of function at xi\n", + "f1f=fi+f1i*h##value of first derivative of function at xf\n", + "Et_2=ffa-f1f##truncation error at x=1\n", + "print \"The value of first derivative of f at x=0 :\",f1i\n", + "print \"The value of f at x=1 due to first order approximation :\",f1f\n", + "print \"Truncation error :\",Et_2\n", + "print \"----------------------------------------------\"\n", + "\n", + "\n", + "#for n=2, i.e, second order approximation\n", + "def f2(x):\n", + " y=derivative(f1,x)\n", + " return y\n", + "f2i=f2(xi)##value of second derivative of function at xi\n", + "f2f=f1f+f2i*(h**2)/factorial(2)##value of second derivative of function at xf\n", + "Et_3=ffa-f2f##truncation error at x=1\n", + "print \"The value of second derivative of f at x=0 :\",f2i\n", + "print \"The value of f at x=1 due to second order approximation :\",f2f\n", + "print \"Truncation error :\",Et_3\n", + "print \"----------------------------------------------\"\n", + "\n", + "#for n=3, i.e, third order approximation\n", + "def f3(x):\n", + " y=derivative(f2,x)\n", + " return y\n", + "f3i=f3(xi)##value of third derivative of function at xi\n", + "f3f=f2f+f3i*(h**3)/factorial(3)##value of third derivative of function at xf\n", + "Et_4=ffa-f3f##truncation error at x=1\n", + "print \"The value of third derivative of f at x=0 :\",f3i\n", + "print \"The value of f at x=1 due to third order approximation :\",f3f\n", + "print \"Truncation error :\", Et_4\n", + "print \"----------------------------------------------\"\n", + "\n", + "#for n=4, i.e, fourth order approximation\n", + "def f4(x):\n", + " y=derivative(f3,x)\n", + " return y\n", + "f4i=f4(xi)##value of fourth derivative of function at xi\n", + "f4f=f3f+f4i*(h**4)/factorial(4)##value of fourth derivative of function at xf\n", + "Et_5=ffa-f4f##truncation error at x=1\n", + "print \"The value of fourth derivative of f at x=0 :\",f4i\n", + "print \"The value of f at x=1 due to fourth order approximation :\",f4f\n", + "print \"Truncation error :\",Et_5\n", + "print \"----------------------------------------------\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.2: Page No:82" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of f at x=1 due to zero order approximation : 0.707106781187\n", + "% relative error : -41.4213562373\n", + "----------------------------------------------\n", + "The value of f at x=1 due to first order approximation : 0.551333569463\n", + "% relative error : -10.2667138927\n", + "----------------------------------------------\n", + "The value of f at x=1 due to second order approximation : 0.534175415889\n", + "% relative error : -6.83508317772\n", + "----------------------------------------------\n", + "The value of f at x=1 due to third order approximation : 0.535435376789\n", + "% relative error : -7.08707535775\n", + "----------------------------------------------\n", + "The value of f at x=1 due to fourth order approximation : 0.535504768061\n", + "% relative error : -7.10095361216\n", + "----------------------------------------------\n", + "The value of f at x=1 due to fifth order approximation : 0.535501917392\n", + "% relative error : -7.10038347839\n", + "----------------------------------------------\n", + "The value of f at x=1 due to sixth order approximation : 0.535501819651\n", + "% relative error : -7.10036393016\n", + "----------------------------------------------\n" + ] + } + ], + "source": [ + "from math import pi,cos,factorial\n", + "from scipy.misc import derivative\n", + "def f(x):\n", + " y=cos(x)\n", + " return y\n", + "xi=pi/4#\n", + "xf=pi/3#\n", + "h=xf-xi#\n", + "fi=f(xi)##function value at xi\n", + "ffa=f(xf)##actual function value at xf\n", + "\n", + "#for n=0, i.e, zero order approximation\n", + "ff=fi#\n", + "et1=(ffa-ff)*100/ffa##percent relative error at x=1\n", + "print \"The value of f at x=1 due to zero order approximation :\",ff\n", + "print \"% relative error :\",et1\n", + "print \"----------------------------------------------\"\n", + "\n", + "#for n=1, i.e, first order approximation\n", + "def f1(x):\n", + " y=derivative(f,x)\n", + " return y\n", + "f1i=f1(xi)##value of first derivative of function at xi\n", + "f1f=fi+f1i*h##value of first derivative of function at xf\n", + "et2=(ffa-f1f)*100/ffa##% relative error at x=1\n", + "print \"The value of f at x=1 due to first order approximation :\",f1f\n", + "print \"% relative error :\",et2\n", + "print \"----------------------------------------------\"\n", + "\n", + "\n", + "#for n=2, i.e, second order approximation\n", + "def f2(x):\n", + " y=derivative(f1,x)\n", + " return y\n", + "f2i=f2(xi)##value of second derivative of function at xi\n", + "f2f=f1f+f2i*(h**2)/factorial(2)##value of second derivative of function at xf\n", + "et3=(ffa-f2f)*100/ffa##% relative error at x=1\n", + "print \"The value of f at x=1 due to second order approximation :\",f2f\n", + "print \"% relative error :\",et3\n", + "print \"----------------------------------------------\"\n", + "\n", + "\n", + "#for n=3, i.e, third order approximation\n", + "def f3(x):\n", + " y=derivative(f2,x)\n", + " return y\n", + "f3i=f3(xi)##value of third derivative of function at xi\n", + "f3f=f2f+f3i*(h**3)/factorial(3)##value of third derivative of function at xf\n", + "et4=(ffa-f3f)*100/ffa##% relative error at x=1\n", + "print \"The value of f at x=1 due to third order approximation :\",f3f\n", + "print \"% relative error :\",et4\n", + "print \"----------------------------------------------\"\n", + "\n", + "\n", + "#for n=4, i.e, fourth order approximation\n", + "def f4(x):\n", + " y=derivative(f3,x)\n", + " return y\n", + "f4i=f4(xi)##value of fourth derivative of function at xi\n", + "f4f=f3f+f4i*(h**4)/factorial(4)##value of fourth derivative of function at xf\n", + "et5=(ffa-f4f)*100/ffa##% relative error at x=1\n", + "print \"The value of f at x=1 due to fourth order approximation :\",f4f\n", + "print \"% relative error :\",et5\n", + "print \"----------------------------------------------\"\n", + "\n", + "\n", + "#for n=5, i.e, fifth order approximation\n", + "f5i=(f4(1.1*xi)-f4(0.9*xi))/(2*0.1)##value of fifth derivative of function at xi (central difference method)\n", + "f5f=f4f+f5i*(h**5)/factorial(5)##value of fifth derivative of function at xf\n", + "et6=(ffa-f5f)*100/ffa##% relative error at x=1\n", + "print \"The value of f at x=1 due to fifth order approximation :\",f5f\n", + "print \"% relative error :\",et6\n", + "print \"----------------------------------------------\"\n", + "\n", + "\n", + "#for n=6, i.e, sixth order approximation\n", + "def f6(x):\n", + " y=derivative(f5,x)\n", + " return y\n", + "f6i=(f4(1.1*xi)-2*f4(xi)+f4(0.9*xi))/(0.1**2)##value of sixth derivative of function at xi (central difference method)\n", + "f6f=f5f+f6i*(h**6)/factorial(6)##value of sixth derivative of function at xf\n", + "et6=(ffa-f6f)*100/ffa##% relative error at x=1\n", + "print \"The value of f at x=1 due to sixth order approximation :\",f6f\n", + "print \"% relative error :\", et6\n", + "print \"----------------------------------------------\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.3 : Page No:85" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Input value of m:4\n", + "Input value of h:5\n", + "\n", + "Remainder: 21 \n", + "The value by first order approximation: 1275\n", + "True Value at x2: 1296\n" + ] + } + ], + "source": [ + "from math import pi,cos,factorial\n", + "m=input(\"Input value of m:\")\n", + "h=input(\"Input value of h:\")\n", + "def f(x):\n", + " y=x**m\n", + " return y\n", + "x1=1#\n", + "x2=x1+h#\n", + "fx1=f(x1)#\n", + "fx2=fx1+m*(fx1**(m-1))*h#\n", + "if m==1:\n", + " R=0#\n", + "elif m==2 :\n", + " R=2*(h**2)/factorial(2)#\n", + " \n", + "elif m==3:\n", + " R=(6*(x1)*(h**2)/factorial(2))+(6*(h**3)/factorial(3))#\n", + " \n", + "elif m==4:\n", + " R=(12*(x1**2)*(h**2)/factorial(2))+(24*(x1)*(h**3)/factorial(3))+(24*(h**4)/factorial(4))\n", + " \n", + "print \"\\nRemainder:\",fx2,\"\\nThe value by first order approximation:\",R\n", + "print \"True Value at x2:\",f(x2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.4: Page No:92" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Input h:1.232323\n", + "For h= 1.232323\n", + "and percent error= -2.70944264922 Derivative at x by forward difference method= 114.60931875\n", + "and percent error= -0.178591334206 Derivative at x by backward difference method= 85.854151746\n", + "and percent error= -1.44401699172 Derivative at x by central difference method= 14.3775835022\n" + ] + } + ], + "source": [ + "from scipy.misc import derivative\n", + "def f(x):\n", + " y=-0.1*(x**4)-0.15*(x**3)-0.5*(x**2)-0.25*(x)+1.2\n", + " return y\n", + "x=0.5#\n", + "h=input(\"Input h:\")\n", + "x1=x-h#\n", + "x2=x+h#\n", + "#forward difference method\n", + "fdx1=(f(x2)-f(x))/h##derivative at x\n", + "et1=abs((fdx1-derivative(f,x))/derivative(f,x))*100#\n", + "#backward difference method\n", + "fdx2=(f(x)-f(x1))/h##derivative at x\n", + "et2=abs((fdx2-derivative(f,x))/derivative(f,x))*100#\n", + "#central difference method\n", + "fdx3=(f(x2)-f(x1))/(2*h)##derivative at x\n", + "et3=abs((fdx3-derivative(f,x))/derivative(f,x))*100#\n", + "print \"For h=\",h\n", + "print \"and percent error=\",fdx1,\"Derivative at x by forward difference method=\",et1\n", + "print \"and percent error=\",fdx2,\"Derivative at x by backward difference method=\",et2\n", + "print \"and percent error=\",fdx3,\"Derivative at x by central difference method=\",et3" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.5: Page No: 95" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "true value is between : 15.4275 and 15.8225\n" + ] + } + ], + "source": [ + "from scipy.misc import derivative\n", + "def f(x):\n", + " y=x**3\n", + " return y\n", + "x=2.5#\n", + "delta=0.01#\n", + "deltafx=abs(derivative(f,x))*delta#\n", + "fx=f(x)#\n", + "print \"true value is between : \",fx-deltafx,\"and\",fx+deltafx" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.6: Page No: 96" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of y is between: 0.528721343471 and 0.596278656529\n", + "ymin is calculated at lower extremes of F, L, E, I values as = 0.524066539965\n", + "ymax is calculated at higher extremes of F, L, E, I values as = 0.602846335915\n" + ] + } + ], + "source": [ + "def f(F,L,E,I):\n", + " y=(F*(L**4))/(8*E*I)\n", + " return y\n", + "Fbar=50##lb/ft\n", + "Lbar=30##ft\n", + "Ebar=1.5*(10**8)##lb/ft**2\n", + "Ibar=0.06##ft**4\n", + "deltaF=2##lb/ft\n", + "deltaL=0.1##ft\n", + "deltaE=0.01*(10**8)##lb/ft**2\n", + "deltaI=0.0006##ft**4\n", + "ybar=(Fbar*(Lbar**4))/(8*Ebar*Ibar)#\n", + "def f1(F):\n", + " y=(F*(Lbar**4))/(8*Ebar*Ibar)\n", + " return y\n", + "def f2(L):\n", + " y=(Fbar*(L**4))/(8*Ebar*Ibar)\n", + " return y\n", + "def f3(E):\n", + " y=(Fbar*(Lbar**4))/(8*E*Ibar)\n", + " return y\n", + "def f4(I):\n", + " y=(Fbar*(Lbar**4))/(8*Ebar*I)\n", + " return y\n", + "\n", + "deltay=abs(derivative(f1,Fbar))*deltaF+abs(derivative(f2,Lbar))*deltaL+abs(derivative(f3,Ebar))*deltaE+abs(derivative(f4,Ibar))*deltaI#\n", + "\n", + "print \"The value of y is between:\",ybar-deltay,\"and\",ybar+deltay\n", + "ymin=((Fbar-deltaF)*((Lbar-deltaL)**4))/(8*(Ebar+deltaE)*(Ibar+deltaI))#\n", + "ymax=((Fbar+deltaF)*((Lbar+deltaL)**4))/(8*(Ebar-deltaE)*(Ibar-deltaI))#\n", + "print \"ymin is calculated at lower extremes of F, L, E, I values as =\",ymin\n", + "print \"ymax is calculated at higher extremes of F, L, E, I values as =\",ymax" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 4.7 : Page No:98" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The condition number of function for x = 0.18201112073 is : 1.72787595947\n", + "The condition number of function for x = 0.0160083243793 is : 1.58650429006\n" + ] + } + ], + "source": [ + "from math import pi,tan\n", + "from scipy.misc import derivative\n", + "def f(x):\n", + " y=tan(x)\n", + " return y\n", + "x1bar=(pi/2)+0.1*(pi/2)#\n", + "x2bar=(pi/2)+0.01*(pi/2)#\n", + "#computing condition number for x1bar\n", + "condnum1=x1bar*derivative(f,x1bar)/f(x1bar)#\n", + "print \"The condition number of function for x =\",condnum1,\"is :\",x1bar\n", + "if abs(condnum1)>1:\n", + " print \"Function is ill-conditioned for x =\",x1bar\n", + "\n", + "#computing condition number for x2bar\n", + "condnum2=x2bar*derivative(f,x2bar)/f(x2bar)#\n", + "print \"The condition number of function for x =\",condnum2,\"is :\",x2bar\n", + "if abs(condnum2)>1:\n", + " print \"Function is ill-conditioned for x =\",x2bar" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter5.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter5.ipynb new file mode 100644 index 00000000..2b0b77e2 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter5.ipynb @@ -0,0 +1,528 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 5 : Bracketing Methods" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.1: Pg:120" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "For various values of c and f(c) is found as:\n", + "[4, 34.114844174677984]\n", + "[8, 17.653427509399428]\n", + "[12, 6.066935998372109]\n", + "[16, -2.2687619693477643]\n", + "[20, -8.400628721768179]\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYkAAAEZCAYAAABiu9n+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XeY1OW5//H3TRdRqgrBAggqEQugRH7R7IgiWA5iQTQK\nRNQYjUajJ4qayBJzNGosaSfmKBrAysFYUBEQGNRfVCyAKKKgEkUDNrBF2RXu88czC8u6y+7Ozuwz\n5fO6rr0y7TtzQxg/+3Rzd0RERKrTJHYBIiKSuxQSIiJSI4WEiIjUSCEhIiI1UkiIiEiNFBIiIlIj\nhYQUJTPb08wWmdlnZnZe6rEhZvZAHa49z8x+m/0qReIzrZOQYmRmE4F17n5xpcdeAM519wW1XNsS\nWAH0c/cPs1upSFxqSUix2g1YWnHHzA4Etq8tIADcfT0wAxidvfJEcoNCQoqOmc0FEsCfUt1NvYAj\ngWSV1+1tZrPN7GMzW21ml1V6OgkcXcP7/8XMrq/y2ENmdmHq9qVmtir12cvMbFAN77ONmd1gZivN\nbJ2ZPWVmrdL8Y4ukRSEhRcfdBwFPAT919+3dfTnQB3i94jVmth3wBPAY0AXoCcyp9DbLgP1q+Ii7\ngZGV3qs9MBi418z2BH4KHODu2wNHACtreJ/fAX2BgUAH4BfAxvr8WUUaqlnsAkQiskq32wGfV7p/\nDPC+u9+Uul8GVO6K+hxoW8P7Pg24mR3i7k8BJwL/cPfVZtYGaAnsbWYfu/s71RZm1gQ4Hfieu/8r\n9fCz9fiziWSEWhJSzCrP2lgLbF/p/i7AW1u5djvg02rfNMwGuRc4JfXQD4G7Us+tAC4ESoE1ZnaP\nmXWp5m06Aa2AN2v9U4hkkUJCJHgZ2KPS/XeAHlt5fW9g0Vaevwc40cx2AwYA91c84e73uPshhMFz\nB66t5vqPgK8J3Vwi0SgkpJhV7m56DCipdP8RoIuZXWBmLc1sOzMbUOn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RJiwEFXqOz0RWOruN1d6qn7fI3fPyx+gBHg4dh1bqW8/4HlgMeE3obaxa6qhzksI\nAbaEMIjVPHZNqbruIYyTlAHvAqcDHYAnCF/AWUC7HKxzLLCcMGNoYernv3OkxvUVf5dVnn8L6JBD\nf5frK/1/3hyYkvr3+SKQyKE6K//bPIDQ378IeAbomwN1HkwYu11U6d/i0Pp+j7SYTkREapRX3U0i\nItK4FBIiIlIjhYSIiNRIISEiIjVSSIiISI0UEiIiUiOFhIiI1EghISIiNVJIiGSQmY1OHTa0KEf3\nFROpF624FskQM9ubsAXLQHf/xMzau3t15ziI5A21JEQyZxAw1cM5HSggpBAoJEQyx8ndcxlE0qKQ\nEMmcucAIM+sA4cD5yPWINJjGJEQyyMxGE86S2AC85O5jI5ck0iAKCRERqZG6m0REpEYKCRERqZFC\nQkREaqSQEBGRGikkRESkRgoJERGpkUJCRERqpJAQEZEa/R8PbymWhUneNgAAAABJRU5ErkJggg==\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7fa7dfe0c990>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from numpy import arange\n", + "from math import exp\n", + "%matplotlib inline\n", + "from matplotlib.pyplot import plot, title, xlabel, ylabel, show\n", + "m=68.1##kg\n", + "v=40##m/s\n", + "t=10##s\n", + "g=9.8##m/s**2\n", + "def f(c):\n", + " y=g*m*(1-exp(-c*t/m))/c - v#\n", + " return y\n", + "print \"For various values of c and f(c) is found as:\"\n", + "i=0#\n", + "Fc=[]\n", + "for c in arange(4,21,4):\n", + " i=i+1#\n", + " bracket=[c, f(c)]\n", + " print bracket\n", + " Fc.append(f(c))\n", + "\n", + "c=arange(4,21,4)\n", + "plot(c,Fc)\n", + "title('f(c) vs c')\n", + "xlabel('c')\n", + "ylabel('f(c) (m/s)')\n", + "show()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.2: Pg:123" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "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FsmmTVsu/5UipUUz1kXyxMz+AqwMrALMdPcrI0cSyTkVEZE8MbMVgVeBBcBOrv9sUoZ0OUskf9oQ\nVmddldAaESk7aomI5ImZPQbcR1jVdm13Py1yJJGcK+adDUVKlpkdDSx09yFmtgLwopml3L06cjSR\nnFJLREREsqY+ERERyZqKiIiIZE1FREREsqYiIiIiWVMRERGRrKmIiIhI1lREREQkayoiIiKStf8H\njXMbWAkg26AAAAAASUVORK5CYII=\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7f01da57e590>" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "0.55 \t0.60 \t0.65 \t0.70 \t0.75 \t0.80 \t0.85 \t0.90 \t0.95 \t" + ] + } + ], + "source": [ + "from numpy import arange\n", + "from math import sin,cos\n", + "%matplotlib inline\n", + "from matplotlib.pyplot import plot, title, xlabel, ylabel, show\n", + "\n", + "def f(x):\n", + " y=sin(10*x)+cos(3*x)#\n", + " return y\n", + "count=1#\n", + "func=[]\n", + "val=[]\n", + "for i in arange(0.55,1,0.05):\n", + " val.append(i)\n", + " func.append(f(i))\n", + " count=count+1#\n", + "\n", + "plot(val,func)\n", + "title(\"x vs f(x)\")\n", + "xlabel('x')\n", + "ylabel('f(x)')\n", + "show()\n", + "for v in val:\n", + " print '%0.2f'%v,'\\t'," + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.3: Pg:125" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "enter the tolerable true percent error=1.24\n" + ] + } + ], + "source": [ + "from math import exp\n", + "m=68.1##kg\n", + "v=40##m/s\n", + "t=10##s\n", + "g=9.8##m/s**2\n", + "def f(c):\n", + " y=g*m*(1-exp(-c*t/m))/c - v#\n", + " return y\n", + "x1=12#\n", + "x2=16#\n", + "xt=14.7802##true value\n", + "e=input(\"enter the tolerable true percent error=\")\n", + "xr=(x1+x2)/2#\n", + "etemp=abs(xr-xt)/xt*100##error\n", + "while etemp>e:\n", + " if f(x1)*f(xr)>0:\n", + " x1=xr#\n", + " xr=(x1+x2)/2#\n", + " etemp=abs(xr-xt)/xt*100#\n", + " \n", + " if f(x1)*f(xr)<0:\n", + " x2=xr#\n", + " xr=(x1+x2)/2#\n", + " etemp=abs(xr-xt)/xt*100#\n", + " \n", + " if f(x1)*f(xr)==0:\n", + " break\n", + " \n", + "print \"The result is =\",xr" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.4: Pg:126" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "enter the tolerable approximate error=21.03\n", + "Iteration: 1\n", + "xl: 12\n", + "xu: 16\n", + "xr: 14\n", + "et: 5.27868364433 %\n", + "----------------------------------------\n", + "Iteration: 2\n", + "xl: 14\n", + "xu: 15\n", + "xr: 14\n", + "et(%): 5.27868364433 %\n", + "ea 0 %\n", + "----------------------------------------\n", + "The result is= 14\n" + ] + } + ], + "source": [ + "from math import exp\n", + "m=68.1##kg\n", + "v=40##m/s\n", + "t=10##s\n", + "g=9.8##m/s**2\n", + "def f(c):\n", + " y=g*m*(1-exp(-c*t/m))/c - v#\n", + " return y\n", + "x1=12#\n", + "x2=16#\n", + "xt=14.7802##true value\n", + "e=input(\"enter the tolerable approximate error=\")\n", + "xr=(x1+x2)/2#\n", + "i=1#\n", + "et=abs(xr-xt)/xt*100##error\n", + "print \"Iteration:\",i\n", + "print \"xl:\",x1\n", + "print \"xu:\",x2\n", + "print \"xr:\",xr\n", + "print \"et:\",et,\"%\"\n", + "print \"----------------------------------------\"\n", + "etemp=100#\n", + "while etemp>e:\n", + " if f(x1)*f(xr)>0:\n", + " x1=xr\n", + " xr=(x1+x2)/2\n", + " etemp=abs(xr-x1)/xr*100\n", + " et=abs(xr-xt)/xt*100\n", + " \n", + " if f(x1)*f(xr)<0:\n", + " x2=xr\n", + " xr=(x1+x2)/2\n", + " etemp=abs(xr-x2)/xr*100\n", + " et=abs(xr-xt)/xt*100\n", + " \n", + " if f(x1)*f(xr)==0:\n", + " break#\n", + " \n", + " i=i+1#\n", + " print \"Iteration:\",i\n", + " print \"xl:\",x1\n", + " print \"xu:\",x2\n", + " print \"xr:\",xr\n", + " print \"et(%):\",et,\"%\"\n", + " print \"ea\",etemp,\"%\"\n", + " print \"----------------------------------------\"\n", + "\n", + "\n", + "print \"The result is=\",xr" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.5: Pg:133" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "enter the tolerable true percent error=24.36\n", + "The result is= 14.9113031791\n" + ] + } + ], + "source": [ + "from math import exp\n", + "m=68.1##kg\n", + "v=40##m/s\n", + "t=10##s\n", + "g=9.8##m/s**2\n", + "def f(c):\n", + " y=g*m*(1-exp(-c*t/m))/c - v#\n", + " return y\n", + "x1=12#\n", + "x2=16#\n", + "xt=14.7802##true value\n", + "e=input(\"enter the tolerable true percent error=\")\n", + "xr=x1-(f(x1)*(x2-x1))/(f(x2)-f(x1))#\n", + "etemp=abs(xr-xt)/xt*100##error\n", + "while etemp>e:\n", + " if f(x1)*f(xr)>0:\n", + " x1=xr\n", + " xr=x1-(f(x1)*(x2-x1))/(f(x2)-f(x1))\n", + " etemp=abs(xr-xt)/xt*100\n", + " \n", + " if f(x1)*f(xr)<0:\n", + " x2=xr\n", + " xr=x1-(f(x1)*(x2-x1))/(f(x2)-f(x1))\n", + " etemp=abs(xr-xt)/xt*100\n", + " \n", + " if f(x1)*f(xr)==0:\n", + " break\n", + " \n", + "\n", + "print \"The result is=\",xr" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex5.6: Pg:135" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "BISECTION METHOD:\n", + "Iteration: 1\n", + "xl: 0\n", + "xu: 1.3\n", + "xr: 0.65\n", + "et(%): 35.0 %\n", + "----------------------------------------\n", + "Iteration: 2\n", + "xl: 0.65\n", + "xu: 1.3\n", + "xr: 0.975\n", + "et(%): 2.5 %\n", + "ea(%) 33.3333333333 %\n", + "----------------------------------------\n", + "Iteration: 3\n", + "xl: 0.975\n", + "xu: 1.3\n", + "xr: 1.1375\n", + "et(%): 13.75 %\n", + "ea(%) 14.2857142857 %\n", + "----------------------------------------\n", + "Iteration: 4\n", + "xl: 0.975\n", + "xu: 1.1375\n", + "xr: 1.05625\n", + "et(%): 5.625 %\n", + "ea(%) 7.69230769231 %\n", + "----------------------------------------\n", + "Iteration: 5\n", + "xl: 0.975\n", + "xu: 1.05625\n", + "xr: 1.015625\n", + "et(%): 1.5625 %\n", + "ea(%) 4.0 %\n", + "----------------------------------------\n", + "FALSE POSITION METHOD:\n", + "Iteration: 1\n", + "xl: 0\n", + "xu: 1.3\n", + "xr: 0.0942995953723\n", + "et(%): 90.5700404628 %\n", + "----------------------------------------\n", + "Iteration: 2\n", + "xl: 0.0942995953723\n", + "xu: 1.3\n", + "xr: 0.181758872519\n", + "et(%): 81.8241127481 %\n", + "ea(%) 48.1182986748 %\n", + "----------------------------------------\n", + "Iteration: 3\n", + "xl: 0.181758872519\n", + "xu: 1.3\n", + "xr: 0.26287401252\n", + "et(%): 73.712598748 %\n", + "ea(%) 30.8570403075 %\n", + "----------------------------------------\n", + "Iteration: 4\n", + "xl: 0.26287401252\n", + "xu: 1.3\n", + "xr: 0.338105103322\n", + "et(%): 66.1894896678 %\n", + "ea(%) 22.2508001396 %\n", + "----------------------------------------\n", + "Iteration: 5\n", + "xl: 0.338105103322\n", + "xu: 1.3\n", + "xr: 0.407877916593\n", + "et(%): 59.2122083407 %\n", + "ea(%) 17.1062983388 %\n", + "----------------------------------------\n" + ] + } + ], + "source": [ + "def f(x):\n", + " y=x**10 - 1#\n", + " return y\n", + "x1=0#\n", + "x2=1.3#\n", + "xt=1#\n", + "\n", + "#using bisection method\n", + "print \"BISECTION METHOD:\"\n", + "xr=(x1+x2)/2#\n", + "et=abs(xr-xt)/xt*100##error\n", + "print \"Iteration:\",1\n", + "print \"xl:\",x1\n", + "print \"xu:\",x2\n", + "print \"xr:\",xr\n", + "print \"et(%):\",et,\"%\"\n", + "print \"----------------------------------------\"\n", + "for i in range(2,6):\n", + " if f(x1)*f(xr)>0:\n", + " x1=xr\n", + " xr=(x1+x2)/2\n", + " ea=abs(xr-x1)/xr*100#\n", + " et=abs(xr-xt)/xt*100#\n", + " else:\n", + " if f(x1)*f(xr)<0:\n", + " x2=xr#\n", + " xr=(x1+x2)/2#\n", + " ea=abs(xr-x2)/xr*100#\n", + " et=abs(xr-xt)/xt*100#\n", + " \n", + " \n", + " if f(x1)*f(xr)==0:\n", + " break\n", + " \n", + " print \"Iteration:\",i\n", + " print \"xl:\",x1\n", + " print \"xu:\",x2\n", + " print \"xr:\",xr\n", + " print \"et(%):\",et,\"%\"\n", + " print \"ea(%)\",ea,\"%\"\n", + " print \"----------------------------------------\"\n", + "\n", + "\n", + "#using false position method\n", + "print \"FALSE POSITION METHOD:\"\n", + "x1=0#\n", + "x2=1.3#\n", + "xt=1#\n", + "xr=x1-(f(x1)*(x2-x1))/(f(x2)-f(x1))##\n", + "et=abs(xr-xt)/xt*100##error\n", + "print \"Iteration:\",1\n", + "print \"xl:\",x1\n", + "print \"xu:\",x2\n", + "print \"xr:\",xr\n", + "print \"et(%):\",et,\"%\"\n", + "print \"----------------------------------------\"\n", + "for i in range(2,6):\n", + " if f(x1)*f(xr)>0:\n", + " x1=xr#\n", + " xr=x1-(f(x1)*(x2-x1))/(f(x2)-f(x1))#\n", + " ea=abs(xr-x1)/xr*100#\n", + " et=abs(xr-xt)/xt*100#\n", + " \n", + " elif f(x1)*f(xr)<0:\n", + " x2=xr#\n", + " xr=x1-(f(x1)*(x2-x1))/(f(x2)-f(x1))#\n", + " ea=abs(xr-x2)/xr*100#\n", + " et=abs(xr-xt)/xt*100#\n", + " \n", + " \n", + " elif f(x1)*f(xr)==0:\n", + " break#\n", + " \n", + " print \"Iteration:\",i\n", + " print \"xl:\",x1\n", + " print \"xu:\",x2\n", + " print \"xr:\",xr\n", + " print \"et(%):\",et,'%'\n", + " print \"ea(%)\",ea,\"%\"\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.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter6.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter6.ipynb new file mode 100644 index 00000000..01ab6a06 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter6.ipynb @@ -0,0 +1,686 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 6 : Open Methods" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.1: Pg: 143" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x = :\n", + "0\n", + "1.0\n", + "0.367879441171\n", + "0.692200627555\n", + "0.500473500564\n", + "0.606243535086\n", + "0.545395785975\n", + "0.579612335503\n", + "0.560115461361\n", + "0.57114311508\n", + "0.564879347391\n", + "\n", + "e = :\n", + "100.0\n", + "-171.828182846\n", + "46.8536394613\n", + "-38.3091465933\n", + "17.4467896812\n", + "-11.1566225254\n", + "5.90335081441\n", + "-3.48086697962\n", + "1.93080393126\n", + "-1.10886824205\n" + ] + } + ], + "source": [ + "from math import exp\n", + "#f(x) = exp(-x) - x#\n", + "#using simple fixed point iteration, Xi+1 = exp(-Xi)\n", + "x = 0##initial guess\n", + "y=[]\n", + "e=[]\n", + "y.append(0)\n", + "e.append(0)\n", + "for i in range(1,12):\n", + " if i == 1 :\n", + " y.append(x)\n", + " else:\n", + " y.append(exp(-y[(i-1)]))\n", + " e.append((y[(i)] - y[(i-1)]) * 100 / y[(i)])\n", + " \n", + "print \"x = :\"\n", + "for x in y[1:]:\n", + " print x\n", + "print \"\\ne = :\"\n", + "for e in e[1:]:\n", + " print e\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.2: Pg: 144" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x = [0, 0.2, 0.4, 0.6000000000000001, 0.8, 1.0]\n", + "y1 = [0, 0.2, 0.4, 0.6000000000000001, 0.8, 1.0]\n", + "y2 = [1.0, 0.8187307530779818, 0.6703200460356393, 0.5488116360940264, 0.44932896411722156, 0.36787944117144233]\n", + "answer using two curve graphical method = 5.7\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEZCAYAAABsPmXUAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xl4VPW9x/H3l7CIIiKLKIuIbBIQi6wVwQCyCLVWLe5S\nXEGg1ke0lrayWav2ttdeLyjRq1avVtuoV0FRQTCAiihhU8O+KOCOIMoWSL73j4lxjIFMkpk5s3xe\nz5PnycmcnHw5JB8+/Oacibk7IiKSWqoFPYCIiESfwl1EJAUp3EVEUpDCXUQkBSncRURSkMJdRCQF\nKdwlKZhZOzNbbma7zGxs8ccGmdn/Rfj5i80sM7Z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m1Ft7q6bnkpEci6ACcCxwAPFjfWAu3cPauZYifBcpLwIfz5Wm9krwEqgCHjI\n3VMu3CP8nvgz8KiZrSBURH/r7l8FNnQMmdlTwFlAQzPbAkwktERX6dzUTUwiIikoIX6HqoiIRJfC\nXUQkBSncRURSkMJdRCQFKdxFRFKQwl1EJAUp3EVEUpDCXUQkBSncJW0V/2KQFWZWy8yOKv6FEJlB\nzyUSDbpDVdKamd0BHAHUBra4+z0BjyQSFQp3SWtmVoPQi1jtBX7q+oGQFKFlGUl3DYGjgDqE2rtI\nSlBzl7RmZjOAfwInAye4+68DHkkkKqL9yzpEkoaZDQf2u/vTZlYNeMvMstw9N+DRRKpMzV1EJAVp\nzV1EJAUp3EVEUpDCXUQkBSncRURSkMJdRCQFKdxFRFKQwl1EJAUp3EVEUtD/Az3b0Y3oypA2AAAA\nAElFTkSuQmCC\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7f6dbdac5f50>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from math import exp\n", + "%matplotlib inline\n", + "from matplotlib.pyplot import plot,title,xlabel,ylabel,show\n", + "#y1 = x\n", + "#y2 = exp(-x)\n", + "x=[]\n", + "y1=[]\n", + "y2=[]\n", + "for i in range(0,6):\n", + " if i == 0:\n", + " x.append(0)\n", + " else:\n", + " x.append(x[(i-1)] + 0.2)\n", + " \n", + " y1.append(x[(i)])\n", + " y2.append(exp(-x[(i)]))\n", + "\n", + "print \"x = \",x\n", + "print \"y1 = \",y1\n", + "print \"y2 = \",y2\n", + "plot(x,y1)\n", + "plot(x,y2)#\n", + "title(\"f(x) vs x\")\n", + "xlabel(\"x\")\n", + "y=(\"f(x)\")\n", + "# from the graph, we get\n", + "x7 = 5.7#\n", + "print \"answer using two curve graphical method = \",x7" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.3: Pg: 149" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x = [0.5, 0.5663110031972182, 0.5671431650348622, 0.5671432904097811, 0.5671432904097811]\n", + "et = [100.0, 11.709290976662398, 0.14672870783743905, 2.2106391984397626e-05]\n" + ] + } + ], + "source": [ + "from math import exp\n", + "#f(x) = exp(-x)-x\n", + "#f'(x) = -exp(-x)-1\n", + "x=[]\n", + "et=[]\n", + "for i in range(0,5):\n", + " if i == 0:\n", + " x.append(0)\n", + " else:\n", + " x.append(x[(i-1)] - (exp(-x[(i-1)])-x[(i-1)])/(-exp(-x[(i-1)])-1))\n", + " et.append((x[(i)] - x[(i-1)]) * 100 / x[(i)])\n", + " x[(i-1)] = x[(i)]\n", + " \n", + "\n", + "print \"x =\",x\n", + "print \"et =\",et" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.4: Pg: 150" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Et1 = 0.0582022389721 which is close to the true error of 0.06714329\n", + "Et2 = 0.000815754223141 which is close to the true error of 0.0008323\n", + "Et3 = 1.253469828e-07 which is close to the true error of 0.0008323\n", + "Et4 = 2.84303276339e-15 which is close to the true error of 0.0008323\n", + "Thus it illustratres that the error of newton raphson method for this case is proportional(by a factor of 0.18095) to the square of the error of the previous iteration\n" + ] + } + ], + "source": [ + "from math import exp\n", + "#f(x) = exp(-x) - x\n", + "#f'(x) = -exp(-x) - 1\n", + "#f\"(x) = exp(-x)\n", + "xr = 0.56714329#\n", + "#E(ti+1) = -f\"(x)* E(ti) / 2 * f'(x)\n", + "Et0 = 0.56714329#\n", + "Et1 = -exp(-xr)* ((Et0)**2) / (2 * (-exp(-xr) - 1))#\n", + "print \"Et1 = \",Et1,\"which is close to the true error of 0.06714329\"\n", + "Et1true = 0.06714329#\n", + "Et2 = -exp(-xr)* ((Et1true)**2) / (2 * (-exp(-xr) - 1))#\n", + "print \"Et2 = \",Et2,\"which is close to the true error of 0.0008323\"\n", + "Et2true = 0.0008323#\n", + "Et3 = -exp(-xr)* ((Et2true)**2) / (2 * (-exp(-xr) - 1))#\n", + "print \"Et3 = \",Et3,\"which is close to the true error of 0.0008323\"\n", + "Et4 = -exp(-xr)* ((Et3)**2) / (2 * (-exp(-xr) - 1))#\n", + "print \"Et4 = \",Et4,\"which is close to the true error of 0.0008323\"\n", + "print \"Thus it illustratres that the error of newton raphson method for this case is proportional(by a factor of 0.18095) to the square of the error of the previous iteration\"\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.5: Pg: 151" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "y =\n", + "0.5\n", + "51.65\n", + "46.485\n", + "41.8365\n", + "37.65285\n", + "33.887565\n", + "30.4988085\n", + "27.44892765\n", + "24.704034885\n", + "22.2336313965\n", + "20.0102682569\n", + "18.0092414312\n", + "16.208317288\n", + "14.5874855592\n", + "13.1287370033\n", + "11.815863303\n", + "10.6342769727\n", + "9.57084927551\n", + "8.61376434811\n", + "7.75238791368\n", + "6.9771491233\n", + "6.27943421352\n", + "5.65149079876\n", + "5.08634173588\n", + "4.57770760618\n", + "4.11993695885\n", + "3.70794355537\n", + "3.33714995458\n", + "3.00343690726\n", + "2.70309824497\n", + "2.43280139954\n", + "2.18955475922\n", + "1.97068573981\n", + "1.7738402371\n", + "1.59703134797\n", + "1.43880793143\n", + "1.29871134273\n", + "1.17835471562\n", + "1.08334975351\n", + "1.02366466118\n", + "Thus, after the first poor prediction, the technique is converging on to the true root of 1 but at a very slow rate\n" + ] + } + ], + "source": [ + "z = 0.5#\n", + "#f(x) = x**10 - 1\n", + "#f'(x) = 10*x**9\n", + "y=[]\n", + "for i in range(0,40):\n", + " if i==0:\n", + " y.append(z)\n", + " else:\n", + " y.append(y[(i-1)] - (y[(i-1)]**10 - 1)/(10*y[(i-1)]**9))\n", + " \n", + "print \"y =\"\n", + "for yy in y:\n", + " print yy\n", + "print \"Thus, after the first poor prediction, the technique is converging on to the true root of 1 but at a very slow rate\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.6: Pg: 155" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x =\n", + "0\n", + "1\n", + "0.61269983678\n", + "0.563838389161\n", + "0.56717035842\n", + "\n", + "et =\n", + "-8.03263435953\n", + "0.582727662867\n", + "-0.00477276558181\n" + ] + } + ], + "source": [ + "from math import exp\n", + "#f(x) = exp(-x)-x\n", + "x=[]\n", + "er=[]\n", + "for i in range(0,5):\n", + " if i==0:\n", + " x.append(0)\n", + " else:\n", + " if i==1:\n", + " x.append(1)\n", + " else:\n", + " x.append(x[(i-1)] - (exp(-x[(i-1)])-x[(i-1)])*(x[(i-2)] - x[(i-1)])/((exp(-x[(i-2)])-x[(i-2)])-(exp(-x[(i-1)])-x[(i-1)])))\n", + " er.append((0.56714329 - x[(i)]) * 100 / 0.56714329)\n", + " \n", + "print \"x =\"\n", + "for xx in x:\n", + " print xx\n", + "\n", + "print \"\\net =\"\n", + "for xx in er:\n", + " print xx\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.7: Pg: 156" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "secant method\n", + "x =\n", + "[0.5, 5, 1.8546349804879152, -0.1043807923822424]\n", + "[0.5, 5, 1.8546349804879152, -0.1043807923822424]\n", + "[0.5, 5, 1.8546349804879152, -0.1043807923822424]\n", + "[0.5, 5, 1.8546349804879152, -0.1043807923822424]\n", + "thus, secant method is divergent\n", + "Now, False position method\n", + "xr = 1.85463498049\n", + "xr = 1.21630781847\n", + "xr = 1.05852096245\n", + "thus, false position method is convergent\n" + ] + } + ], + "source": [ + "from math import log\n", + "#f(x) = log(x)\n", + "print \"secant method\"\n", + "x=[]\n", + "for i in range(0,4):\n", + " if i==0:\n", + " x.append(0.5)\n", + " else:\n", + " if i==1:\n", + " x.append(5)\n", + " else:\n", + " x.append(x[(i-1)] - log(x[(i-1)]) * (x[(i-2)] - x[(i-1)])/(log(x[(i-2)]) - log(x[(i-1)])))\n", + " \n", + " \n", + "print \"x =\"\n", + "for xx in x:\n", + " print x\n", + "print \"thus, secant method is divergent\"\n", + "print \"Now, False position method\"\n", + "xl = 0.5#\n", + "xu = 5#\n", + "for i in range(0,3):\n", + " m = log(xl)#\n", + " n = log(xu)#\n", + " xr = xu - n*(xl - xu)/(m - n)#\n", + " print \"xr = \",xr\n", + " w = log(xr)#\n", + " if m*w < 0:\n", + " xu = xr#\n", + " else:\n", + " xl = xr#\n", + " \n", + "\n", + " \n", + "print \"thus, false position method is convergent\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.8: Pg: 158" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x1 = 1\n", + "x = 0.537262665537\n", + "error = 5.26861993966 %\n", + "x = 0.567009685365\n", + "error = 0.0235574743537 %\n", + "x = 0.567143424147\n", + "error = -2.3653190891e-05 %\n" + ] + } + ], + "source": [ + "from math import exp\n", + "Del = 0.01#\n", + "z = 0.56714329\n", + "x1 = 1#\n", + "#f(x) = exp(-x) - x\n", + "x=[]\n", + "print \"x1 = \",x1\n", + "for i in range(0,4):\n", + " if i == 0:\n", + " x.append(1)\n", + " else :\n", + " w = x[(i-1)]\n", + " m = exp(-x[(i-1)]) - x[(i-1)]\n", + " x[(i-1)] = x[(i-1)]*(1+Del)#\n", + " n = exp(-x[(i-1)]) - x[(i-1)]#\n", + " x.append(w - (x[(i-1)]- w) * m/(n-m))\n", + " em = (z - x[(i)])*100/z#\n", + " print \"x = \",x[(i)]\n", + " print \"error = \",em,\"%\"\n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.9: Pg: 161" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "standard Newton Raphson method\n", + "x = 0.428571428571\n", + "error = 57.1428571429 %\n", + "x = 0.685714285714\n", + "error = 31.4285714286 %\n", + "x = 0.832865400495\n", + "error = 16.7134599505 %\n", + "x = 0.913329893257\n", + "error = 8.66701067434 %\n", + "x = 0.955783292966\n", + "error = 4.42167070343 %\n", + "x = 0.977655101273\n", + "error = 2.23448987271 %\n", + "Modified Newton Raphson method\n", + "x = 1.10526315789\n", + "error = -10.5263157895 %\n", + "x = 1.0030816641\n", + "error = -0.30816640986 %\n", + "x = 1.00000238149\n", + "error = -0.000238149381548 %\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "#f(x) = x**3 - 5*x**2 + 7*x -3\n", + "#f'(x) = 3*x**2 - 10*x + 7\n", + "print \"standard Newton Raphson method\"\n", + "x=[]\n", + "et=[]\n", + "for i in range(0,7):\n", + " if i == 0:\n", + " x.append(0)\n", + " else:\n", + " x.append(x[(i-1)] - ((x[(i-1)])**3 - 5*(x[(i-1)])**2 + 7*x[(i-1)] -3)/(3*(x[(i-1)])**2 - 10*(x[(i-1)]) + 7)) \n", + " et.append((1 - x[(i)]) * 100 / 1)\n", + " print \"x = \",x[i]\n", + " print \"error = \",et[(i-1)],\"%\"\n", + " x[(i-1)] = x[(i)]\n", + " \n", + "\n", + "print \"Modified Newton Raphson method\"\n", + "#f\"(x) = 6*x - 10\n", + "x=[]\n", + "et=[]\n", + "for i in range(0,4):\n", + " if i == 0:\n", + " x.append(0)\n", + " else:\n", + " x.append(x[(i-1) ]- ((x[(i-1)])**3 - 5*(x[(i-1)])**2 + 7*x[(i-1)] -3)*((3*(x[(i-1)])**2 - 10*(x[(i-1)]) + 7))/((3*(x[(i-1)])**2 - 10*(x[(i-1)]) + 7)**2 - ((x[(i-1)])**3 - 5*(x[(i-1)])**2 + 7*x[(i-1)] -3) * (6*x[(i-1)] - 10)))\n", + " et.append((1 - x[(i)]) * 100 / 1)\n", + " print \"x = \",x[i]\n", + " print \"error = \",et[i-1],'%'\n", + " x[(i-1) ]= x[(i)]\n", + " \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.10: Pg: 165" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x = 2.17944947177\n", + "y = 2.86050598812\n", + "x = 1.94053387891\n", + "y = 3.04955067322\n", + "x = 2.02045628588\n", + "y = 2.98340474674\n", + "Thus the approaching to the true value 0f x = 2 and y = 3\n" + ] + } + ], + "source": [ + "from math import sqrt\n", + "#u(x,y) = x**2 + x*y - 10\n", + "#v(x,y) = y + 3*x*y**2 -57\n", + "x=[]\n", + "y=[]\n", + "for i in range(0,4):\n", + " if i == 0:\n", + " x.append(1.5)\n", + " y.append(3.5)\n", + " else:\n", + " x.append(sqrt(10 - (x[(i-1)])*(y[(i-1)])))\n", + " y.append(sqrt((57 - y[(i-1)])/(3*x[(i)])))\n", + " print \"x =\",x[(i)]\n", + " print \"y =\",y[i]\n", + " \n", + "\n", + "print \"Thus the approaching to the true value 0f x = 2 and y = 3\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex6.11:Pg 168" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "bracket: [1.9999999838762603, 2.9999994133889132]\n" + ] + } + ], + "source": [ + "from numpy import mat\n", + "from numpy.linalg import det\n", + "def u(x,y):\n", + " z=x**2+x*y-10\n", + " return z\n", + "def v(x,y):\n", + " z=y+3*x*y**2-57\n", + " return z\n", + "x=1.5#\n", + "y=3.5#\n", + "e=[100,100]#\n", + "while e[0]>0.0001 and e[1]>0.0001:\n", + " J=mat([[2*x+y, x],[3*y**2, 1+6*x*y]])\n", + " deter=det(J)#\n", + " u1=u(x,y)#\n", + " v1=v(x,y)#\n", + " x=x-((u1*J[1,1]-v1*J[0,1])/deter)#\n", + " y=y-((v1*J[0,0]-u1*J[1,0])/deter)#\n", + " e[(0)]=abs(2-x)#\n", + " e[(1)]=abs(3-y)#\n", + "\n", + "bracket=[x ,y]#\n", + "print \"bracket:\",bracket" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter7.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter7.ipynb new file mode 100644 index 00000000..022a81d0 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter7.ipynb @@ -0,0 +1,717 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7 : Roots of polynomials" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.1: Pg: 179" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The quptient is a(1)+a(2)*x where :\n", + "a(1)= 6\n", + "a(2)= 1\n", + "remainder= 0\n" + ] + } + ], + "source": [ + "from numpy import arange\n", + "def f(x):\n", + " y=(x-4)*(x+6)\n", + " return y\n", + "n=2\n", + "a=[0,-24,2,1]\n", + "t=4\n", + "r=a[(3)]\n", + "a[(3)]=0\n", + "for i in arange(n,0,-1):\n", + " s=a[(i)]\n", + " a[(i)]=r\n", + " r=s+r*t\n", + "\n", + "print \"The quptient is a(1)+a(2)*x where :\"\n", + "print \"a(1)=\",a[1]\n", + "print \"a(2)=\",a[2]\n", + "print \"remainder=\",r" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.2: Pg: 183" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "iteration: 0\n", + "xr: 5\n", + "---------------------------------------------\n", + "iteration: 0\n", + "xr: 3.97648704224\n", + "ea(%): 25.7391246818 %\n", + "---------------------------------------------\n", + "iteration: 1\n", + "xr: 4.00105049882\n", + "ea(%): 0.613925182444 %\n", + "---------------------------------------------\n", + "iteration: 2\n", + "xr: 4.00000070527\n", + "ea(%): 0.026244833989 %\n", + "---------------------------------------------\n", + "iteration: 3\n", + "xr: 4.0\n", + "ea(%): 1.76317506373e-05 %\n", + "---------------------------------------------\n" + ] + } + ], + "source": [ + "def f(x):\n", + " y=x**3 - 13*x - 12\n", + " return y\n", + "\n", + "x1t=-3\n", + "x2t=-1\n", + "x3t=4\n", + "x0=4.5\n", + "x1=5.5\n", + "x2=5\n", + "print \"iteration:\",0\n", + "print \"xr:\",x2\n", + "print \"---------------------------------------------\"\n", + "for i in range(0,4):\n", + "\n", + " h0=x1-x0\n", + " h1=x2-x1\n", + " d0=(f(x1)-f(x0))/(x1-x0)\n", + " d1=(f(x2)-f(x1))/(x2-x1)\n", + " a=(d1-d0)/(h1+h0)\n", + " b=a*h1+d1\n", + " c=f(x2)\n", + " d=(b**2 - 4*a*c)**0.5\n", + " if abs(b+d)>abs(b-d):\n", + " x3=x2+((-2*c)/(b+d))\n", + " else:\n", + " x3=x2+((-2*c)/(b-d))\n", + " ea=abs(x3-x2)*100/x3\n", + " x0=x1\n", + " x1=x2\n", + " x2=x3\n", + " print \"iteration:\",i\n", + " print \"xr:\",x2\n", + " print \"ea(%):\",ea,\"%\"\n", + " print \"---------------------------------------------\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.3: Pg: 187" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Iteration: 1\n", + "delata r: 0.212481426449\n", + "delata s: 1.61961367013\n", + "r: -0.787518573551\n", + "s: 0.619613670134\n", + "Error in r: 26.9811320755\n", + "Error in s: 261.39088729\n", + "-----------------------------------------------------\n", + "Iteration: 2\n", + "delata r: 4.04595826496\n", + "delata s: 5.2325468461\n", + "r: 3.25843969141\n", + "s: 5.85216051623\n", + "Error in r: 124.168579079\n", + "Error in s: 89.4122235982\n", + "-----------------------------------------------------\n", + "Iteration: 3\n", + "delata r: 2.4536017174\n", + "delata s: -24.7953826358\n", + "r: 5.71204140882\n", + "s: -18.9432221196\n", + "Error in r: 42.9549007403\n", + "Error in s: 130.893163155\n", + "-----------------------------------------------------\n", + "Iteration: 4\n", + "delata r: -7.89009085\n", + "delata s: 22.0401977474\n", + "r: -2.17804944119\n", + "s: 3.09697562788\n", + "Error in r: 362.254901143\n", + "Error in s: 711.668427386\n", + "-----------------------------------------------------\n", + "Iteration: 5\n", + "delata r: -58.1023530819\n", + "delata s: 185.887882155\n", + "r: -60.2804025231\n", + "s: 188.984857783\n", + "Error in r: 96.386803422\n", + "Error in s: 98.3612572646\n", + "-----------------------------------------------------\n", + "Iteration: 6\n", + "delata r: 1160.70485616\n", + "delata s: 90001.7445985\n", + "r: 1100.42445363\n", + "s: 90190.7294562\n", + "Error in r: 105.477922844\n", + "Error in s: 99.7904608834\n", + "-----------------------------------------------------\n", + "Iteration: 7\n", + "delata r: -21882.7802726\n", + "delata s: 31520060.138\n", + "r: -20782.355819\n", + "s: 31610250.8675\n", + "Error in r: 105.294993807\n", + "Error in s: 99.7146788558\n", + "-----------------------------------------------------\n", + "Iteration: 8\n", + "delata r: 411986.000256\n", + "delata s: 11197461422.1\n", + "r: 391203.644438\n", + "s: 11229071673.0\n", + "Error in r: 105.312413653\n", + "Error in s: 99.7184963122\n", + "-----------------------------------------------------\n", + "Iteration: 9\n", + "delata r: -7758767.67604\n", + "delata s: 3.9700158833e+12\n", + "r: -7367564.0316\n", + "s: 3.98124495498e+12\n", + "Error in r: 105.309809901\n", + "Error in s: 99.7179507466\n", + "-----------------------------------------------------\n", + "Iteration: 10\n", + "delata r: 146111056.094\n", + "delata s: 1.4079763212e+15\n", + "r: 138743492.063\n", + "s: 1.41195756615e+15\n", + "Error in r: 105.310205129\n", + "Error in s: 99.7180336683\n", + "-----------------------------------------------------\n", + "Iteration: 11\n", + "delata r: -2751543853.16\n", + "delata s: 4.99319657786e+17\n", + "r: -2612800361.1\n", + "s: 5.00731615352e+17\n", + "Error in r: 105.310145166\n", + "Error in s: 99.718021087\n", + "-----------------------------------------------------\n", + "Iteration: 12\n", + "delata r: 51816650788.5\n", + "delata s: 1.77078151694e+20\n", + "r: 49203850427.4\n", + "s: 1.7757888331e+20\n", + "Error in r: 105.310154263\n", + "Error in s: 99.7180229957\n", + "-----------------------------------------------------\n", + "Iteration: 13\n", + "delata r: -9.75803357309e+11\n", + "delata s: 6.27987270746e+22\n", + "r: -9.26599506881e+11\n", + "s: 6.29763059579e+22\n", + "Error in r: 105.310152883\n", + "Error in s: 99.7180227061\n", + "-----------------------------------------------------\n", + "Iteration: 14\n", + "delata r: 1.83761812944e+13\n", + "delata s: 2.22708488435e+25\n", + "r: 1.74495817875e+13\n", + "s: 2.23338251495e+25\n", + "Error in r: 105.310153092\n", + "Error in s: 99.7180227501\n", + "-----------------------------------------------------\n", + "Iteration: 15\n", + "delata r: -3.46057469143e+14\n", + "delata s: 7.89810111349e+27\n", + "r: -3.28607887356e+14\n", + "s: 7.92043493864e+27\n", + "Error in r: 105.310153061\n", + "Error in s: 99.7180227434\n", + "-----------------------------------------------------\n", + "Iteration: 16\n", + "delata r: 6.51690195935e+15\n", + "delata s: 2.80097098525e+30\n", + "r: 6.18829407199e+15\n", + "s: 2.80889142018e+30\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227444\n", + "-----------------------------------------------------\n", + "Iteration: 17\n", + "delata r: -1.22725312811e+17\n", + "delata s: 9.93332238103e+32\n", + "r: -1.16537018739e+17\n", + "s: 9.96141129523e+32\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 18\n", + "delata r: 2.31114454359e+18\n", + "delata s: 3.5227388664e+35\n", + "r: 2.19460752485e+18\n", + "s: 3.53270027769e+35\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 19\n", + "delata r: -4.35231247656e+19\n", + "delata s: 1.24929893994e+38\n", + "r: -4.13285172407e+19\n", + "s: 1.25283164021e+38\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 20\n", + "delata r: 8.19620908009e+20\n", + "delata s: 4.43049541996e+40\n", + "r: 7.78292390768e+20\n", + "s: 4.44302373636e+40\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 21\n", + "delata r: -1.54349770717e+22\n", + "delata s: 1.57122439144e+43\n", + "r: -1.46566846809e+22\n", + "s: 1.57566741518e+43\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 22\n", + "delata r: 2.90669155552e+23\n", + "delata s: 5.57216711507e+45\n", + "r: 2.76012470871e+23\n", + "s: 5.58792378922e+45\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 23\n", + "delata r: -5.47383760902e+24\n", + "delata s: 1.97610516534e+48\n", + "r: -5.19782513815e+24\n", + "s: 1.98169308913e+48\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 24\n", + "delata r: 1.03082482601e+26\n", + "delata s: 7.00803034767e+50\n", + "r: 9.78846574632e+25\n", + "s: 7.02784727856e+50\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 25\n", + "delata r: -1.94123373367e+27\n", + "delata s: 2.48531759419e+53\n", + "r: -1.8433490762e+27\n", + "s: 2.49234544147e+53\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 26\n", + "delata r: 3.6557020297e+28\n", + "delata s: 8.81389382974e+55\n", + "r: 3.47136712208e+28\n", + "s: 8.83881728416e+55\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 27\n", + "delata r: -6.88436281433e+29\n", + "delata s: 3.12574636833e+58\n", + "r: -6.53722610212e+29\n", + "s: 3.13458518562e+58\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 28\n", + "delata r: 1.29645280097e+31\n", + "delata s: 1.10851010324e+61\n", + "r: 1.23108053995e+31\n", + "s: 1.11164468843e+61\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 29\n", + "delata r: -2.44146032172e+32\n", + "delata s: 3.93120395638e+63\n", + "r: -2.31835226773e+32\n", + "s: 3.94232040327e+63\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 30\n", + "delata r: 4.59772118049e+33\n", + "delata s: 1.39415639979e+66\n", + "r: 4.36588595372e+33\n", + "s: 1.3980987202e+66\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 31\n", + "delata r: -8.65835904252e+34\n", + "delata s: 4.94421578898e+68\n", + "r: -8.22177044714e+34\n", + "s: 4.95819677619e+68\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 32\n", + "delata r: 1.63052908966e+36\n", + "delata s: 1.75340942893e+71\n", + "r: 1.54831138518e+36\n", + "s: 1.75836762571e+71\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 33\n", + "delata r: -3.07058773973e+37\n", + "delata s: 6.21826545742e+73\n", + "r: -2.91575660121e+37\n", + "s: 6.23584913368e+73\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 34\n", + "delata r: 5.78248442618e+38\n", + "delata s: 2.20523653295e+76\n", + "r: 5.49090876606e+38\n", + "s: 2.21147238208e+76\n", + "Error in r: 105.310153065\n", + "Error in s: 99.7180227443\n", + "-----------------------------------------------------\n", + "Iteration: 35\n", + "delata r: -inf\n", + "delata s: inf\n", + "r: -inf\n", + "s: inf\n", + "Error in r: nan\n", + "Error in s: nan\n", + "-----------------------------------------------------\n", + "[nan, -inf] The roots are:\n", + "x**3 - 4*x**2 + 5.25*x - 2.5 The quotient is:\n", + "-----------------------------------------------------\n" + ] + } + ], + "source": [ + "def f(x):\n", + " y=x**5-3.5*x**4+2.75*x**3+2.125*x**2-3.875*x+1.25\n", + " return y\n", + "r=-1\n", + "s=-1\n", + "es=1##%\n", + "n=6\n", + "count=1\n", + "ear=100\n", + "eas=100\n", + "a=[0,1.25, -3.875, 2.125, 2.75, -3.5, 1]\n", + "b=a\n", + "c=a\n", + "while (ear>es) and (eas>es):\n", + " \n", + " b[(n)]=a[(n)]\n", + " b[(n-1)]=a[(n-1)]+r*b[(n)]\n", + " for i in arange(n-2,0,-1):\n", + " b[(i)]=a[(i)]+r*b[(i+1)]+s*b[(i+2)]\n", + "\n", + " c[(n)]=b[(n)]\n", + " c[(n-1)]=b[(n-1)]+r*c[(n)]\n", + " for i in arange((n-2),1,-1):\n", + " c[(i)]=b[(i)]+r*c[(i+1)]+s*c[(i+2)]\n", + " \n", + " #c(3)*dr+c(4)*ds=-b(2)\n", + " #c(2)*dr+c(3)*ds=-b(1)\n", + " ds=((-b[(1)])+(b[(2)]*c[(2)]/c[(3)]))/(c[(3)]-(c[(4)]*c[(2)]/c[(3)]))\n", + " dr=(-b[(2)]-c[(4)]*ds)/c[(3)]\n", + " r=r+dr\n", + " s=s+ds\n", + " ear=abs(dr/r)*100\n", + " eas=abs(ds/s)*100\n", + " print \"Iteration:\",count\n", + " print \"delata r:\",dr\n", + " print \"delata s:\",ds\n", + " print \"r:\",r\n", + " print \"s:\",s\n", + " print \"Error in r:\",ear\n", + " print \"Error in s:\",eas\n", + " print \"-----------------------------------------------------\"\n", + " count=count+1\n", + "\n", + "x1=(r+(r**2 + 4*s)**0.5)/2\n", + "x2=(r-(r**2 + 4*s)**0.5)/2\n", + "bracket=[x1, x2]\n", + "print bracket,\"The roots are:\"\n", + "print \"x**3 - 4*x**2 + 5.25*x - 2.5\",\"The quotient is:\"\n", + "print \"-----------------------------------------------------\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.4: Pg: 191" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The root is= 0.738868466337\n" + ] + } + ], + "source": [ + "from math import cos\n", + "def f(x):\n", + " y=x-cos(x)\n", + " return y\n", + "x1=0\n", + "if f(x1)<0:\n", + " x2=x1+0.001\n", + " while f(x2)<0:\n", + " x2=x2+0.001\n", + " \n", + "elif x20==x1+0.001:\n", + " while f(x2)>0:\n", + " x2=x2+0.001\n", + " \n", + "else:\n", + " print \"The root is=\",x1\n", + "\n", + "x=x2-(x2-x1)*f(x2)/(f(x2)-f(x1))\n", + "print \"The root is=\",x" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.5: Pg: 191" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x= 2\n", + "y= 3.0\n" + ] + } + ], + "source": [ + "def u(x,y):\n", + " z=x**2+x*y-10\n", + " return z\n", + "def v(x,y):\n", + " z=y+3*x*y**2-57\n", + " return z\n", + "x=1\n", + "y=3.5\n", + "while u(x,y)!=v(x,y):\n", + " x=x+1\n", + " y=y-0.5\n", + "\n", + "print \"x=\",x\n", + "print \"y=\",y" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.6: Pg: 194" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of the polynomial are:\n", + "-1\n", + "1\n", + "-1/4 + sqrt(5)/4 - I*sqrt(sqrt(5)/8 + 5/8)\n", + "-1/4 + sqrt(5)/4 + I*sqrt(sqrt(5)/8 + 5/8)\n", + "1/4 + sqrt(5)/4 - I*sqrt(-sqrt(5)/8 + 5/8)\n", + "1/4 + sqrt(5)/4 + I*sqrt(-sqrt(5)/8 + 5/8)\n", + "-sqrt(5)/4 - 1/4 - I*sqrt(-sqrt(5)/8 + 5/8)\n", + "-sqrt(5)/4 - 1/4 + I*sqrt(-sqrt(5)/8 + 5/8)\n", + "-sqrt(5)/4 + 1/4 - I*sqrt(sqrt(5)/8 + 5/8)\n", + "-sqrt(5)/4 + 1/4 + I*sqrt(sqrt(5)/8 + 5/8)\n" + ] + } + ], + "source": [ + "from sympy import symbols,solve\n", + "x=symbols('s')\n", + "p=x**10 -1\n", + "print \"The roots of the polynomial are:\"\n", + "for r in solve(p):\n", + " print r" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.7: Pg: 195" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The roots of the polynomial are:\n", + "-1.00000000000000\n", + "0.500000000000000\n", + "2.00000000000000\n", + "1.0 - 0.5*I\n", + "1.0 + 0.5*I\n" + ] + } + ], + "source": [ + "from sympy import symbols,solve\n", + "x=symbols('s')\n", + "p=x**5 - 3.5*x**4 +2.75*x**3 +2.125*x**2 - 3.875*x + 1.25\n", + "print \"The roots of the polynomial are:\"\n", + "for r in solve(p):\n", + " print r" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex7.8: Pg: 196" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The root is= 0.739083980074\n" + ] + } + ], + "source": [ + "from math import cos\n", + "def f(x):\n", + " y=x-cos(x)\n", + " return y\n", + "x1=0\n", + "if f(x1)<0:\n", + " x2=x1+0.00001\n", + " while f(x2)<0:\n", + " x2=x2+0.00001\n", + " \n", + "elif x2==x1+0.00001:\n", + " while f(x2)>0:\n", + " x2=x2+0.00001\n", + " \n", + "else:\n", + " print x1,\"The root is=\"\n", + "\n", + "x=x2-(x2-x1)*f(x2)/(f(x2)-f(x1))\n", + "print \"The root is=\",x" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter9.ipynb b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter9.ipynb new file mode 100644 index 00000000..83d8625a --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter9.ipynb @@ -0,0 +1,606 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter - 9 : Gauss Eliminations" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.1 Pg: 242" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The lines meet at=x2= 3 and x1= 4\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEZCAYAAABsPmXUAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGEZJREFUeJzt3XuQnfV93/H3VxIWkgDRGiOQ7IDrgTqImyVLg0McH6fg\nOBQ7ns6UMW1McAO2M03s1NjEmNZaMZDUJGlwE+NCQAwXC/7AsevExHcfMJexVkYIEFDArqd4VwgK\nxICkcQX69o9zVjpIu6u9Pftczvs1s8Oey57nxxn00Y/v5zzPRmYiSWqWOWUvQJI08wx3SWogw12S\nGshwl6QGMtwlqYEMd0lqIMNdkhrIcFcjRcRfRMTjEfFiRDwaER8qeT3nRMS9EbE9In5Q5lrUH+aV\nvQCpIC8DZ2fm4xGxGvhmRDyZmfeVtJ7ngP8G/CrwmyWtQX3EnbtqKSLeEhHPRcTbureXRsSzEfEb\nAJk5kJmPd7/fAPwQeMcYr/VoRPzrntvzuq91akQcHBG3RMT/jYgXImJDRBw5hfV8LzNvB7bO8Fsh\njcpwVy1l5k+APwFuiYgFwA3ADZl5177P7T6+Cnh4jJdbD5zbc/u3gGcy8wHg94DDgDcC/xz4KLBz\nOuuRZoPhrtrKzOuAJ4ENwBLg0jGe+j+ABzLz22M8vh54f0Qc3L3974Bbu9//P+D1wHHZsSkzX5rm\neqTCGe6qu+uA5cBfZ+aufR+MiD8HTgDOGesFurvuR+kE/ELgfXQCH+Bm4FvAbRExFBGfj4jxuqpx\n1yPNFsNdtRURhwBX0QnUtRHxz/Z5fC2dEct7Mv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IgX+v1yu6onw10a25XAh8pe\nhDQVhrv6XkSsiojNETE/IhZ1f2nKCZn5fTq/d0CqnVIuPyBVSWYORsTXgcuBBXQue9DPlxpWAxju\nUsdlwEZgJ51rd0i15lhG6jgCWAQcQmf3PsKLL6mWDHep4xrgPwPrgc/33O8vylAtOZZR34uI84Bf\nZuZt3csN3xsR7wbWAm8FDulemvo/ZOZ3ylyrNFFe8leSGsixjCQ1kOEuSQ1kuEtSAxnuktRAhrsk\nNZDhLkkNZLhLUgMZ7pLUQP8f0rP1wS7o3r4AAAAASUVORK5CYII=\n", + "text/plain": [ + "<matplotlib.figure.Figure at 0x7fc740383550>" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "from __future__ import division\n", + "%matplotlib inline\n", + "from matplotlib.pyplot import plot,title,xlabel,ylabel,show\n", + "#the equations are:\n", + "#3*x1 + 2*x2=18 and -x1 + 2*x2=2\n", + "\n", + "#equation 1 becomes,\n", + "#x2=-(3/2)*x1 + 9\n", + "#equation 2 becomes,\n", + "#x2=-(1/2)*x1 + 1\n", + "\n", + "#plotting equation 1\n", + "x2=[0]\n", + "for x1 in range(1,7):\n", + " x2.append(-(3/2)*x1 + 9)\n", + "\n", + "x1=[1, 2, 3, 4, 5, 6]\n", + "#plotting equation 2\n", + "x4=[0]\n", + "for x3 in range(1,7):\n", + " x4.append((1/2)*x3 + 1)\n", + "\n", + "x3=[1, 2, 3, 4, 5, 6]\n", + "plot(x1,x2[1:])\n", + "plot(x3,x4[1:])\n", + "title(\"x2 vs x1\")\n", + "xlabel(\"x1\")\n", + "ylabel(\"x2\")\n", + "#the lines meet at x1=4 amd x2=3\n", + "print \"The lines meet at=x2=\",3,\"and x1=\",4" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.2 Pg: 244" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The value of determinant for system repesented in fig 9.1 = 8.0\n", + "The value of determinant for system repesented in fig 9.2 (a) = 0.0\n", + "The value of determinant for system repesented in fig 9.2 (b) = 0.0\n", + "The value of determinant for system repesented in fig 9.2 (c) = -0.04\n" + ] + } + ], + "source": [ + "from numpy.linalg import det\n", + "from numpy import mat\n", + "#For fig9.1\n", + "a=mat([[3, 2],[-1, 2]])\n", + "print \"The value of determinant for system repesented in fig 9.1 =\",det(a)\n", + "#For fig9.2 (a)\n", + "a=mat([[-0.5, 1],[-0.5, 1]])\n", + "print \"The value of determinant for system repesented in fig 9.2 (a) =\",det(a)\n", + "#For fig9.2 (b)\n", + "a=mat([[-0.5, 1],[-1, 2]])\n", + "print \"The value of determinant for system repesented in fig 9.2 (b) =\",det(a)\n", + "#For fig9.2 (c)\n", + "a=mat([[-0.5, 1],[-2.3/5, 1]])\n", + "print \"The value of determinant for system repesented in fig 9.2 (c) =\",det(a)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.3 Pg: 245" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The values are:\n", + "x1= -14.9\n", + "x2= -29.5\n", + "x3= 19.8\n" + ] + } + ], + "source": [ + "from numpy import mat\n", + "from numpy.linalg import det\n", + "#the matrix or the system\n", + "b1=-0.01#\n", + "b2=0.67#\n", + "b3=-0.44#\n", + "a=mat([[0.3, 0.52, 1],[0.5, 1, 1.9],[0.1, 0.3, 0.5]])\n", + "a1=mat([[a[1,1], a[1,2]],[a[2,1], a[2,2]]])\n", + "A1=det(a1)\n", + "a2=mat([[a[1,0], a[1,2]],[a[2,0], a[2,2]]])\n", + "A2=det(a2)\n", + "a3=mat([[a[1,0], a[1,1]],[a[2,0], a[2,1]]])\n", + "A3=det(a3)\n", + "D=a[0,0]*A1-a[0,1]*A2+a[0,2]*A3\n", + "p=mat([[b1, 0.52, 1],[b2, 1, 1.9],[b3, 0.3, 0.5]])\n", + "q=mat([[0.3, b1, 1],[0.5, b2, 1.9],[0.1, b3, 0.5]])\n", + "r=mat([[0.3, 0.52, b1],[0.5, 1, b2],[0.1 ,0.3, b3]])\n", + "x1=det(p)/D#\n", + "x2=det(q)/D#\n", + "x3=det(r)/D#\n", + "print \"The values are:\"\n", + "print \"x1=\",x1\n", + "print \"x2=\",x2\n", + "print \"x3=\",x3" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.4 Pg: 246" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x1= 4.0\n", + "x2= 3.0\n" + ] + } + ], + "source": [ + "#the equations are:\n", + "#3*x1+2*x2=18\n", + "#-x1+2*x2=2\n", + "a11=3#\n", + "a12=2#\n", + "b1=18#\n", + "a21=-1#\n", + "a22=2#\n", + "b2=2#\n", + "x1=(b1*a22-a12*b2)/(a11*a22-a12*a21)#\n", + "x2=(b2*a11-a21*b1)/(a11*a22-a12*a21)#\n", + "print \"x1=\",x1\n", + "print \"x2=\",x2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.5 Pg: 251" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x1= 2.61666666667\n", + "x2= -2.79319371728\n", + "x3= 7.0\n" + ] + } + ], + "source": [ + "from numpy import arange\n", + "\n", + "n=3#\n", + "b=[7.85,-19.3,71.4] # ################################\n", + "a=mat([[3, -0.1, -0.2],[0.1, 7, -0.3],[0.3, -0.2, 10]])\n", + "for k in range(1,n):\n", + " for i in range(k+1,n+1):\n", + " fact=a[i-1,k-1]/a[k-1,k-1]\n", + " for j in range(k+1,n+1):\n", + " a[i-1,j-1]=a[i-1,j-1]-fact*(a[k-1,j-1])\n", + " \n", + " b[(i-1)]=b[(i-1)]-fact*b[(k-1)]\n", + " \n", + "x=[0,0,b[(n-1)]/a[n-1,n-1]]\n", + "for i in arange(n-1,0,-1):\n", + " s=b[i-1]#\n", + " for j in range(i+1,n+1):\n", + " s=s-a[i-1,j-1]*x[j-1]\n", + " \n", + " x[i-1]=b[i-1]/a[i-1,i-1]\n", + "\n", + "print \"x1=\",x[0]\n", + "print \"x2=\",x[1]\n", + "print \"x3=\",x[2]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.6 Pg:255" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "For the original system:\n", + "x1= 4.0\n", + "x2= 3.0\n", + "For the new system:\n", + "x1= 8.0\n", + "x2= 1.0\n" + ] + } + ], + "source": [ + "a11=1#\n", + "a12=2#\n", + "b1=10#\n", + "a21=1.1#\n", + "a22=2#\n", + "b2=10.4#\n", + "x1=(b1*a22-a12*b2)/(a11*a22-a12*a21)#\n", + "x2=(b2*a11-a21*b1)/(a11*a22-a12*a21)#\n", + "print \"For the original system:\"\n", + "print \"x1=\",x1\n", + "print \"x2=\",x2\n", + "a21=1.05#\n", + "x1=(b1*a22-a12*b2)/(a11*a22-a12*a21)#\n", + "x2=(b2*a11-a21*b1)/(a11*a22-a12*a21)#\n", + "print \"For the new system:\"\n", + "print \"x1=\",x1\n", + "print \"x2=\",x2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.7 Pg: 257" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The determinant for part(a)= 8.0\n", + "The determinant for part(b)= -0.2\n", + "The determinant for part(c)= -20.0\n" + ] + } + ], + "source": [ + "from numpy.linalg import det\n", + "from numpy import mat\n", + "#part a\n", + "a=mat([[3, 2],[-1, 2]])\n", + "b1=18#\n", + "b2=2#\n", + "print \"The determinant for part(a)=\",det(a)\n", + "#part b\n", + "a=mat([[1, 2],[1.1, 2]])\n", + "b1=10\n", + "b2=10.4#\n", + "print \"The determinant for part(b)=\",det(a)\n", + "#part c\n", + "a1=a*10#\n", + "b1=100#\n", + "b2=104#\n", + "print \"The determinant for part(c)=\",det(a1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.8 Pg: 258" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "The determinant for part(a)= 1.3335\n", + "The determinant for part(b)= -0.05\n", + "The determinant for part(c)= -0.05\n" + ] + } + ], + "source": [ + "from numpy.linalg import det\n", + "from numpy import mat\n", + "#part a\n", + "a=mat([[1, 0.667],[-0.5, 1]])\n", + "b1=6#\n", + "b2=1#\n", + "print \"The determinant for part(a)=\",det(a)\n", + "#part b\n", + "a=mat([[0.5, 1],[0.55, 1]])\n", + "b1=5\n", + "b2=5.2\n", + "print \"The determinant for part(b)=\",det(a)\n", + "#part c\n", + "b1=5#\n", + "b2=5.2#\n", + "print \"The determinant for part(c)=\",det(a)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.9 Pg: 260" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x2 = 0.666666666667\n", + "x1 = 0.333333333334\n", + "The error varies depending on the no. of significant figures used\n" + ] + } + ], + "source": [ + "#0.0003*x1 + 3*x2 = 2.0001\n", + "#1*x1 + 1*x2 = 1\n", + "a11 = 0.000#\n", + "#multiplying first equation by 1/0.0003, we get, x1 + 10000*x2 = 6667\n", + "x2 = (6667-1)/(10000-1)#\n", + "x1 = 6667 - 10000*x2#\n", + "print \"x2 = \",x2\n", + "print \"x1 = \",x1\n", + "print \"The error varies depending on the no. of significant figures used\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.10 Pg: 262" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "without scaling, applying forward elimination\n", + "x2 = 1.0\n", + "x1 = 0\n", + "error for x1 = 100.0\n", + "with scaling\n", + "x1 = 1\n", + "x2 = 1\n", + "pivot and retaining original coefficients\n", + "x1 = 1\n", + "x2 = 1.0\n" + ] + } + ], + "source": [ + "from __future__ import division\n", + "#2*x1 + 10000*x2 = 10000\n", + "#x1 + x2 = 2\n", + "x1 = 1#\n", + "x2 = 1#\n", + "print \"without scaling, applying forward elimination\"\n", + "#x1 is too small and can be neglected\n", + "x21 = 10000/10000#\n", + "x11 = 0#\n", + "e1 = (x1 - x11)*100/x1#\n", + "print \"x2 = \",x21\n", + "print \"x1 = \",x11\n", + "print \"error for x1 = \",e1\n", + "print \"with scaling\"\n", + "#0.00002*x1 + x2 = 1\n", + "#now x1 is neglected because of the co efficient\n", + "x22 = 1#\n", + "x12 = 2 - x1#\n", + "print \"x1 = \",x12\n", + "print \"x2 = \",x22\n", + "#using original co efficient\n", + "#x1 can be neglected\n", + "print \"pivot and retaining original coefficients\"\n", + "x22 = 10000/10000#\n", + "x12 = 2 - x1#\n", + "print \"x1 = \",x12\n", + "print \"x2 = \",x22" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.11 Pg: 265" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "a= 8.59411764706 m/s**2\n", + "T= 34.4117647059 N\n", + "R= 36.7647058824 N\n" + ] + } + ], + "source": [ + "from numpy import mat\n", + "from numpy.linalg import solve\n", + "a=mat([[70, 1, 0],[60, -1, 1],[40, 0, -1]])\n", + "b=mat([[636],[518],[307]])\n", + "x=abs(solve(a,b))\n", + "print \"a=\",x[0,0],\"m/s**2\"\n", + "print \"T=\",x[1,0],\"N\"\n", + "print \"R=\",x[2,0],\"N\"\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:9.12 Pg: 269" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Equation in matrix form can be written as : \n", + "[[ 3. -0.1 -0.2 7.85]\n", + " [ 0.1 7. -0.3 -19.3 ]\n", + " [ 0.3 -0.2 10. 71.4 ]]\n", + "final matrix = \n", + "[[ 1. 0. 0. 3. ]\n", + " [ 0. 1. 0. -2.5]\n", + " [ 0. 0. 1. 7. ]]\n", + "\n", + "x1 = 3.0\n", + "x2 = -2.5\n", + "x3 = 7.0\n" + ] + } + ], + "source": [ + "from numpy import mat,vstack\n", + "from numpy.linalg import det\n", + "#3*x1 - 0.1*x2 - 0.2*x3 = 7.85\n", + "#0.1*x1 + 7*x2 - 0.3*x3 = -19.3\n", + "#0.3*x1 - 0.2*x2 + 10*x3 = 71.4\n", + "# this can be written in matrix form as\n", + "A = mat([[3,-0.1,-0.2,7.85],[0.1,7,-0.3,-19.3],[0.3,-0.2,10,71.4]])\n", + "print \"Equation in matrix form can be written as : \\n\",A\n", + "X = A[0:1] / (A[0,0])#\n", + "Y = A[1:2] - 0.1*X#\n", + "Z = A[2:3] - 0.3*X#\n", + "\n", + "Y = Y/(Y[0,1])\n", + "X = X - Y * (X[0,1])\n", + "Z = Z - Y * (Z[0,1])#\n", + "Z = Z/(Z[0,2])#\n", + "X = X - Z*(X[0,2])#\n", + "Y = Y - Z*(Y[0,2])#\n", + "A = vstack((X,Y,Z))\n", + "print \"final matrix = \\n\",A\n", + "print \"\\nx1 = \",A[0,3]\n", + "print \"x2 = \",A[1,3]\n", + "print \"x3 = \",A[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.9" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch14PathOfAscent.png b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch14PathOfAscent.png Binary files differnew file mode 100644 index 00000000..f4f76738 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch14PathOfAscent.png diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch14RandomNumberGenerator.png b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch14RandomNumberGenerator.png Binary files differnew file mode 100644 index 00000000..de7353a3 --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch14RandomNumberGenerator.png diff --git a/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch26EulerMethod.png b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch26EulerMethod.png Binary files differnew file mode 100644 index 00000000..0bf7e18d --- /dev/null +++ b/Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch26EulerMethod.png diff --git a/sample_notebooks/testingtesting/fameetha.ipynb b/sample_notebooks/testingtesting/fameetha.ipynb new file mode 100644 index 00000000..70f5ad4b --- /dev/null +++ b/sample_notebooks/testingtesting/fameetha.ipynb @@ -0,0 +1,87 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 7:Starting And Speed Control Of Induction Motor " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 7.1,Page 7-6" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x= 0.7453\n", + "Thus 74.53 % tapping is required\n", + "Ist= 3.33 IF.L\n", + "Thus supply starting current is 3.33 times the full load current\n" + ] + } + ], + "source": [ + "import math\n", + "\n", + "#variable declaration\n", + "Isc=6 # starting current at rated voltage(amp)\n", + "Sf=5 # full load slip\n", + "Tfl=Tst=1 # full load torque=starting torque(N-m)\n", + "Ifl=1 # full load current(amp)\n", + "\n", + "#calculation\n", + "x=math.sqrt((Tst/Tfl) * ((float(Ifl)/float(Isc))**2)*(1/(float(Sf)/100)))\n", + "print 'x=',str (x)[:6]\n", + "print 'Thus',str(x*100)[:5],'% tapping is required'\n", + "\n", + "#Ist(supply)=x**2 * 6\n", + "Ist=(x**2) * Isc # supply starting current(IF.L)\n", + "Ist=round(Ist,2)\n", + "print 'Ist=',Ist,'IF.L'\n", + "print 'Thus supply starting current is',Ist,'times the full load current'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "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.6" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} |