Output of sympy.fourier_transform

Jiho
Messages
20
Reaction score
4
I run sympy.fourier_transform.
Python:
    from sympy import fourier_transform, exp,symbols
    from sympy.abc import x, k
 
    a=fourier_transform(exp(-x**2), x, k)
 
    s=symbols('s')
    Ori=(s)*exp(-(x**2)/(s**2))
    FT=fourier_transform(Ori,x,k)

    a.subs({k:1}).evalf()
    >>>9.16769605680502e-5
    FT.subs({s:1,k:1}).evalf()
    >>>FourierTransform(exp(-x**2), x, 1)
a.subs({k:1}).evalf() is number. It's ok. But problem is FT.subs({s:1,k:1}).evalf(). It is not number even I applied .evalf() . I want to get value of 'number'. What is the problem??

Now I'm using sympy version1.3, python version 3.7.1. This code was well run at sympy version 1.1.
 
Last edited:
on Phys.org
Jiho said:
I run sympy.fourier_transform.
Python:
    from sympy import fourier_transform, exp,symbols
    from sympy.abc import x, k
 
    a=fourier_transform(exp(-x**2), x, k)
 
    s=symbols('s')
    Ori=(s)*exp(-(x**2)/(s**2))
    FT=fourier_transform(Ori,x,k)

    a.subs({k:1}).evalf()
    >>>9.16769605680502e-5
    FT.subs({s:1,k:1}).evalf()
    >>>FourierTransform(exp(-x**2), x, 1)
a.subs({k:1}).evalf() is number. It's ok. But problem is FT.subs({s:1,k:1}).evalf(). It is not number even I applied .evalf() . I want to get value of 'number'. What is the problem??

Now I'm using sympy version1.3, python version 3.7.1. This code was well run at sympy version 1.1.
Did you run exactly the same code on sympy 1.1?
In your code, a is set to $$\int_{-\infty}^\infty e^{-x^2}e^{-2\pi ixk} dx$$
and sympy can calculate this integral, and then replace k with 1 to get a numeric value.

In your second transform, FT is set to $$\int_{-\infty}^\infty se^{\frac{-x^2}{s^2}}e^{-2\pi ixk}dx$$
I suspect that this integral doesn't have a nice closed-form value. Per the sympy documentation for fourier_transform():
If the transform cannot be computed in closed form, this function returns an unevaluated FourierTransform object.
That's what seems to be happening here. I don't have sympy installed, so I can't verify that your code does what you say it does.
 

Similar threads

Replies
1
Views
6K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K
Replies
26
Views
6K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 17 ·
Replies
17
Views
3K
  • · Replies 15 ·
Replies
15
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K