I'd like to compute the derivative (Jacobian) of the function $\mathbf{\Psi\left(\mathbf{F}\right)}$ w.r.t. $\mathbf{F}$ where $\mathbf{F}$ is a 2x2 matrix and $G$ and $v$ are just real constants;

$$ \begin{align} \Psi(\mathbf{F}) &= \frac{\mu}{2} \left( \text{tr}\left(\mathbf{F}^\top \mathbf{F}\right)-2\right)- \mu\log(\text{det}\left(\mathbf{F}\right)) + \frac{\lambda} {2}\log^2\left({\text{det}\left(\mathbf{F}\right)}\right)\\ \mu &= \frac{G}{2\left(1+v\right)}\\ \lambda &= \frac{Gv}{(1+v)(1-2v)}\\\\ G, v &\in {\rm I\!R}\\ \mathbf{F} &\in {\rm I\!R}^{2\times2}\\\\ \frac{\partial\mathbf{\Psi}}{\partial\mathbf{F}} &= \text{?} \end{align} $$

I've come up with the following formula for MMA, but I'm not sure if it produces the correct result;

F = Array[a, {2, 2}]

   G/(2*(1 + v))             * (Tr[Transpose[F]*F] - 2) - 
   G/(2*(1 + v))             * Log[Det[F]] + 
   G*v/(2*(1 + v)*(1 - 2*v)) * Log[Det[F]]^2,
{F}] // MatrixForm // Simplify

Is there any mistake in the code? And even if there'd be no mistake, can I get a better-formatted result (maybe using matrix operations, instead of explicit usage of the matrix's elements, when possible)? (Please bear in mind I'm absolute beginner with Mathematica.)


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.