# Alternative Representation for Energy Levels and Energy Level Density

I need to show the energy level density around the local maximum of this double-well potential. I can do it using the following:

a0 = 0.02; a1 = 0.64; L = 10;
U[x_] := a0*x^4 - a1*x^2 + a1^2/(4 a0)
vals = NDEigenvalues[{-1/2 Laplacian[u[x], {x}] + U[x]*u[x],
DirichletCondition[u[x] == 0, True]}, u[x], {x, -L, L}, 25,
Method -> {"PDEDiscretization" -> {"FiniteElement", {"MeshOptions" \
-> {"MaxCellMeasure" -> 0.001}}}}];

Show[ Plot[{vals}, {x, -L, L}, PlotRange -> {Automatic, {-1.0, 15.0}},
ImageSize -> 500, RotateLabel -> False,
FrameLabel -> {{"\!$$\*SubscriptBox[\(E$$, $$n$$]\)", "U(x)"}, {"x",
None}}, PlotTheme -> "Scientific"],
Plot[U[x], {x, -L, L},
PlotStyle -> {Directive[Darker[Green], Thickness[0.005]]},
Filling -> Axis, FillingStyle -> Directive[Opacity[0.9], White]]]


1. The above diagram serves the purpose; however, I require another representation using the density of states. The graph should look more or less like a Gaussian curve around the energy value of the hilltop. How do we plot that graph?

I have plotted the Differences[vals] using ListLinePlot as shown in the figure below. However, I believe there must be a better way to represent the energy level density around the hilltop of the double well. Besides, the x-axis in this graph makes no sense as it contains "number of differences".

2. How can the energy levels be plotted with vertical lines, the energy spread along the horizontal line instead of the vertical, so that it can look like an energy spectrum through a spectrometer?

You are probably looking for SmoothHistogram.

SmoothHistogram[vals]


And you can use ListPlot for vertical lines.

ListPlot[{#, 1} & /@ vals, Filling -> Bottom, PlotMarkers -> "", FillingStyle -> Thick]


• Thank you @Domen. Just one more query, is there a way to make these vertical lines colourful? Different colours for each line? PlotStyle and ColorFunction is not working Commented Feb 29 at 7:44
• Just plot each of them as a separate list: ListPlot[{{#, 1}} & /@ vals, Filling -> Bottom, PlotMarkers -> "", FillingStyle -> Thick]. Also, note that SmoothHistogram takes the kernel size as the second argument, for example: SmoothHistogram[vals, 0.5] Commented Feb 29 at 10:14
• Thank you so much @Domen Commented Feb 29 at 10:29