Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+1 vote

I wish to compute the explicit expression of $p^\alpha (\partial_\alpha F^{\mu\nu}) p_\nu$ (among others) where $p^\alpha$ is the four-momentum and $F^{\mu\nu}$ is the electromagnetic field tensor as a function of the electromagnetic fields $\boldsymbol{E}$ and $\boldsymbol{B}$. I use the Minkowski $(1,-1,-1,-1)$ metric.

Here's what I have tried:

{t,x,y,z}::Coordinate;
{\mu,\nu,\alpha}::Indices(values={t,x,y,z},position=fixed); 
\partial{#}::PartialDerivative;

g_{\mu\nu}::Metric(signature=1);

F^{\mu\nu}::AntiSymmetric;
F^{\mu\nu}::Depends(t,x,y,z,\partial{#});
p_{\mu}::Depends(t,x,y,z,\partial{#});
Ex::Depends(t,x,y,z,\partial{#});
Ey::Depends(t,x,y,z,\partial{#});
Ez::Depends(t,x,y,z,\partial{#});
Bx::Depends(t,x,y,z,\partial{#});
By::Depends(t,x,y,z,\partial{#});
Bz::Depends(t,x,y,z,\partial{#});
px::Depends(t,x,y,z,\partial{#});
py::Depends(t,x,y,z,\partial{#});
pz::Depends(t,x,y,z,\partial{#});

ss:= { g_{t t} = 1, g_{x x} = -1, g_{y y} = -1, g_{z z} = -1}.
complete(ss, $g^{\mu\nu}$);

fieldtensor:= {F^{t x} = -Ex, F^{t y} = -Ey,F^{t z} = -Ez, F^{x y} = -Bz,F^{x z} = By,F^{y z} = -Bx,p^{t} = \gamma*m*c,p^{x} = px,p^{y} = py,p^{z} = pz,p_{t} = \gamma*m*c,p_{x} = -px,p_{y} = -py,p_{z} = -pz};

firstTerm:= f^{\mu} = p^{\alpha} \partial_{\alpha}{F^{\mu\nu}} p_{\nu};
substitute(firstTerm, fieldtensor);

However, this prints

Cadabra output

and use of the evaluate algorithm results in $f^\mu=0$.

What's the proper way to evaluating these components?

in General questions by

1 Answer

+2 votes

When you declare functions to depend on coordinates, do not also in addition make them depend on \partial{#}, that will (at present) make the component engine go belly-up. So just use

Ex::Depends(t,x,y,z);

and so on. Secondly, do not use your component rules (the fieldtensor bit) in a substitution rule. Instead of doing that substitute(firstTerm, fieldtensor), just use

evaluate(firstTerm, fieldtensor);

Finally, be prepared for a somewhat bumpy ride. There are still (known and probably unknown) bugs in the component engine which may be triggered in your particular problem. Any feedback is welcome though.

by (80.3k points)

Ah, this indeed solved the issue of $f^\mu$ evaluating to $0$. However, it seems to evaluate only three of the four components of the vector:

Only three components are evaluated, instead of four.

I can attest that the temporal component is correct. I will manually verify the other ones as well.

Related question, it is possible to define the field tensor and the momentum vector in separate variables, such as fieldtensor:= {F^{t x} = ..} and mom:= {p_{t} = ...} and then use evaluate for both these variables, like evalute(firstTerm, fieldtensor); evaluate(_,mom) or something like that? That way I could use complete or another algorithm to compute the covariant and contravariant versions of the field tensor and momentum vector.

...