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

I'm trying to use the zoom command to focus on some terms in an expression. Strangely enough it only picks out one of the two terms that contain the piece that I want to zoom in on in one case. And it doesn't pick out the only term that fits my criterion in the other case. What am I doing wrong?

Here's my example code. In one case, I tried to zoom in on terms that contain \delta(g)^{\mu \nu} of which there are two but it only returns one of them. In the other case, I tried to zoom in on the lone term containing a \delta(F)_{\mu \nu} but it returns nothing.

{ \alpha, \beta, \mu, \nu, \lambda, \kappa, \rho, \sigma, \sigma# }::Indices(total, position=independent).

{\nabla{#}, \delta{#}}::Derivative.

g_{ \mu \nu }::Metric.
g^{ \mu \nu }::InverseMetric.
g_{ \mu? \nu? }::Symmetric.
g^{ \mu? \nu? }::Symmetric.
g{#}::Depends(\nabla{#}, \partial{#}, \delta{#}).
\delta(g)^{\mu \nu}::Symmetric.

F_{\mu? \nu?}::AntiSymmetric.
F^{\mu? \nu?}::AntiSymmetric.
\delta{F}_{\nu? \rho?}::AntiSymmetric.

F{#}::Depends(\nabla{#}, \partial{#}, \delta{#}).

ex:= L = - \sqrt{g} \frac{1}{4} g^{\mu \alpha} g^{\nu \beta} F_{\alpha \beta} F_{\mu \nu} ;
varyex:= \delta{L}.
substitute(varyex, ex)

product_rule(varyex, repeat=True)
sort_product(varyex, repeat=True)
distribute(varyex, repeat=True)
collect_factors(varyex, repeat=True)

substitute(varyex, $\delta(g) -> - g (g_{\mu \nu} \delta(g)^{\mu \nu})$, repeat=True)
collect_factors(varyex, repeat=True)

meld(_, repeat=True);

zoom(_, $\delta(g)^{\mu? \nu?} Q??$);

zoom(_, $\delta(F)_{\mu \nu} Q??$);
in General questions by (740 points)

1 Answer

0 votes

Hi Jsem.

  • I'd first suggest that you show the results of your manipulations. Many of your calculations are a waste of time.
  • If you see the suggested notation for derivatives is to use curly bracket, not bracket. Example: \delta{L} instead of \delta(L).
  • When you derive an object with indices, the indices should be inside the curly brackets. Example: \delta{g^{\mu \nu}} instead of \delta{g}^{\mu \nu}

When you apply the last suggestion to your substitution rule, the zoom algorithm yields the expected result.

What was going on?

If you take the "incorrect" result, copy it (sellect it with the mouse and use Ctrl+C from the keyboard), and paste it in a editor, you'd get something like this:

\begin{dmath*}{} - \frac{1}{2}\sqrt{g} F_{\alpha \beta} F_{\mu \nu} \delta{g^{\mu \alpha}} g^{\nu \beta} - \frac{1}{2}\sqrt{g} F_{\alpha \beta} \delta{F_{\mu \nu}} g^{\alpha \mu} g^{\beta \nu}+\frac{1}{8}F_{\alpha \beta} F_{\mu \nu} \sqrt{g} g_{\lambda \kappa} \delta{g}\,^{\lambda \kappa} g^{\mu \alpha} g^{\nu \beta}\end{dmath*}

There, you'll see that the two terms containing the $\delta g^{\mu\nu}$ differ in the "scope" of the derivative.

by (14.1k points)



In my notebooks (on a Mac), I am not able to select anything in the output/result cells. So I'm unable to detect what you are saying about the "scope" of the derivative.