I am trying to find the derivative of the following function:
$$C(\mathbf{p})= \sum_{i=1}^N E \left[ \frac{1}{2} \log (1+ap_i) \right],$$
with respect to $p_i$. Where $p_i$ are elements of the vector $\mathbf{p}$ and $a$ is constant. $C(\mathbf{p})$ is the capacity of fading channel when the channel state information is not available at the transmitter (this is why there is expectation). I am trying to solve the maximization problem: $$\text{max } C(\mathbf{p})$$ $$\text{subject to } \sum_{i=1}^N p_i \leq NP$$ We have $N$ channels and $P$ is the maximum power that can be achieved on eaxh channel. In order to solve the maximization problem I have to solve the Lagrangian of it but I am not sure how to take the partial derivative of $p_i$ when it is in the expectation. The answer of the problem in this situation should be $p_i^*=P$.