summaryrefslogtreecommitdiff
path: root/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter24_1.ipynb
diff options
context:
space:
mode:
authorTrupti Kini2016-06-17 23:30:26 +0600
committerTrupti Kini2016-06-17 23:30:26 +0600
commitfbe366f4f4e49899794544dffa7f5974bee7f80d (patch)
tree26ff8b8810b9771810bc0097e995b92d92aa94d2 /Higher_Engineering_Mathematics_by_B._S._Grewal/chapter24_1.ipynb
parent64a90b1b4fe1e8c57650c8a4b32d76cb94adc085 (diff)
downloadPython-Textbook-Companions-fbe366f4f4e49899794544dffa7f5974bee7f80d.tar.gz
Python-Textbook-Companions-fbe366f4f4e49899794544dffa7f5974bee7f80d.tar.bz2
Python-Textbook-Companions-fbe366f4f4e49899794544dffa7f5974bee7f80d.zip
Added(A)/Deleted(D) following books
A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap10_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap11_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap12_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap13_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap16_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap17_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap18_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap19_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap20_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap21_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap22_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap23_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap24_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap25_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap26_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap27_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap28_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap29_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap30_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap31_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap32_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap33_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap34_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap3_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap5_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap7_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap8_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/Chap9_1.ipynb A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/screenshots/Ch28Capacitance_1.png A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/screenshots/Ch28OpFreq_1.png A A_Textbook_of_Electronic_Circuits_by_R._S._Sedha/screenshots/Ch28VoltageGain_1.png A Electronics_Circuits_and_Systems_by_Y._N._Bapat/README.txt A Engineering_Mechanics_of_Solids_by_Popov_E_P/Chapter1_6.ipynb A Engineering_Mechanics_of_Solids_by_Popov_E_P/chapter10_6.ipynb A Engineering_Mechanics_of_Solids_by_Popov_E_P/chapter11_6.ipynb A Engineering_Mechanics_of_Solids_by_Popov_E_P/chapter12_6.ipynb A Engineering_Mechanics_of_Solids_by_Popov_E_P/chapter13_5.ipynb A Engineering_Mechanics_of_Solids_by_Popov_E_P/chapter2_6.ipynb A Engineering_Mechanics_of_Solids_by_Popov_E_P/chapter4_6.ipynb A Engineering_Mechanics_of_Solids_by_Popov_E_P/chapter5_6.ipynb A Engineering_Mechanics_of_Solids_by_Popov_E_P/chapter6_6.ipynb A Engineering_Mechanics_of_Solids_by_Popov_E_P/chapter7_6.ipynb A Engineering_Mechanics_of_Solids_by_Popov_E_P/chapter8_6.ipynb A Engineering_Mechanics_of_Solids_by_Popov_E_P/chapter9_6.ipynb A Engineering_Mechanics_of_Solids_by_Popov_E_P/charpter_3_7.ipynb A Engineering_Mechanics_of_Solids_by_Popov_E_P/screenshots/1_4.PNG A Engineering_Mechanics_of_Solids_by_Popov_E_P/screenshots/2_4.PNG A Engineering_Mechanics_of_Solids_by_Popov_E_P/screenshots/3_4.PNG M Fluid_Flow_For_The_Practicing_Chemical_Engineer_by_J._P._Abulencia_And_L._Theodore/Chapter-27.ipynb M Fluid_Flow_For_The_Practicing_Chemical_Engineer_by_J._P._Abulencia_And_L._Theodore/Chapter-27_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter10_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter13_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter1_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter21_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter22_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter23_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter24_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter26_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter27_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter28_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter2_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter34_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter35_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter4_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter5_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter6_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/chapter9_1.ipynb A Higher_Engineering_Mathematics_by_B._S._Grewal/screenshots/screen1_1.png A Higher_Engineering_Mathematics_by_B._S._Grewal/screenshots/screen2_1.png A Higher_Engineering_Mathematics_by_B._S._Grewal/screenshots/screen3_1.png A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter10_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter11_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter13_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter14_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter15_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter17_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter18_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter19_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter1_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter21_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter22_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter23_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter25_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter26_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter3_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter4_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter5_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter6_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter7_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/Chapter9_1.ipynb A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch14PathOfAscent_1.png A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch14RandomNumberGenerator_1.png A Numerical_Methods_For_Engineers_by_S._C._Chapra_And_R._P._Canale/screenshots/Ch26EulerMethod_1.png A "sample_notebooks/GundlaKeerthi vani/J.B.Gupta_Chapter_6_(1).ipynb"
Diffstat (limited to 'Higher_Engineering_Mathematics_by_B._S._Grewal/chapter24_1.ipynb')
-rw-r--r--Higher_Engineering_Mathematics_by_B._S._Grewal/chapter24_1.ipynb331
1 files changed, 331 insertions, 0 deletions
diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter24_1.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter24_1.ipynb
new file mode 100644
index 00000000..9dd44a2c
--- /dev/null
+++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter24_1.ipynb
@@ -0,0 +1,331 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 24: Numerical Methods"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "collapsed": true
+ },
+ "source": [
+ "## Example 24.1, page no. 636"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Finding roots of this equation by bisection method\n",
+ "f(2) is -ve and f(3) is +ve so root lies between 2 and 3\n",
+ "The root is: 2.6875\n"
+ ]
+ }
+ ],
+ "source": [
+ "import numpy\n",
+ "\n",
+ "x = numpy.poly([0])\n",
+ "p = x**3-4*x-9\n",
+ "print \"Finding roots of this equation by bisection method\"\n",
+ "print 'f(2) is -ve and f(3) is +ve so root lies between 2 and 3'\n",
+ "l = 2.\n",
+ "m = 3.\n",
+ "def f(x):\n",
+ " y = x**3-4*x-9\n",
+ " return y\n",
+ "for i in range(1,5):\n",
+ " k = 1.0/2.*(l+m)\n",
+ " if(f(k)<0):\n",
+ " l = k\n",
+ " else:\n",
+ " m = k\n",
+ "print \"The root is: \", k"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "collapsed": true
+ },
+ "source": [
+ "## Example 24.3, page no. 638"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "f(x)=xeˆx−cos(x)\n",
+ "We are required to find the roots of f(x) by the method of false position \n",
+ "f(0)=−ve and f(1)=+ve so s root lie between 0 and 1 \n",
+ "finding the roots by false position method \n",
+ "The root of the equation is :\n",
+ "0.517747878322\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "print \"f(x)=xeˆx−cos(x)\"\n",
+ "def f(x):\n",
+ " y = x*math.e**(x)-math.cos(x)\n",
+ " return y\n",
+ "print \"We are required to find the roots of f(x) by the method of false position \"\n",
+ "print \"f(0)=−ve and f(1)=+ve so s root lie between 0 and 1 \"\n",
+ "print \"finding the roots by false position method \"\n",
+ "l = 0.0\n",
+ "m = 1.0\n",
+ "for i in range(1,11):\n",
+ " k = l-(m-l)*f(l)/(f(m)-f(l))\n",
+ " if(f(k)<0):\n",
+ " l = k\n",
+ " else:\n",
+ " m = k\n",
+ "print \"The root of the equation is :\"\n",
+ "print k"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 24.4, page no. 638"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "f(x) = x∗math.log(x)−1.2\n",
+ "We are required to find the roots of f(x) by the method of false position \n",
+ "f(2)=−ve and f(3)=+ve so s root lie between 2 and 3 \n",
+ "finding the roots by false position method \n",
+ "The root of the equation is : 2.74063625664\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math\n",
+ "\n",
+ "print \"f(x) = x∗math.log(x)−1.2\"\n",
+ "def f(x):\n",
+ " y = x*math.log10(x)-1.2\n",
+ " return y\n",
+ "print \"We are required to find the roots of f(x) by the method of false position \"\n",
+ "print \"f(2)=−ve and f(3)=+ve so s root lie between 2 and 3 \"\n",
+ "print \"finding the roots by false position method \"\n",
+ "l = 2.\n",
+ "m = 3.\n",
+ "for i in range(1,4):\n",
+ " k = l-(m-l)*f(l)/(f(m)-f(l))\n",
+ " if(f(k)<0):\n",
+ " l = k\n",
+ " else:\n",
+ " m = k\n",
+ "print \"The root of the equation is : \",k"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 24.5, page no. 639"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "To find the roots of f(x) = 3x−cos(x)−1 by newtons method \n",
+ "f(0)=−ve and f(1) is +ve so a root lies between 0 and 1 \n",
+ "Let us take x0 =0.6 as the root is closer to 1 \n",
+ "Root is given by r=x0−f(xn)/der(f(xn))\n",
+ "Approximated root in each steps are \n",
+ "0.607290551153\n",
+ "0.607096741973\n",
+ "0.607101775605\n"
+ ]
+ }
+ ],
+ "source": [
+ "import math,numpy\n",
+ "from scipy.misc import derivative\n",
+ "\n",
+ "print \"To find the roots of f(x) = 3x−cos(x)−1 by newtons method \"\n",
+ "print \"f(0)=−ve and f(1) is +ve so a root lies between 0 and 1 \"\n",
+ "l = 0\n",
+ "m = 1\n",
+ "def f(x):\n",
+ " y = 3*x-math.cos(x)-1\n",
+ " return y\n",
+ "x0 = 0.6\n",
+ "print \"Let us take x0 =0.6 as the root is closer to 1 \"\n",
+ "print \"Root is given by r=x0−f(xn)/der(f(xn))\"\n",
+ "print \"Approximated root in each steps are \"\n",
+ "for i in range(1,4):\n",
+ " k = x0-f(x0)/derivative(f,x0)\n",
+ " print k\n",
+ " x0 = k"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 24.6, page no. 640"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "To find square root of 28 by newtons method let x=sqrt(28) ie xˆ2−28=0 \n",
+ "To find the roots by newtons method\n",
+ "f(5)=−ve and f(6) is +ve so a root lies between 5 and 6 \n",
+ "Let us take x0 = 5.5 \n",
+ "Root is given by rn=xn−f(xn)/der(f(xn))\n",
+ "Approximated root in each steps are\n",
+ "5.29545454545\n",
+ "5.29150409676\n",
+ "5.29150262213\n",
+ "5.29150262213\n"
+ ]
+ }
+ ],
+ "source": [
+ "from scipy.misc import derivative\n",
+ "\n",
+ "print \"To find square root of 28 by newtons method let x=sqrt(28) ie xˆ2−28=0 \"\n",
+ "def f(x):\n",
+ " y = x**2-28\n",
+ " return y\n",
+ "print \"To find the roots by newtons method\"\n",
+ "print \"f(5)=−ve and f(6) is +ve so a root lies between 5 and 6 \"\n",
+ "l = 5\n",
+ "m = 6\n",
+ "print \"Let us take x0 = 5.5 \"\n",
+ "print \"Root is given by rn=xn−f(xn)/der(f(xn))\"\n",
+ "print \"Approximated root in each steps are\"\n",
+ "x0 = 5.5\n",
+ "for i in range(1,5):\n",
+ " k = x0-f(x0)/derivative(f,x0)\n",
+ " print k\n",
+ " x0 = k"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Example 24.7, page no. 641"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "To find square root of 28 by newtons method let x=sqrt(28) ie xˆ2−28=0 \n",
+ "To find the roots by newtons method\n",
+ "f(5)=−ve and f(6) is +ve so a root lies between 5 and 6 \n",
+ "Let us take x0 = 5.5 \n",
+ "Root is given by rn=xn−f(xn)/der(f(xn))\n",
+ "Approximated root in each steps are\n",
+ "5.29545454545\n",
+ "5.29150409676\n",
+ "5.29150262213\n",
+ "5.29150262213\n"
+ ]
+ }
+ ],
+ "source": [
+ "from scipy.misc import derivative\n",
+ "\n",
+ "print \"To find square root of 28 by newtons method let x=sqrt(28) ie xˆ2−28=0 \"\n",
+ "def f(x):\n",
+ " y = x**2-28\n",
+ " return y\n",
+ "print \"To find the roots by newtons method\"\n",
+ "print \"f(5)=−ve and f(6) is +ve so a root lies between 5 and 6 \"\n",
+ "l = 5\n",
+ "m = 6\n",
+ "print \"Let us take x0 = 5.5 \"\n",
+ "print \"Root is given by rn=xn−f(xn)/der(f(xn))\"\n",
+ "print \"Approximated root in each steps are\"\n",
+ "x0 = 5.5\n",
+ "for i in range(1,5):\n",
+ " k = x0-f(x0)/derivative(f,x0)\n",
+ " print k\n",
+ " x0 = k"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.10"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}