How to minimize the integral of the functional of a function, with respect to that function? I need to obtain the function $f(x)$ for which the following integral has  its minimum value:
$I=\int F(f(x))dx= \int [A (B^2-f(x)^2)^2-Cf(x)f''(x)]dx$
One special solution is $f(x)=constant=\pm B$, but I need the general solution such that $f(x) \ne constant$. Then the systematic approach is to minimize '$I$' with respect to $f(x)$. I started with $\dfrac{dI}{df(x)}=0 $. 
Then I differentiate both side with respect to $x$ so that I get rid of the integral and end up with $\dfrac{dF(f(x))}{df(x)}=0 $
This step gives me:  $2A(B^2-f(x)^2).[-2f(x)] -C\dfrac{d}{df(x)}f(x)f''(x)=0$
At this point how to carry out the second part? Shall I consider the $f''(x)$ be constant with respect to $f(x)$? Doing so would give a differential equation to solve for $f(x)$. But I am not sure whether this is the right way or not.
Thanks in advance

The Euler Lagrange equation for $f$ to be an extremum of the integral $\int^b_a F(x,f,f',f'') dx$ is
$\frac{\partial F}{\partial f}-\frac{d}{dx}\frac{\partial F}{\partial f'}+\frac{d^2}{dx^2}\frac{\partial F}{\partial f''}$.
For the given $F$ this gives $\frac{\partial}{\partial f}[A(B^2-f^2)^2]-Cf''-C\frac{d^2}{dx^2} f$. Multiply this through by $f'$ and integrate to get
$[A(B^2-f^2)^2]+D=C f'^{\,2}$ where $D$ is a constant to be determined.
It looks possible, but ugly, to integrate this again, so getting something neat and tidy like $f(x)=....$ is probably not on.
If $f$ is fixed at $x=a$ and $x=b$ then these are the bc's. If $f$ is not fixed then calculus of variation provides natural boundary conditions. I believe these are $f'(a)=f'(b)=0$ but check. 
In the original integral the term $f f''$ can be integrated by parts to give $f'^2$. This is why we end up with only a second order equation and not a third order.
