I have this function
f[x_] := ((2 x Cos[4 x] )/(1 + (x^2) ) + Sqrt[
Cot[3 x]^4 - (Cos[4 x]^2) (Csc[3 x]^2) ])/(4 /(x^2) +
Cot[3 x]^2);
where $0<x<5$. I want to plot the Real and Imag part of this function. I use the following codes:
Plot[Re[f[x]], {x, 0, 5}]
Plot[Im[f[x]], {x, 0, 5}]
Plot[f[x], {x, 0, 5}]
I am confused with these plots. According the first plot, the function is always real-valued, but according to the second and the third one, there are some imaginary parts as well. could someone explain this behavior? Does the third plot indicate that the real part of this function is discontinuous? or should I consider the first plot?
f[x_] := ...
to define your function. And then usef[x]
in the other places. The thirdPlot
seems to be plottingAbs[f[x]]
(I am not sure if this is correct, it seems odd to me). $\endgroup$f=x^2-I*x^2
and youPlot[Re[f],{x,-2,2}]
it shows you the positive realx^2
and youPlot[Im[f],{x,-2,2}]
it shows you the negative imaginary-x^2
. How do you think the first plot shows you that f is only real? You are asking it to only show you the real part. You can also tryPlot[{Re[f],Im[f]},{x,-2Pi,2Pi},PlotPoints->1000]
on your original f to see the real and imaginary in two colors on top of each other. $\endgroup$Re
tries to take the points to be plotted and discards the imaginary part, whether the real and imaginary parts are clearly separated or clearly combined or even hidden from you, it does the work throw away any imaginary part. $\endgroup$FunctionDomain[{f[x], 0 < x < 5}, x]
will show the intervals within0 < x < 5
where the function is purely real. $\endgroup$