I have a function $$ Z=Z(\vec{\theta}, \vec{p})$$ and the vector $$ \vec{p}=[p_1,p_2...p_n] $$ is a probability. I would like to compute the derivative $ \frac{\partial Z}{\partial \vec{p}} $ (in Matlab, I am using finite differences, $ \frac{\partial Z}{\partial {p_i}}= \frac{Z(p_i+h)-Z(p_i -h)}{2h} $). Given that the vector $\vec{p}$ has the constraint that $$ \vec{c}^T \vec{p}=1 $$ where c is a discretization vector to compute the integral of probability, how can I calculate the derivative of the function? For the sake of generalization, you can also reply using $ \vec{c}^T \vec{p}=\lambda $ .
Thanks in advance