In a system where the flux linkage $\lambda = \lambda(x, i)$ is a function of dispalcement $x$ and current $i$.
Its energy is defined as
$$ W = \int_{0}^{\lambda} i(\lambda', x)d\lambda'. $$
Its co-energy is
$$ W' = \int_{0}^{i} \lambda(i', x)di'. $$
And
$$ W = \color{Red}{ \lambda i} - W'. $$
The textbook then explained that the Force of electric origin
$$ f^e = +\frac{\partial }{\partial x} W' = -\frac{\partial }{\partial x} W. $$
My question is that why are $\frac{\partial }{\partial x} W'$ and $\frac{\partial }{\partial x} W$ opposite numbers? i.e. Why the partial derivative of $\color{Red}{ \lambda i}$ with respect to $x$ is $0$, given that $\lambda$ is a function of $i$ and $x$?
Any explanation would be greatly appreciated and thanks in advance!