0
$\begingroup$

Consider

s[t_] := Exp[-t^2] Sin[5 t]
sf[w_, n_] = FourierTransform[Exp[-t^2] Sin[n t], t, w];

Then

Table[Plot[Abs[sf[w, n]], {w, 1, 15}, WorkingPrecision -> 100], {n, {1, 5, 10}}]

but when I

Table[LogLogPlot[Abs[sf[w, n]], {w, 1, 15}, WorkingPrecision -> 100], {n, {1, 5, 10}}]

enter image description here the last plot remains empty.

(note that WorkingPrecision -> 100 is near the minimum amount for which sf gets plotted correctly with Plot; increasing it won't solve the problem with the last plot)

This has happened to me also in other situations, with different functions.

I wonder

  1. What is happening in the last and other similar plots
  2. How can I handle this situation, not on this particular case but in general

Version: 11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)

$\endgroup$
2
  • 1
    $\begingroup$ Are you sure? Mathematica 10.4 returns this imgur.com/a/0BElEyM $\endgroup$
    – ZaMoC
    Oct 11, 2018 at 22:23
  • $\begingroup$ Yes, the plots are correct. I think it is something related to the newer version $\endgroup$
    – pp.ch.te
    Oct 11, 2018 at 22:32

1 Answer 1

1
$\begingroup$

Use SetDelayed (:=) when defining functions in Mathematica. It's better practice:

s[t_] := Exp[-t^2] Sin[5 t]
sf[w_, n_] := FourierTransform[Exp[-t^2] Sin[n t], t, w];

Table[Plot[Abs[sf[w, n]], {w, 1, 15}, 
  WorkingPrecision -> 100], {n, {1, 5, 10}}]

Table[LogLogPlot[Abs[sf[w, n]], {w, 1, 15}, 
  WorkingPrecision -> 100], {n, {1, 5, 10}}]

enter image description here

$\endgroup$
2
  • $\begingroup$ What is the rationale behind this behaviour? I mean, how can the results be different? I understand the difference between = and := but I didn't think it could make such a difference $\endgroup$
    – pp.ch.te
    Oct 13, 2018 at 8:45
  • $\begingroup$ Also, this was to me the typical case in which using = would be preferred over := since the symbolic calculation of the transform is a bit slow (as in mathprogramming-intro.org/book/node381.html) $\endgroup$
    – pp.ch.te
    Oct 13, 2018 at 9:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.