Chapter 22 : Integral Transform

Example 22.1, page no. 608

In [6]:
import sympy,math

print "To find the fourier sin integral"
x = sympy.Symbol('x')
t = sympy.Symbol('t')
u = sympy.Symbol('u')
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)))
print fs
To find the fourier sin integral
0.636619772367581*Integral(sin(t*u), (t, 0, oo))*Integral(sin(u*x), (u, 0, oo))

Example 22.2, page no. 608

In [8]:
import sympy

print "To find the fourier transform of given function"
x = sympy.Symbol('x')
s = sympy.Symbol('s')
F = sympy.integrate(sympy.exp(1j*s*x),(x,-1,1))
print F
F1 = sympy.integrate(sympy.sin(x)/x,(x,0,sympy.oo))
print F1
To find the fourier transform of given function
Piecewise((2, s == 0), (1.0*I*exp(-1.0*I*s)/s - 1.0*I*exp(1.0*I*s)/s, True))
pi/2

Example 22.3, page no. 609

In [8]:
import sympy,numpy

print "To find the fourier transform of given function"
x = sympy.Symbol('x')
s = sympy.Symbol('s')
F = sympy.integrate(sympy.exp(1j*s*x)*(1-x**2),(x,-1,1))
print F
F1 = sympy.integrals.Integral((x*sympy.cos(x)-sympy.sin(x))/x**3*sympy.cos(x/2),(x,0,numpy.inf))
print F1
To find the fourier transform of given function
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))
Integral((x*cos(x) - sin(x))*cos(x/2)/x**3, (x, 0, +inf))

Example 22.4, page no. 610

In [10]:
import sympy,math

print "To find the fourier sin integral"
x = sympy.Symbol('x')
s = sympy.Symbol('s')
m = sympy.Symbol('m')
fs = sympy.integrate(sympy.sin(s*x)*sympy.exp(-x),(x,0,sympy.oo))
print fs
f = sympy.integrate(x*sympy.sin(m*x)/(1+x**2),(x,0,sympy.oo))
print f
To find the fourier sin integral
Piecewise((s/(s**2 + 1), Abs(periodic_argument(polar_lift(s)**2, oo)) == 0), (Integral(exp(-x)*sin(s*x), (x, 0, oo)), True))
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))

Example 22.5, page no. 611

In [11]:
import sympy,math

print "Fourier cosine transform."
x = sympy.Symbol('x')
s = sympy.Symbol('s')
f = sympy.integrate(x*sympy.cos(s*x),(x,0,1))+sympy.integrate((2-x)*sympy.cos(s*x),(x,1,2))
print f
Fourier cosine transform.
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))

Example 22.6, page no. 612

In [12]:
import sympy,math

print "Fourier cosine transform."
x = sympy.Symbol('x')
s = sympy.Symbol('s')
a = sympy.Symbol('a')
f = sympy.integrate(sympy.exp(-a*x)/x*sympy.sin(s*x),(x,0,sympy.oo))
print f
Fourier cosine transform.
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))