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

Hello. I noticed that even when I'm writing the position = independent index properties, the eliminate_metric command can contract the expression indeces inside the partial derivative and outside, as in the following example:

{\mu,\nu,\rho,\sigma,\kappa,\lambda,\eta,\chi#}::Indices(full, position=independent);
{m,n,p,q,r,s,t,u,v,w,x,y,z,m#}::Indices(subspace, position=independent, parent=full);
{\mu,\nu,\rho,\sigma,\kappa,\lambda,\eta,\chi#}::Integer(1..4);
{m,n,p,q,r,s,t,u,v,w,x,y,z,m#}::Integer(1..3);

\partial{#}::PartialDerivative.
\nabla{#}::Derivative.
g_{\mu\nu}::Metric.
g^{\mu\nu}::InverseMetric.
g_{\mu? \nu?}::Symmetric.
g^{\mu? \nu?}::Symmetric.
h_{m n}::Metric.
h^{m n}::InverseMetric.
\delta^{\mu?}_{\nu?}::KroneckerDelta.
\delta_{\mu?}^{\nu?}::KroneckerDelta.
\delta^{m?}_{n?}::KroneckerDelta.
\delta_{m?}^{n?}::KroneckerDelta.
\delta^{\mu?}_{n?}::KroneckerDelta.
\delta_{\mu?}^{n?}::KroneckerDelta.
F_{m n}::AntiSymmetric.
\pi::Depends(\nabla{#}).

def tidy (expr):
   converge(expr):
       distribute(expr)
       product_rule(expr)
       canonicalise(expr)
   return expr

def expand_nabla(ex):
    for nabla in ex[r'\nabla']:
        nabla.name=r'\partial'
        dindex = nabla.indices().__next__() 
        for arg in nabla.args():             
            ret:=0;
            for index in arg.free_indices():
                t2:= @(arg);
                if index.parent_rel==sub:
                    t1:= -\Gamma^{\rho}_{@(dindex) @(index)};
                    t2[index]:= _{\rho};
                else:
                    t1:=  \Gamma^{@(index)}_{@(dindex) \rho};
                    t2[index]:= ^{\rho};
                ret += Ex(str(nabla.multiplier)) * t1 * t2
            nabla += ret
    return ex

    Gtog:= \Gamma^{\lambda?}_{\mu?\nu?} ->
      (1/2) * g^{\lambda?\kappa} ( 
            \partial_{\nu?}{ g_{\kappa\mu?} } + \partial_{\mu?}{ g_{\kappa\nu?} } - \partial_{\kappa}{ g_{\mu?\nu?} } );

    box:= g^{\mu \nu} \nabla_{\mu}{\nabla_{\nu}{\pi}};
expand_nabla(_);
substitute(_,Gtog);
tidy(box);
split_index(_, $\mu, m1, 4$, repeat=True)
substitute(_, $\partial_{4}{A??} -> 0$, repeat=True)
substitute(_, $\partial_{4 m?}{A??} -> 0$, repeat=True)
substitute(_, $\partial_{m? 4}{A??} -> 0$, repeat=True)
canonicalise(_);
substitute(_, $g_{4 4} -> \phi**{2}$ )
substitute(_, $g_{m 4} -> \phi**{2} A_{m}$ )
substitute(_, $g_{4 m} -> \phi**{2} A_{m}$ )
substitute(_, $g_{m n} -> h_{m n} + \phi**{2} A_{m} A_{n}$ )
substitute(_, $g^{4 4} -> \phi**{-2} +  A_{m} h^{m n} A_{n}$ )
substitute(_, $g^{m 4} -> - h^{m n} A_{n}$ )
substitute(_, $g^{4 m} -> - h^{m n} A_{n}$ )
substitute(_, $g^{m n} -> h^{m n}$ );
tidy(box);
substitute(_, $\partial_{p}{h^{n m}} h_{q m} -> - \partial_{p}{h_{q m}} h^{n m}$ )
collect_factors(_)
sort_product(_)
converge(box):
    substitute(_, $h_{m1 m2} h^{m3 m2} -> \delta_{m1}^{m3}$, repeat=True )
    eliminate_kronecker(_)
    canonicalise(_)
;
substitute(_, $\partial_{n}{A_{m}} -> 1/2*\partial_{n}{A_{m}} + 1/2*F_{n m} + 1/2*\partial_{m}{A_{n}}$ )
distribute(_)
sort_product(_)
canonicalise(_)
rename_dummies(_);
meld(_);
eliminate_metric(_);
eliminate_metric(_);

And at the end I get:
result
This is all very long, but I wanted to show the whole path that leads to the error. In fact, this kind of result is obtained with almost any option when I use eliminate_metric more than once in my program.
Is this some kind of bug or am I doing something wrong?

asked in Bug reports by (170 points)

Can you reduce this to a minimal example please?

Ok,

{m,n,p,q,r,s,t,u,v,w,x,y,z,m#}::Indices(position=independent);
{m,n,p,q,r,s,t,u,v,w,x,y,z,m#}::Integer(1..3);

\partial{#}::PartialDerivative.
h_{m n}::Metric.
h^{m n}::InverseMetric.
\delta^{m?}_{n?}::KroneckerDelta.
\delta_{m?}^{n?}::KroneckerDelta.
h_{m n}::Depends(\partial{#}).

todo:=\partial^{p}{h_{p q}} \partial_{n}{h_{r s}} h^{q n} h^{r s};
eliminate_metric(_);
eliminate_metric(_);

In the case of such an expression, even one contraction is enough
example

Well, I found a way out, by my self.
it seems that it is required to write the dependence of the metric on the derivative variables

h_{m n}::Depends(\partial{#}).
h^{m n}::Depends(\partial{#}).

Excuse for troubling.

Please log in or register to answer this question.

...