diff options
Diffstat (limited to 'Higher_Engineering_Mathematics_by_B._S._Grewal/chapter22.ipynb')
-rw-r--r-- | Higher_Engineering_Mathematics_by_B._S._Grewal/chapter22.ipynb | 244 |
1 files changed, 244 insertions, 0 deletions
diff --git a/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter22.ipynb b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter22.ipynb new file mode 100644 index 00000000..d3d7419e --- /dev/null +++ b/Higher_Engineering_Mathematics_by_B._S._Grewal/chapter22.ipynb @@ -0,0 +1,244 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 22 : Integral Transform" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22.1, page no. 608" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the fourier sin integral\n", + "0.636619772367581*Integral(sin(t*u), (t, 0, oo))*Integral(sin(u*x), (u, 0, oo))\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"To find the fourier sin integral\"\n", + "x = sympy.Symbol('x')\n", + "t = sympy.Symbol('t')\n", + "u = sympy.Symbol('u')\n", + "fs = 2/math.pi*sympy.integrate(sympy.sin(u*x),(u,0,sympy.oo))*(sympy.integrate(x**0*sympy.sin(u*t),(t,0,sympy.oo)))\n", + "print fs" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22.2, page no. 608" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the fourier transform of given function\n", + "Piecewise((2, s == 0), (1.0*I*exp(-1.0*I*s)/s - 1.0*I*exp(1.0*I*s)/s, True))\n", + "pi/2\n" + ] + } + ], + "source": [ + "import sympy\n", + "\n", + "print \"To find the fourier transform of given function\"\n", + "x = sympy.Symbol('x')\n", + "s = sympy.Symbol('s')\n", + "F = sympy.integrate(sympy.exp(1j*s*x),(x,-1,1))\n", + "print F\n", + "F1 = sympy.integrate(sympy.sin(x)/x,(x,0,sympy.oo))\n", + "print F1" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "## Example 22.3, page no. 609" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the fourier transform of given function\n", + "Piecewise((4/3, s**6 == 0), ((-2.0*s**4 - 2.0*I*s**3)*exp(1.0*I*s)/s**6 - (2.0*s**4 - 2.0*I*s**3)*exp(-1.0*I*s)/s**6, True))\n", + "Integral((x*cos(x) - sin(x))*cos(x/2)/x**3, (x, 0, +inf))\n" + ] + } + ], + "source": [ + "import sympy,numpy\n", + "\n", + "print \"To find the fourier transform of given function\"\n", + "x = sympy.Symbol('x')\n", + "s = sympy.Symbol('s')\n", + "F = sympy.integrate(sympy.exp(1j*s*x)*(1-x**2),(x,-1,1))\n", + "print F\n", + "F1 = sympy.integrals.Integral((x*sympy.cos(x)-sympy.sin(x))/x**3*sympy.cos(x/2),(x,0,numpy.inf))\n", + "print F1" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22.4, page no. 610" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "To find the fourier sin integral\n", + "Piecewise((s/(s**2 + 1), Abs(periodic_argument(polar_lift(s)**2, oo)) == 0), (Integral(exp(-x)*sin(s*x), (x, 0, oo)), True))\n", + "Piecewise((sqrt(pi)*(-sqrt(pi)*sinh(m) + sqrt(pi)*cosh(m))/2, Abs(periodic_argument(polar_lift(m)**2, oo)) == 0), (Integral(x*sin(m*x)/(x**2 + 1), (x, 0, oo)), True))\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"To find the fourier sin integral\"\n", + "x = sympy.Symbol('x')\n", + "s = sympy.Symbol('s')\n", + "m = sympy.Symbol('m')\n", + "fs = sympy.integrate(sympy.sin(s*x)*sympy.exp(-x),(x,0,sympy.oo))\n", + "print fs\n", + "f = sympy.integrate(x*sympy.sin(m*x)/(1+x**2),(x,0,sympy.oo))\n", + "print f" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22.5, page no. 611" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Fourier cosine transform.\n", + "Piecewise((1/2, s == 0), (-sin(s)/s + cos(s)/s**2 - cos(2*s)/s**2, True)) + Piecewise((1/2, s == 0), (sin(s)/s + cos(s)/s**2 - 1/s**2, True))\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"Fourier cosine transform.\"\n", + "x = sympy.Symbol('x')\n", + "s = sympy.Symbol('s')\n", + "f = sympy.integrate(x*sympy.cos(s*x),(x,0,1))+sympy.integrate((2-x)*sympy.cos(s*x),(x,1,2))\n", + "print f" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Example 22.6, page no. 612" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Fourier cosine transform.\n", + "Piecewise((s*atan(sqrt(s**2/a**2))/(a*sqrt(s**2/a**2)), Or(And(-s**2/a**2 != 1, Abs(periodic_argument(polar_lift(a)**2, oo)) == pi, Abs(periodic_argument(polar_lift(s)**2, oo)) == 0), And(Abs(periodic_argument(polar_lift(a)**2, oo)) < pi, Abs(periodic_argument(polar_lift(s)**2, oo)) == 0))), (Integral(exp(-a*x)*sin(s*x)/x, (x, 0, oo)), True))\n" + ] + } + ], + "source": [ + "import sympy,math\n", + "\n", + "print \"Fourier cosine transform.\"\n", + "x = sympy.Symbol('x')\n", + "s = sympy.Symbol('s')\n", + "a = sympy.Symbol('a')\n", + "f = sympy.integrate(sympy.exp(-a*x)/x*sympy.sin(s*x),(x,0,sympy.oo))\n", + "print f" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 2", + "language": "python", + "name": "python2" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.10" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} |