I'm writing simulation code of ferroelectric domain, and there is a math problem that I can't solve.
The expression of $F$ is $$ F = \frac{|\vec{k} \cdot \vec{P}(\vec{k})|^2}{k^2}. $$ $\vec{k}$ is a wave-vector in Fourier space, i.e. $\vec{k}=(k_x,k_y)$, and $\vec{P}(\vec{k}) = (P_x,P_y)$ is the Fourier transform of Polarization in real space.
What's the explicit expression of $$ \frac{δF}{δP_x}? $$
More details are available here.
Disclaimer: I only know variational calculus from Physics, so this won't be rigorous.
For fixed $\vec{k}$ you have $$ F = \frac{(k_x P_x + k_y P_y)(\bar{k}_x \bar{P}_x + \bar{k}_y \bar{P}_y)}{k_x^2 + k_y^2} $$ and therefore $$ d F = \frac{\bar{k}_x \bar{P}_x + \bar{k}_y \bar{P}_y}{k_x^2 + k_y^2} (k_x \,d P_x + k_y \,dP_y) + \frac{k_x P_x + k_y P_y}{k_x^2 + k_y^2} (\bar{k}_x \,d \bar{P}_x + \bar{k}_y \,d \bar{P}_y) $$
According to this, $$\frac{\delta F}{\delta P_x} = \frac{\vec{\bar{k}} \cdot \vec{\bar{P}}}{k^2} k_x$$