Let's say I have an expression like $\,a^{I}=2b^{I}+3c^{I}$ where $I$ stands for an arbitrarily large set of indices. It's known that $\,\frac{\partial a^K}{\partial c^{L}}=3\,\delta^K_L$ (equals a product of Kronecker deltas) but, how can I do that in Mathematica using packages like XAct, Xpert and any else related to XTensor.

(i) How could I achieve that?.

(ii) Also, notice that I asumed that $\,b \neq b(c)$, how can I tell Mathematica to do so when computing the partial derivative?.


Try something like this:

<< xAct`xTensor`

DefManifold[M, 4, {i, j, k, l}]

DefTensor[b[i], M]
DefTensor[c[i], M]

Then define

a[i_] := 2 b[i] + 3 c[i]

Finally you can compute

(* 3  delta[-j, i] *)

Recall that -j is a covariant index in xAct.

There will be an error warning about differentiation of a non-scalar. For simple cases like this , you can ignore that message.

  • $\begingroup$ That works well, thanks. Now, what would happen if $a_i$ is not a tensor anymore, $c_i=\partial_i\phi$ and I want to compute something like $\frac{\partial a_i}{\partial(\,\partial_j\phi\,)}$. How could I do it in that case? $\endgroup$ – JuanC97 Jan 24 '19 at 5:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.