Message Boards Message Boards

Complex values, Plot, and Play; how to resolve the inconsistency?

Plot[Exp[I*t], {t, 0, 2 Pi}]

produces an empty chart, which is ok since it is not a real function

Plot[Exp[I*t] + Exp[-I*t], {t, 0, 2 Pi}]

produces a plot, which makes sense since the imaginary part of the values is 0 and therefore the expression might be considered a real function


Exp[I*t] + Exp[-I*t]


E^(-I t) + E^(I t)

which is a complex expression.

So Plot seems to recognize complex expressions with vanishing imaginary parts which can be considered reals expressions and plotted.

Things are different with Play:

Play[Exp[I*440*2*Pi*t], {t, 0, 1}]

produces a graphical representation of the sound object which contains a wave shape.

Play[Exp[I*440*2*Pi*t], {t, 0, 1/440}]

Shows that the graphical representation just uses the real part of the function.

This sound object does not produce sound.

So here, within the sound object, we get a graphical representation which does not produce sound (when used with Play), and these term does NOT produce a graphical representation with Plot.

Things are even more complicated in the following case:

We have already seen that

Plot[Exp[I*t] + Exp[-I*t], {t, 0, 2 Pi}]

produces a plot.

Play[Exp[I*t*2*Pi*440] + Exp[-I*t*2*Pi*440], {t, 0, 1}]

produces a sound object, but it cannot be played.

So Plot recognizes that complex functions with vanishing imaginary parts can be plotted, but Play does not recognize that functions with vanishing imaginary parts can be considered real functions and therefore played.

I do experience muted cognitive dissonance here ;-)

POSTED BY: Erich Neuwirth
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract