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

I would like to factor the vector $v$ out of the following expression:

$-4\partial^{\mu}{(}{D \partial^{\nu}{A^{\rho}}}{)} g_{\mu \nu} g_{\rho}^{\sigma} v{\sigma}-4D \partial^{\mu}{A^{\nu}} \partial^{\rho}{(}{g_{\nu \sigma} g_{\mu \rho}}{)} g^{\alpha \sigma} v{\alpha}+4\partial^{\mu}{(}{D \partial^{\nu}{A^{\rho}}}{)} g_{\mu \rho} g_{\nu}^{\sigma} v{\sigma}+4D \partial^{\mu}{A^{\nu}} \partial^{\rho}{(}{g_{\nu \rho} g_{\mu \sigma}}{)} g^{\alpha \sigma} v{\alpha}$

My attempt so far is:

factor_out(expr,$v_{\sigma}$)
factor_out(expr,$v_{\alpha}$);

${(}{-4\partial^{\mu}{(}{D \partial^{\nu}{A^{\rho}}}{)} g{\mu \nu} g{\rho}^{\sigma}+4\partial^{\mu}{(}{D \partial^{\nu}{A^{\rho}}}{)} g{\mu \rho} g{\nu}^{\sigma}}{)} v{\sigma}+4D \partial^{\mu}{A^{\nu}} \partial^{\rho}{(}{g{\mu \sigma} g{\nu \rho}}{)} g^{\alpha \sigma} v{\alpha}-4v^{\alpha} D \partial^{\mu}{A^{\nu}} \partial^{\rho}{(}{g{\mu \rho} g{\nu \sigma}}{)} g_{\alpha}^{\sigma})$

rename_dummies(expr);

${(}{-4\partial^{\mu}{(}{D \partial^{\nu}{A^{\rho}}}{)} g{\mu \nu} g{\rho}^{\sigma}+4\partial^{\mu}{(}{D \partial^{\nu}{A^{\rho}}}{)} g{\mu \rho} g{\nu}^{\sigma}}{)} v{\sigma}+4D \partial^{\mu}{A^{\nu}} \partial^{\rho}{(}{g{\nu \rho} g{\mu \sigma}}{)} g^{\alpha \sigma} v{\alpha}-4D \partial^{\mu}{A^{\nu}} \partial^{\rho}{(}{g{\nu \sigma} g{\mu \rho}}{)} g^{\alpha \sigma} v_{\alpha})$

but as you can see I haven't managed to isolate the vector. Is there a standard way to do this?


By the way, my initial definitions are

def post_process(ex):
    sort_product(ex)
    canonicalise(ex)
    collect_terms(ex)

{x}::Coordinate;
{\mu ,\nu ,\rho ,\sigma, \alpha,\beta}::Indices{position= fixed};
\partial{#}::PartialDerivative;
g_{\mu\nu}::Metric.
g^{\mu\nu}::InverseMetric.

I wondered if adding a SortOrder might be able to help, e.g.

{v_{\mu},v_{\mu\nu},A^{\mu},D,g_{\mu\nu}}::SortOrder;

, but it had no effect.

in General questions by (120 points)
edited by

1 Answer

0 votes

The key is to use SortOrder; try

{v{#}, g{#}, \partial{#}}::SortOrder;

which should move the $v$ factors to the front of the terms. Then

rename_dummies(_);

to give the $v$ vector the same index name in every term. Finally factor_out giving the exact index name on $v$.

I agree this is sub-optimal; the general problem is hard (for reasons which are not clear from simple expressions like the one above) and we have been thinking about the best solution for some time.

by (80.3k points)

Thanks, that's interesting. By the way - my LaTeX above is failing to render on my screen. Any idea why, for future reference?

Yeah, I noticed that too, tried to fix it but no luck so far. Some MathJAX bug.

...