Plot[{ArgMax[Cos[t] Sinc[2*Pi kl (Sin[t] - 1/Sqrt[2])], t]*180/Pi,
45}, {kl, 0, 10}, PlotRange -> Full]
I want to know what causes this, and how to fix it in case it happens in the future.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityPlot[{ArgMax[Cos[t] Sinc[2*Pi kl (Sin[t] - 1/Sqrt[2])], t]*180/Pi,
45}, {kl, 0, 10}, PlotRange -> Full]
I want to know what causes this, and how to fix it in case it happens in the future.
As noted by kirma, this function is highly oscillatory. However, from its form it is periodic in t
with period 2 Pi
and has its maximum near Pi/4
except for small kl
. For instance,
Plot[Evaluate[Cos[t] Sinc[2 Pi kl (Sin[t] - 1/Sqrt[2])] /.
kl -> Range[0, 2, 1/2]], {t, 0, 2 Pi}, PlotRange -> All]
Because ArgMax
sometimes finds a local maximum instead of the global maximum, we can help it by adding a constraint that takes advantage of the fact (just shown) that the maximum lies between 0
and Pi/4
.
Plot[{ArgMax[{Cos[t] Sinc[2*Pi kl (Sin[t] - 1/Sqrt[2])],
0 < t < Pi/2}, t]*180/Pi, 45}, {kl, 0, 10}, PlotRange -> Full]
as desired.
ContourPlot[Cos[t] Sinc[2 Pi kl (Sin[t] - 1/Sqrt[2])], {kl, 4, 6}, {t, -8, 8}, PlotRange -> All]
. It seems pretty nasty... $\endgroup$ – kirma Apr 8 '16 at 11:11