{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 9 : Infinite Series" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.1, page no. 302" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1/3\n" ] } ], "source": [ "import numpy,sympy\n", "\n", "n = sympy.Symbol('n')\n", "f = ((1/n)**2-2*(1/n))/(3*(1/n)**2+(1/n))\n", "print sympy.limit(f,n,0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.1.3, page no. 303" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "4\n" ] } ], "source": [ "import sympy\n", "n = sympy.Symbol('n')\n", "f = 3+(-1)**n\n", "print sympy.limit(f,n,100)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.2.1, page no. 304" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1+2+3+4+5+6+7+....+n + . . . . . = oo\n" ] } ], "source": [ "import numpy,sympy\n", "\n", "n = sympy.Symbol('n')\n", "print \"1+2+3+4+5+6+7+....+n + . . . . . = \",\n", "p = 1/n*(1/n+1)/2\n", "print sympy.limit(p,n,0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.2.2, page no. 304" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "5−4−1+5−4−1+5−4−1+5−4−1+.........=0,5,1 according to the no. of terms.\n", "clearly, in this case sum doesnt tend to a unique limit. hence, series is oscillatory.\n" ] } ], "source": [ "print \"5−4−1+5−4−1+5−4−1+5−4−1+.........=0,5,1 according to the no. of terms.\"\n", "print \"clearly, in this case sum doesnt tend to a unique limit. hence, series is oscillatory.\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.5.1, page no. 308" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2\n", "both u and v converge and diverge together, hence u is convergent\n" ] } ], "source": [ "import numpy,sympy\n", "\n", "n = sympy.Symbol('n')\n", "v = 1/((1/n)**2)\n", "u = (2/n-1)/(1/n*(1/n +1)*(1/n +2))\n", "print sympy.limit(u/v,n,0)\n", "print \"both u and v converge and diverge together, hence u is convergent\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.5.2, page no. 308" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "oo\n", "both u and v converge and diverge together, hence u is divergent\n" ] } ], "source": [ "import numpy,sympy\n", "\n", "n = sympy.Symbol('n')\n", "v = 1/((1/n)**2)\n", "u = ((1/n)**2)/((3/n+1)*(3/n+4)*(3/n+7))\n", "print sympy.limit(u/v,n,0)\n", "print \"both u and v converge and diverge together, hence u is divergent\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.7.1, page no. 312" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "u=((n+1)^0.5−1)/((n+2)^3−1)=>\n", "0\n", "since, v is convergent, so u is also conzavergent.\n" ] } ], "source": [ "import numpy,sympy\n", "\n", "n = sympy.Symbol('n')\n", "print \"u=((n+1)^0.5−1)/((n+2)^3−1)=>\"\n", "u = ((1+1/(1/n))-(1/n)**(-0.5))/(((1/n)**5/2)*((1+2/(1/n))**3-(1/n)**(-3)))\n", "v = (1/n)**(-5/2)\n", "print sympy.limit(u/v,n,0)\n", "print 'since, v is convergent, so u is also conzavergent.'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.7.3, page no. 313" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "-log(log(2)) + +inf\n" ] } ], "source": [ "import numpy,sympy\n", "\n", "n = sympy.Symbol('n')\n", "print sympy.integrate(1/(n*sympy.log(n)),(n,2,numpy.inf))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.8.1, page no. 314" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "x**(-2)\n" ] } ], "source": [ "import numpy,sympy\n", "\n", "n = sympy.Symbol('n')\n", "x = sympy.Symbol('x')\n", "u = (x**(2*(1/n)-2))/(((1/n)+1)*(1/n)**0.5)\n", "v = (x**(2*(1/n)))/((1/n+2)*(1/n+1)**0.5)\n", "print sympy.limit(u/v,n,0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.8.2, page no. 314" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1/x\n" ] } ], "source": [ "import numpy,sympy\n", "\n", "n = sympy.Symbol('n')\n", "x = sympy.Symbol('x')\n", "u = ((2**(1/n)-2)*(x**(1/n-1)))/(2**(1/n)+1)\n", "v = ((2**((1/n)+1)-2)*(x**(1/n)))/(2**(1/n+1)+1)\n", "print sympy.limit(u/v,n,0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.10.1, page no. 316" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(x + 1)/(2*x)\n" ] } ], "source": [ "import numpy,sympy\n", "\n", "n = sympy.Symbol('n')\n", "x = sympy.Symbol('x')\n", "u = 1/(1+x**(-n))\n", "v = 1/(1+x**(-n-1))\n", "print sympy.limit(u/v,n,0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.10.2, page no. 316" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1\n" ] } ], "source": [ "import numpy,sympy\n", "\n", "n = sympy.Symbol('n')\n", "a = sympy.Symbol('a')\n", "b = sympy.Symbol('b')\n", "l = (b+1/n)/(a+1/n)\n", "print sympy.limit(l,n,0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.11.1, page no. 317" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "u=((4.7....(3n+1))∗xˆn)/(1.2.....n)\n", "v=((4.7....(3n+4)∗xˆ(n+1))/(1.2.....(n+1))\n", "l=u/v=> 1/(3*x)\n" ] } ], "source": [ "import numpy,sympy\n", "\n", "n = sympy.Symbol('n')\n", "x = sympy.Symbol('x')\n", "print \"u=((4.7....(3n+1))∗xˆn)/(1.2.....n)\"\n", "print \"v=((4.7....(3n+4)∗xˆ(n+1))/(1.2.....(n+1))\"\n", "print \"l=u/v=>\",\n", "l = (1+n)/((3+4*n)*x)\n", "print sympy.limit(l,n,0)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 9.11.2, page no. 318" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "4/x**2\n" ] } ], "source": [ "import numpy,sympy,math\n", "\n", "n = sympy.Symbol('n')\n", "x = sympy.Symbol('x')\n", "u = (((sympy.factorial(n))**2)*x**(2*n))/sympy.factorial(2*n)\n", "v = (((sympy.factorial(n+1))**2)*x**(2*(n+1)))/sympy.factorial(2*(n+1))\n", "print sympy.limit(u/v,n,numpy.inf )" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.10" } }, "nbformat": 4, "nbformat_minor": 0 }