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
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.
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.
You can add noconds=False
to the transform routines to find under which conditions the transformation integral converges. As asmeurer says, we literally compute the defining integral, so you will never see delta functions coming up. In the case of the fourier transform of cos
, the conditions are a convoluted way of saying "never", which unfortunately sympy does not recognise. (I.e. the algorithm says something like "the integral is zero if blah", and blah never holds.)
For the fourier transform of the step function, the conditions seem to be saying that this works if z has negative argument (angle), not too big. Note that this is indeed when the transform integral converges (b/c you need to pick up a falling exponential term over the positive reals). I don't have time to think about whether the computation is correct in this case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With