SymPy Fourier Transform of Cosine and Sine Returns Zero

72 views
Skip to first unread message

ODARI KIBISI CHARLES

unread,
Jun 27, 2026, 6:01:02 PMJun 27
to sympy

Hi everyone,

I'm currently working on implementing Fourier Transform computations using SymPy to better understand the transforms of signals such as and .

However, when I use fourier_transform() on these functions, SymPy returns 0 instead of the expected result involving Dirac delta functions, for example:

From my understanding, these transforms are distributions (generalized functions), so I'm wondering:

  1. Does SymPy's fourier_transform() support Fourier transforms in the distributional sense?
  2. Is there a specific way to define the assumptions on the variables (e.g., real, positive) or to invoke the transform so that the Dirac delta terms are returned?
  3. If not, what is the recommended approach for symbolically computing or representing Fourier transforms of pure sinusoids in SymPy?

Any guidance, examples, or best practices would be greatly appreciated. Thank you!


CONFIDENTIAL NOTICE: This email from Dedan Kimathi University of Technology is confidential and may contain sensitive information. It is intended solely for the recipient. Any unauthorized access, use, disclosure, or distribution is strictly prohibited. The university is not responsible for any harm caused by viruses. By receiving this email, you consent to the processing of personal data in accordance with Kenya’s Data Protection Act, 2019.

Sangyub Lee

unread,
Jun 28, 2026, 12:01:35 PMJun 28
to sympy
I think that there were a few known issues related to this
However, I now have rather different opinion whether this is feature or bug
for example the fourier transformation of F{cos(2πf0​t)} may not exist as user real or complex function
https://en.wikipedia.org/wiki/Dirac_delta_function
also it means that if you rather discuss about computable result to R->R function you can rather use 42 instead of 0

Sangyub Lee

unread,
Jun 28, 2026, 7:02:38 PMJun 28
to sympy
> If not, what is the recommended approach for symbolically computing or representing Fourier transforms of pure sinusoids in SymPy?

I note that it does not limit the usefulness of fourier_transform (which may use meijerint behind)
For the cases where the result round-trips to usual R->R or C->C functions, it may give sound results
The cases are you use concrete functions like multiplying with cos/sin and time shifting property will work

fourier_transform(exp(-t)*cos(t)*Heaviside(t), t, w)
fourier_transform(exp(-t)*cos(2*t)*Heaviside(t), t, w)

ODARI KIBISI CHARLES

unread,
Jun 28, 2026, 11:59:28 PMJun 28
to sy...@googlegroups.com

Thank you for the clarification. I now understand the distinction between Fourier transforms that evaluate to ordinary functions and those that are distributions involving DiracDelta.

My original idea was slightly different from expecting fourier_transform() to compute the distribution directly. I was wondering whether, instead of returning 0, it could first attempt to apply known Fourier transform properties symbolically.

For example, when encountering expressions involving sin or cos, SymPy could rewrite them in terms of complex exponentials and apply the modulation (frequency-shifting) property, or use transform rules that return DiracDelta expressions where appropriate. This could also benefit expressions such as

fourier_transform(exp(-t)*cos(2*pi*f0*t)*Heaviside(t), t, f)

by deriving the result through transform properties rather than direct integration.

Would an enhancement along these lines fit within the intended design of the Fourier transform module, or is handling distribution-valued transforms intentionally outside its scope?

If this is considered a worthwhile direction, I'd be interested in contributing it to SymPy. I'd be happy to work on a pull request if the maintainers think this approach is appropriate.



--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/sympy/9cc86c1d-26e5-4ccd-b428-7a7015ab1811n%40googlegroups.com.

ODARI KIBISI CHARLES

unread,
Jun 28, 2026, 11:59:42 PMJun 28
to sympy

Thank you for the clarification. I now understand the distinction between Fourier transforms that evaluate to ordinary functions and those that are distributions involving DiracDelta.

My original idea was slightly different from expecting fourier_transform() to compute the distribution directly. I was wondering whether, instead of returning 0, it could first attempt to apply known Fourier transform properties symbolically.

For example, when encountering expressions involving sin or cos, SymPy could rewrite them in terms of complex exponentials and apply the modulation (frequency-shifting) property, or use transform rules that return DiracDelta expressions where appropriate. This could also benefit expressions such as

fourier_transform(exp(-t)*cos(2*pi*f0*t)*Heaviside(t), t, f)

by deriving the result through transform properties rather than direct integration.

Would an enhancement along these lines fit within the intended design of the Fourier transform module, or is handling distribution-valued transforms intentionally outside its scope?

If this is considered a worthwhile direction, I'd be interested in contributing it to SymPy. I'd be happy to work on a pull request if the maintainers think this approach is appropriate.


Reply all
Reply to author
Forward
0 new messages