Continuous Fourier Transform using Python / Sympy (analytic solution)

I recently replaced Matlab with Python because I was real y excited by Sympy.

But now I have the following problem:

I need a way to reliably calculate continuous Fourier transforms with Python. Sympy has problems with solutions, including Diracs (Delta-functions), for example, for trigger functions, etc.

For example, if I try

fourier_transform(cos(x),x,v) 

pin 0 , where it should be based on the Dirac delta function

Does anyone know if this part of Sympy will be improved, or is there another way to analytically search for Fourier transforms with Python?

Thanks for the answers or any tips in advance!

+5
source share
1 answer

As far as I know, no one is currently working on this, although contributions are welcome .

Some tips I can give:

  • If you set noconds=False to fourier_transform() , it will include conditions for which 0 is True:

     In [26]: fourier_transform(cos(t),t,x, noconds=False) Out[26]: ⎛ │ ⎛ -ⅈ⋅π 2 ⎞│ │ ⎛ ⅈ⋅π 2 ⎞│ ⎞ ⎝0, │periodic_argument⎝ℯ ⋅polar_lift (x), ∞⎠│ < π ∧ │periodic_argument⎝ℯ ⋅polar_lift (x), ∞⎠│ < π⎠ 

    These conditions are not very useful, except, perhaps, to show that 0 is not completely wrong.

  • You can use FourierTransform to represent the invaluable Fourier transform. You can call doit() on it to evaluate it or rewrite(Integral) to get the integral form:

     In [28]: FourierTransform(cos(t),t,x).rewrite(Integral) Out[28]: ∞ ⌠ ⎮ -2⋅ⅈ⋅π⋅tx ⎮ ℯ ⋅cos(t) dt- 

My best suggestion at the moment is to do Fourier transforms that Sympy cannot currently do manually by manipulating FourierTransform objects or integrals.

+3
source

Source: https://habr.com/ru/post/1234003/


All Articles