3

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?.

JuanC97
  • 612
  • 3
  • 10

1 Answers1

2

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

VarD[c[j]][a[i]]
(* 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.

jose
  • 6,328
  • 1
  • 14
  • 24
  • 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? – JuanC97 Jan 24 '19 at 05:21