I'm trying to calculate a Fourier transform and plot it, however the calculation is running for several hours now. I suspect that there is a mistake in my script. Or am I just not patient enough? Is there any shortcut, like evaluating the FT numerically? When I encounter this problem with Integrate, I usually still get reasonable and quick results using NIntegrate. Is there anything like that for Fourier transforms as well?

beta2 = -7.63;
fs = 39 ;

spectrumdisp[f_, fs_, beta2_, L_] := 

Plot[Abs[FourierTransform[spectrumdisp[f, fs, beta2, 1], f, t]], {t, 1, 100}]

However, i'm not sure if the FourierTransform alone works this way at all. Already this command does not finish calculating:

FourierTransform[spectrumdisp[f, fs, beta2, 100], f, t]

I would be very glad if someone could help me with these problems.


closed as off-topic by Daniel Lichtblau, MarcoB, m_goldberg, Alex Trounev, xzczd Apr 7 at 10:21

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Daniel Lichtblau, MarcoB, m_goldberg, Alex Trounev, xzczd
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    $\begingroup$ First problem: Replace == by =: beta2 = -7.63; fs = 39;. $\endgroup$ – Henrik Schumacher Apr 5 at 7:41
  • 1
    $\begingroup$ Try in addition to @Henriks comment Plot[Abs[FourierTransform[spectrumdisp[f, fs, beta2, 1], f, t]] // Evaluate, {t, 1, 100}] $\endgroup$ – Ulrich Neumann Apr 5 at 15:16
  • $\begingroup$ @HenrikSchumacher, thanks, i edited it above. $\endgroup$ – Mechanix Apr 6 at 17:08
  • $\begingroup$ @UlrichNeumann this makes it actually so much faster. Now, it takes only a few seconds. Can you explain to me, when and how often the fourier transform is evaluated now? $\endgroup$ – Mechanix Apr 6 at 17:13
  • $\begingroup$ @Mechanix Quite often there is some kind of conflict inside Plot-function with the plot-variable t . ` Evaluate` forces the evaluation of the plotfunction before plotting. $\endgroup$ – Ulrich Neumann Apr 7 at 9:31