Ask Your Question

Revision history [back]

I will show you how to calculate fourier transform in sage. I am assuming you have theoretical knowledge of the thing.

i will calculate the fourier transform of a sin wave of the form sin(2πft)

code begins from here:

from sage.symbolic.integration.integral import indefinite_integral

amplitude = 1.0

phase = 0.0

Input(f,t) = amplitudesin(2pift + phase)

assume(f>0)

Input_fourier(f,t) = indefinite_integral(exp(-2piItf)*Input(f,t),t) show(Input(f,t)) show(Input_fourier)

The output shall be the fourier transform

Plot:

plot(real(Input_fourier(f,2)),f,0,10000,gridlines = True,)

This will give u the plot

I will show you how to calculate fourier transform in sage. I am assuming you have theoretical knowledge of the thing.

i will calculate the fourier transform of a sin wave of the form sin(2πft)

code begins from here:here: f= frequency,t=time

from sage.symbolic.integration.integral import indefinite_integral

amplitude = 1.0

phase = 0.0

Input(f,t) = amplitudesin(2pift + phase)

assume(f>0)

Input_fourier(f,t) = indefinite_integral(exp(-2piItf)*Input(f,t),t) show(Input(f,t)) show(Input_fourier)

The output shall be the fourier transform

Plot:

plot(real(Input_fourier(f,2)),f,0,10000,gridlines plot(norm(Input_fourier(f,2)),f,0,10000,gridlines = True,)

This will give u the plot

norm means the modulus of the complex function.