# DensityPlot and KroneckerDelta

I have the following DensityPlot:

DensityPlot[Sin[x] Sin[y], {x, -Pi/4, Pi/4}, {y, -Pi/4, Pi/4}, ColorFunction -> "SunsetColors", PlotLegends -> Automatic]


Now I want to see only the values of density along the function "y = 1/2 (ArcCos[1 - Cos[2 x]])". I had the idea to use a KroneckerDelta as following but it does not work !

X[x_, y_] = KroneckerDelta[1/2 (ArcCos[1 - Cos[2 x]]), y]

DensityPlot[Sin[x] Sin[y]*X[x, y], {x, -Pi/4, Pi/4}, {y, -Pi/4, Pi/4},ColorFunction -> "SunsetColors", PlotLegends -> Automatic]


Any idea why this is not working and how to rectify ?

Thank you for your time !

Geoff

• DensityPlot is not meant to be used for drawing curves. – shrx Mar 27 '15 at 10:55
• Since KroneckerDelta is in effect "infinitely thin," DensityPlot can't locate where it is nonzero. – 2012rcampion Mar 27 '15 at 13:20
• Ok I understand the problem ! – Geoff Hudson Mar 27 '15 at 17:26

If you want a curve whose shape is determined by y = 1/2 (ArcCos[1 - Cos[2 x]]) and whose color is determined by Sin[x] Sin[y], you may use
Plot[1/2 (ArcCos[1 - Cos[2 x]]), {x, -\[Pi]/4, \[Pi]/4},