Exercise:
Plot the solution to the simply-supported beam problem with q0 = 1, L=1, E=1, I = 1. Plot also the function f(x;a) = w(x) + 0.001 Sin[a x π], with a ϵ 𝕫, for a=4,8,16
Solution:

w[x_]  :=  ((- 1)/24) 
        x (1 - x) (1 + x - x^2)
f[x_, a_]  :=  w[x]  +  0.001 Sin[a x π]

Plot[{w[x], f[x, 4],  f[x, 8], f[x, 16]}, {x, 0, 1},  
        PlotStyle -> {{Thickness[0.01], 
              RGBColor[0, 0, 0]}, {Thickness[0.005], 
              RGBColor[1, 0, 0]}, {Thickness[0.005], 
              RGBColor[0, 1, 0]}, {Thickness[0.005], 
              RGBColor[0, 0, 1]}}];

Plot of the functional

Π[f_] := (∫_0^1)((D[f, {x, 2}])^2  +  f)  \[DifferentialD]x

values  =  
        Table[{a, Π[f[x, a]] // Chop}, {a, -16, 16, 
            1}];

ListPlot[Evaluate[values], 
        PlotStyle -> {PointSize[0.02]}];

We observe that the functional attains a minumum for a=0, i.e. for f(x) = w(x), the real solution of the problem.

What happens if "a" is not an integer?

val  =  Evaluate[Π[f[x, a]] // Chop]

Plot[val, {a, -5, 5},  
        PlotStyle -> {Thickness[0.01]}];

f[x;a] does not satisfy the geometrical boundary conditions of the problem, the functional may attain values lower that Π(w(x)) but f(x;a) is not a solution of the problem.