countzander said:
Thanks for the formatting help.
I attempted a solution by differentiating with respect to ##x_n##.
$$\frac{\partial f}{\partial x_n} = 2x_n + \frac{A^T e^T exp(Ax+b)}{e^T exp(Ax+b)}$$
But this isn't correct, I don't think. Shouldn't ##A^T## cancel out somewhere? Can the gradient contain a matrix in the final solution?
countzander said:
Thanks for the formatting help.
I attempted a solution by differentiating with respect to ##x_n##.
$$\frac{\partial f}{\partial x_n} = 2x_n + \frac{A^T e^T exp(Ax+b)}{e^T exp(Ax+b)}$$
But this isn't correct, I don't think. Shouldn't ##A^T## cancel out somewhere? Can the gradient contain a matrix in the final solution?
Just write out the original function ##f = f(x_1,x_2, \ldots, x_n)## in detail so you can see what is happening; then, after finding the derivative you can re-write the answer using matrices again, if you want. So
[tex]f = \frac{1}{2} \sum_{i=1}^n x_i^2 + \log \left(\sum_{i=1}^n \exp (b_i + \sum_{j=1}^n a_{ij} x_j ) \right)[/tex]
You could also use the fact that ##\log(\sum_i (\exp(g_i)) = \prod_i g_i##, but I don't know if that makes things better or worse---you would need to try it for yourself. Also, you don't want just ##\partial f / \partial x_n##, you want all the ##\partial f / \partial x_k, k = 1,
\dots,n##.
BTW: in TeX/LaTeX you should use "\exp" instead of "exp" and "\log" instead of "log"; this applies also to the other standard functions (the trig functions, the hyperbolic functions plus things like "max", "min", "mod", etc.) The results really do look better: you get ##\exp## instead of ##exp##, ##\log## instead of ##log##, etc.