Python Output of sympy.fourier_transform

17
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:
1,416
9
Thanks for the thread! This is an automated courtesy bump. Sorry you aren't generating responses at the moment. Do you have any further information, come to any new conclusions or is it possible to reword the post? The more details the better.
 
32,349
4,136
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.
 

Want to reply to this thread?

"Output of sympy.fourier_transform" You must log in or register to reply here.

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top