Search code examples
pythonsympycontinuous-fouriersymbolic-integration

Fourier transform a trig function in Sympy returns unexpected result


I think Sympy makes a mistake in calculating the Fourier transform of a trig function. For example:

from sympy import fourier_transform, sin
from sympy.abc import x, k
print fourier_transform(sin(x), x, k)

The expected answer via Mathematica is

enter image description here

but Sympy returns 0. Sometimes the function works very well since fourier_transform(Heaviside(t)*cos(t),t,omega) and fourier_transform(Heaviside(t)*sin(t),t,omega) return the correct answer. I think Sympy may be using Laplace transform to calculate Fourier transform.


Solution

  • SymPy computes the Fourier transform by literally computing the integral. I would consider this to be a bug, so feel free to open an issue for it.