# White spaces in Density plots

I have the following function that is dependent on three parameters ω, κ2, and x:

f[ω_, κ2_,
x_] := (384000. x κ2 Sqrt[κ2^2])/(1600000000 x^2 \
κ2^2 (1/100000000 + 4 ω^2) + (κ2^2 +
4 ω^2) (16 +
8 (1/10000 - 4 ω^2) + (1/100000000 +
4 ω^2) (1 + 4 ω^2)) +
80000 x κ2 ((κ2 - 4 ω^2) (1/100000000 +
4 ω^2) +
4 (κ2/10000 + 4 ω^2))) + (9.6 (κ2^2 +
4 ω^2))/(1600000000 x^2 κ2^2 (1/100000000 +
4 ω^2) + (κ2^2 + 4 ω^2) (16 +
8 (1/10000 - 4 ω^2) + (1/100000000 +
4 ω^2) (1 + 4 ω^2)) +
80000 x κ2 ((κ2 - 4 ω^2) (1/100000000 +
4 ω^2) +
4 (κ2/10000 +
4 ω^2))) + (0.0122 (1600000000 x^2 κ2^2 +
80000 x κ2 (κ2 - 4 ω^2) + (1 +
4 ω^2) (κ2^2 +
4 ω^2)))/(1600000000 x^2 κ2^2 (1/100000000 +
4 ω^2) + (κ2^2 + 4 ω^2) (16 +
8 (1/10000 - 4 ω^2) + (1/100000000 +
4 ω^2) (1 + 4 ω^2)) +
80000 x κ2 ((κ2 - 4 ω^2) (1/100000000 +
4 ω^2) + 4 (κ2/10000 + 4 ω^2)))


I intend to plot a density plot such that the x-axis takes on κ2, the y-axis takes on x, and the z-axis gives the difference in the maxima of the function at each κ2 and x value as a function of ω. I proceed to construct a double loop like so:

ωarr =
Table[{i, j,
Max[ω /.
NSolve[(D[f[ω, i, j], ω]) == 0 &&
D[f[ω, i, j], {ω, 2}] < 0, Reals]] -
Min[ω /.
NSolve[(D[f[ω, i, j], ω]) == 0 &&
D[f[ω, i, j], {ω, 2}] < 0, Reals]]}, {i, 0,
100, 1}, {j, 0, 10^-3, 10^-5}];


and then proceeding to plot:

ListDensityPlot[Flatten[ωarr,1], PlotRange->All, PlotRangeClipping -> False]


What I get is some density plot with mostly blue gradient. My problem is of the white spaces that shows up: Should the maxima difference be 0, wouldn't that be represented by a blue colored gradient rather than empty white spaces? What is the problem here?

I could use any help that I can get. Thank you in advance!

## 1 Answer

I am puzzled why the plot looks like that..as a workaround, since your data is on a regular grid you can use the array form of ListDensityPlot :

ListDensityPlot[Transpose[Map[#[[3]] &, \[Omega]arr, {2}]],
DataRange ->   MinMax /@ Transpose[Flatten[\[Omega]arr, 1][[All, {1, 2}]]]]


• I copied and pasted exactly what you wrote and came up with a much better plot, albeit different from yours: imgur.com/o0PhcUy As you can see, my yellow contour has these tiny ladders at the edge whereas yours doesn't. Can you explain the discrepancy in this? what should be a better solution ? – kowalski Mar 3 '18 at 1:34
• i think i made the increment 10^-4` to speed it up. – george2079 Mar 3 '18 at 4:19