Ask Your Question

Implementing the basic Fourier-Transformation

asked 2012-10-25 06:43:37 +0200

Jakob Holderbaum gravatar image

updated 2012-10-25 06:44:54 +0200

Hi there!

I'm currently plaing around with sage and I'm really excited about it.

I'd love to do my computations at university and home with a neat opensource-tool instead of the higly prices closed competitors.

Now, the problem I am facing is the symbolif computation of a fourier transformation.

Below is my current naive approach (I'm still learning fourier and complex mathematics, but with large interest!)

x,w,f_0,t = var("x,w,f_0,t") 

w = 2*pi*f_0 
x(t) = sin(w*t) 

integrate(x*exp(-I*w*t),t, -oo, oo)

which results in the following (obviously equal) result:

integrate(e^(-2*I*pi*f_0*t)*sin(2*pi*f_0*t), t, -Infinity, +Infinity)

My expectiation would be an equation without the t (since it has been substituted through integration) and an floating f_0 which I can set according to my desired sine frequency.

Please, could someone tell me, what exactly I am missing here?

Greetings Jakob

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2012-10-25 18:39:52 +0200

Dirk Danckaert gravatar image

Not every function has a wel defined fourier transform, sin(omegat) being an example of those. Try transforming a more 'well-behaved' function, such as exp(-at^2), or 1/(1+t^2). I didn't check, but I bet SAGE will return a correct answer for those.

edit flag offensive delete link more

answered 2012-10-25 07:11:47 +0200

koukourikos gravatar image

The integral that you want to calculate it is not so simple because as you can see it evolves the imaginary unit.

I would suggest to define f_0 first and then calculate the integral numerically .

edit flag offensive delete link more

answered 2012-10-25 07:36:41 +0200

Jakob Holderbaum gravatar image

So, as you suggested, I added a numerical Definition for f_0, now I'm getting an error:

x,w,f_0,t = var("x,w,f_0,t")

f_0 = 1
w = 2*pi*f_0

x(t) = sin(w*t)

integrate(x*exp(-I*w*t),t, -oo, oo)

This is the actual result:

Traceback (click to the left of this block for traceback)
ValueError: Integral is divergent.
edit flag offensive delete link more


numerical_integral returns: TypeError: unable to coerce to a real number

Jakob Holderbaum gravatar imageJakob Holderbaum ( 2012-10-25 07:39:11 +0200 )edit

That's because the integral is actually divergent. The function $\sin(w t)$ is not integrable on $(-\infty, \infty)$.

benjaminfjones gravatar imagebenjaminfjones ( 2012-10-27 04:18:01 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-10-25 06:43:37 +0200

Seen: 1,883 times

Last updated: Oct 25 '12