{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 21 Laplace Transform" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.1.1, page no. 556" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "(12*s/((s**2 + 1)*(s**2 + 25)), 0, True)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "print laplace_transform(sympy.sin(2*t)*sympy.sin(3*t),t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.1.2, page no. 557" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "(sqrt(pi)*(sqrt(2)*sin(s**2/4)*fresnelc(sqrt(2)*s/(2*sqrt(pi))) - sqrt(2)*cos(s**2/4)*fresnels(sqrt(2)*s/(2*sqrt(pi))) + cos(s**2/4 + pi/4))/2, 0, True)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "print laplace_transform(sympy.cos(t**2),t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.1.3, page no. 558" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "((-1)**(1/12)*pi*sqrt(s)*besseli(-1/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 + (-1)**(11/12)*sqrt(3)*pi*sqrt(s)*besseli(1/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 + (-1)**(7/12)*sqrt(3)*pi*sqrt(s)*besseli(5/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 - (-1)**(5/12)*pi*sqrt(s)*besseli(7/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 + (-1)**(1/12)*pi*sqrt(s)*besselj(-1/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 + (-1)**(11/12)*sqrt(3)*pi*sqrt(s)*besselj(1/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 + (-1)**(7/12)*sqrt(3)*pi*sqrt(s)*besselj(5/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 - (-1)**(5/12)*pi*sqrt(s)*besselj(7/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/18 + s**2*hyper((1,), (2/3, 5/6, 7/6, 4/3), -s**6/11664)/6 + (-1)**(1/3)*pi*besseli(2/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/(3*s) - 2*(-1)**(1/6)*sqrt(3)*pi*besseli(4/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/(9*s) - (-1)**(1/3)*pi*besselj(2/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/(3*s) + 2*(-1)**(1/6)*sqrt(3)*pi*besselj(4/3, 2*sqrt(3)*s**(3/2)*exp_polar(I*pi/4)/9)/(9*s), 0, True)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "print laplace_transform((sympy.sin(t**3)),t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.2.1, page no. 560" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "((2*s - 9)/(s**2 + 6*s + 34), -3, True)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = sympy.exp(-3*t)*(2*sympy.cos(5*t)-3*sympy.sin(5*t))\n", "print laplace_transform(f,t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.2.2, page no. 560" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "(2/((s - 3)*((s - 3)**2 + 4)), -oo, Abs(periodic_argument(exp_polar(2*I*pi)*polar_lift(-s + 3)**2, oo)) < pi)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = sympy.exp(3*t)*(sympy.sin(t))**2\n", "print laplace_transform(f,t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.2.3, page no. 561" ] }, { "cell_type": "code", "execution_count": 41, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "InverseLaplaceTransform(exp(4*t)*sin(2*t)*cos(t), t, s, _None)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s\n", "\n", "print 'To find the laplace of given function in t'\n", "f = sympy.exp(4*t)*(sympy.cos(t)*sympy.sin(2*t))\n", "print inverse_laplace_transform(f,t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.4.1, page no. 563" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "(2*a*s/(a**2 + s**2)**2, 0, Abs(periodic_argument(polar_lift(a)**2, oo)) == 0)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = t*sympy.sin(a*t)\n", "print laplace_transform(f,t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.4.2, page no. 564" ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "((-a**2 + s**2)/(a**2 + s**2)**2, 0, Abs(periodic_argument(polar_lift(a)**2, oo)) == 0)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = t*sympy.cos(a*t)\n", "print laplace_transform(f,t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.5, page no. 565" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Piecewise((u/2, s**3*u**2 == 0), (1/(s**2*u) + (-s**2*u**2 - s*u)*exp(-s*u)/(s**3*u**2), True)) + Integral(exp(-s*t), (t, u, oo))\n" ] } ], "source": [ "import sympy\n", "\n", "t = sympy.Symbol('t')\n", "s = sympy.Symbol('s')\n", "u = sympy.Symbol('u')\n", "f = sympy.integrate(sympy.exp(-s*t)*t/u,(t,0,u))+sympy.integrate(sympy.exp(-s*t),(t,u,sympy.oo))\n", "print f" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.7, page no. 566" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "(atan(a/s), 0, Abs(periodic_argument(polar_lift(a)**2, oo)) == 0)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = sympy.sin(a*t)/t\n", "print laplace_transform(f,t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.8.1, page no. 567" ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "((-a**2 + s**2)/(a**2 + s**2)**2, 0, Abs(periodic_argument(polar_lift(a)**2, oo)) == 0)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = t*sympy.cos(a*t)\n", "print laplace_transform(f,t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.8.2, page no. 568" ] }, { "cell_type": "code", "execution_count": 31, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "(2*a*(-a**2 + 3*s**2)/(a**2 + s**2)**3, 0, Abs(periodic_argument(polar_lift(a)**2, oo)) == 0)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = (t**2)*sympy.sin(a*t)\n", "print laplace_transform(f,t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.8.3, page no. 569" ] }, { "cell_type": "code", "execution_count": 32, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "(6/(s + 3)**4, 0, True)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = sympy.exp(-3*t)*t**3;\n", "print laplace_transform(f,t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.8.4, page no. 570" ] }, { "cell_type": "code", "execution_count": 33, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "(6*(s + 1)/((s + 1)**2 + 9)**2, -1, True)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = sympy.exp(-t)*t*sympy.sin(3*t)\n", "print laplace_transform(f,t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.9.1, page no. 571" ] }, { "cell_type": "code", "execution_count": 52, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "-MellinTransform(1, t, s) + MellinTransform(1/t, t, s)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import mellin_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = (1-t)/t\n", "print mellin_transform(f,t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.9.2, page no. 572" ] }, { "cell_type": "code", "execution_count": 49, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "(2**s*sqrt(pi)*a**(-s)*b**(-s)*(a*b**s - a**s*b)*gamma(s/2 - 1/2)/(4*gamma(-s/2 + 1)), (1, 2), And(Abs(periodic_argument(polar_lift(a)**2, oo)) == 0, Abs(periodic_argument(polar_lift(b)**2, oo)) == 0))\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import mellin_transform\n", "from sympy.abc import t, s, a, b\n", "\n", "print 'To find the laplace of given function in t'\n", "f =(sympy.cos(a*t)-sympy.cos(b*t))/t\n", "print mellin_transform(f,t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.10.1, page no. 574" ] }, { "cell_type": "code", "execution_count": 55, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the given integral find the laplace of tsin(t) and put s=2\n", "Integral((2*s/(s**2 + 1)**2, 0, True), s)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the given integral find the laplace of tsin(t) and put s=2'\n", "f = sympy.sin(t)*t\n", "l = laplace_transform(f,t,s)\n", "s = 2\n", "print sympy.integrals.Integral(l)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.10.3, page no. 575" ] }, { "cell_type": "code", "execution_count": 57, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "(sqrt(2)*LaplaceTransform(meijerg(((-1/2, 0, 1/4, 1/2, 3/4, 1), (1,)), ((), (-1/2, 0, 0)), 64*exp_polar(-4*I*pi)/t**4), t, s)/(8*sqrt(pi)) - 4/s - pi/(4*s) + 34*sqrt(2)/(9*s), 0, True)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = sympy.integrate(sympy.exp(t)*sympy.sin(t)/t,(t,0,t))\n", "l = laplace_transform(f,t,s)\n", "print l" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.11.1, page no. 576" ] }, { "cell_type": "code", "execution_count": 58, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "InverseLaplaceTransform(1, t, s, _None)/s - 3*InverseLaplaceTransform(1, t, s, _None)/s**2 + 4*InverseLaplaceTransform(1, t, s, _None)/s**3\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f =(s**2-3*s+4)/s**3\n", "print inverse_laplace_transform(f,t,s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.11.2, page no. 577" ] }, { "cell_type": "code", "execution_count": 60, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "s*InverseLaplaceTransform(1, t, s, _None)/(2*s**2 - 4*s + 13) + 2*InverseLaplaceTransform(1, t, s, _None)/(2*s**2 - 4*s + 13)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f =(s+2)/(2*s**2-4*s+13)\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.12.1, page no. 579" ] }, { "cell_type": "code", "execution_count": 62, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "2*s**2*InverseLaplaceTransform(1, t, s, _None)/(s**3 - 6*s**2 + 11*s - 6) - 6*s*InverseLaplaceTransform(1, t, s, _None)/(s**3 - 6*s**2 + 11*s - 6) + 5*InverseLaplaceTransform(1, t, s, _None)/(s**3 - 6*s**2 + 11*s - 6)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f =((2*s**2-6*s+5)/(s**3-6*s**2+11*s-6))\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.12. 3, page no. 579" ] }, { "cell_type": "code", "execution_count": 63, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "4*s*InverseLaplaceTransform(1, t, s, _None)/(s*(s - 1)**2 + 2*(s - 1)**2) + 5*InverseLaplaceTransform(1, t, s, _None)/(s*(s - 1)**2 + 2*(s - 1)**2)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f =(4*s+5)/((s-1)**2*(s+2))\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.13.1, page no. 580" ] }, { "cell_type": "code", "execution_count": 64, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "5*s*InverseLaplaceTransform(1, t, s, _None)/(s**3 + s**2 + 3*s - 5) + 3*InverseLaplaceTransform(1, t, s, _None)/(s**3 + s**2 + 3*s - 5)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f =(5*s+3)/((s-1)*(s**2+2*s+5))\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.13.2, page no. 581" ] }, { "cell_type": "code", "execution_count": 65, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "s*InverseLaplaceTransform(1, t, s, _None)/(4*a**4 + s**4)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = s/(s**4+4*a**4)\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.14.1, page no. 583" ] }, { "cell_type": "code", "execution_count": 66, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "s**2*InverseLaplaceTransform(1, t, s, _None)/(s - 2)**3\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = s**2/(s-2)**3\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.14.2, page no. 583" ] }, { "cell_type": "code", "execution_count": 67, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "s*InverseLaplaceTransform(1, t, s, _None)/(s**2 - 4*s + 13) + 3*InverseLaplaceTransform(1, t, s, _None)/(s**2 - 4*s + 13)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f =(s+3)/((s**2-4*s+13))\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.15.1, page no. 584" ] }, { "cell_type": "code", "execution_count": 68, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "InverseLaplaceTransform(1, t, s, _None)/(a**2*s + s**3)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f =1/(s*(s**2+a**2))\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.15.2, page no. 584" ] }, { "cell_type": "code", "execution_count": 69, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "InverseLaplaceTransform(1, t, s, _None)/(s*(a + s)**3)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f =1/(s*(s+a)**3)\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.16.1, page no. 585" ] }, { "cell_type": "code", "execution_count": 70, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "s*InverseLaplaceTransform(1, t, s, _None)/(a**2 + s**2)**2\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = s/((s**2+a**2)**2)\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.16.2, page no. 586" ] }, { "cell_type": "code", "execution_count": 71, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "s**2*InverseLaplaceTransform(1, t, s, _None)/(a**2 + s**2)**2\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = s**2/((s**2+a**2)**2) ;\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.16.3, page no. 587" ] }, { "cell_type": "code", "execution_count": 72, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "InverseLaplaceTransform(1, t, s, _None)/(a**2 + s**2)**2\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = 1/((s**2+a**2)**2) ;\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.17.1, page no. 588" ] }, { "cell_type": "code", "execution_count": 73, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "InverseLaplaceTransform(1, t, s, _None)/(a**2 + s**2)**2\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = (s+2)/(s**2*(s+1)*(s-2))\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.17.2, page no. 589" ] }, { "cell_type": "code", "execution_count": 74, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "s*InverseLaplaceTransform(1, t, s, _None)/(s**2 + 4*s + 5)**2 + 2*InverseLaplaceTransform(1, t, s, _None)/(s**2 + 4*s + 5)**2\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f =(s+2)/(s**2+4*s+5)**2\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.19.1, page no. 590" ] }, { "cell_type": "code", "execution_count": 80, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "s*InverseLaplaceTransform(1, t, s, _None)/(a**2 + s**2)**2\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = s/(s**2+a**2)**2\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.19.2, page no. 591" ] }, { "cell_type": "code", "execution_count": 76, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace of given function in t\n", "s**2*InverseLaplaceTransform(1, t, s, _None)/(a**2*b**2 + a**2*s**2 + b**2*s**2 + s**4)\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import inverse_laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "print 'To find the laplace of given function in t'\n", "f = s**2/((s**2+a**2)*(s**2+b**2))\n", "il = inverse_laplace_transform(f,t,s)\n", "print il" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.28.1, page no. 598" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Laplace of the given funtion is: \n", "Piecewise((1/2, s**3 == 0), (exp(-3*s)/s**2 - (-s**2 + s)*exp(-2*s)/s**3, True)) + Piecewise((1/2, s**3 == 0), (exp(-s)/s**2 + (-s**2 - s)*exp(-2*s)/s**3, True))\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "f = sympy.integrate(sympy.exp(-s*t)*(t-1),(t ,1 ,2))+sympy.integrate(sympy.exp(-s*t)*(3-t),(t ,2 ,3))\n", "print 'Laplace of the given funtion is: '\n", "print f" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "## Example 21.28.2, page no. 598" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Laplace of the given funtion is: \n", "Piecewise((2, s == -1), (-1/(s*exp(2)*exp(2*s) + exp(2)*exp(2*s)) + 1/(s + 1), True))\n" ] } ], "source": [ "import sympy\n", "from sympy.integrals import laplace_transform\n", "from sympy.abc import t, s, a\n", "\n", "f = sympy.integrate(sympy.exp(-s*t)*sympy.exp(-t),(t ,0 ,2))\n", "print 'Laplace of the given funtion is: '\n", "print f" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 21.34, page no. 602" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "To find the laplace transform of periodic funtion\n", "Piecewise((Piecewise((0, And(s == 0, w == 0)), (1.5707963267949*exp(3.14159265358979*I*w)*sin(3.14159265358979*w) + 1.5707963267949*I*exp(3.14159265358979*I*w)*cos(3.14159265358979*w) - I*exp(3.14159265358979*I*w)*sin(3.14159265358979*w)/(2*w), s == -I*w), (1.5707963267949*exp(-3.14159265358979*I*w)*sin(3.14159265358979*w) - 1.5707963267949*I*exp(-3.14159265358979*I*w)*cos(3.14159265358979*w) + I*exp(-3.14159265358979*I*w)*sin(3.14159265358979*w)/(2*w), s == I*w), (-s*sin(3.14159265358979*w)/(s**2*exp(3.14159265358979*s) + w**2*exp(3.14159265358979*s)) - w*cos(3.14159265358979*w)/(s**2*exp(3.14159265358979*s) + w**2*exp(3.14159265358979*s)), True)), And(Or(s == -I*w, s == 0, s == I*w), Or(s == -I*w, s == I*w, w == 0))), (Piecewise((w/(s**2 + w**2), And(s == 0, w == 0)), (w/(s**2 + w**2) + 1.5707963267949*exp(3.14159265358979*I*w)*sin(3.14159265358979*w) + 1.5707963267949*I*exp(3.14159265358979*I*w)*cos(3.14159265358979*w) - I*exp(3.14159265358979*I*w)*sin(3.14159265358979*w)/(2*w), s == -I*w), (w/(s**2 + w**2) + 1.5707963267949*exp(-3.14159265358979*I*w)*sin(3.14159265358979*w) - 1.5707963267949*I*exp(-3.14159265358979*I*w)*cos(3.14159265358979*w) + I*exp(-3.14159265358979*I*w)*sin(3.14159265358979*w)/(2*w), s == I*w), (-s*sin(3.14159265358979*w)/(s**2*exp(3.14159265358979*s) + w**2*exp(3.14159265358979*s)) - w*cos(3.14159265358979*w)/(s**2*exp(3.14159265358979*s) + w**2*exp(3.14159265358979*s)) + w/(s**2 + w**2), True)), True))/(w*(-exp(-6.28318530717959*s/w) + 1))\n" ] } ], "source": [ "import sympy, math\n", "\n", "print 'To find the laplace transform of periodic funtion'\n", "w = sympy.Symbol('w')\n", "t = sympy.Symbol('t')\n", "s = sympy.Symbol('s')\n", "f = 1/(1-sympy.exp(-2*math.pi*s/w))*sympy.integrate(sympy.exp(-1*s*t)*sympy.sin(w*t),(t,0,math.pi))/w\n", "print f" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.10" } }, "nbformat": 4, "nbformat_minor": 0 }