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

I have a Python function orderx which seems to work

def orderx(var, n):
  maxorder=10
  for i in range(n+1,maxorder+1):
    cn=Ex(i)
    drop_weight(var, $field=@(cn)$,deep=True)
  return var

However when I call it in code like the following

gdown:=gdown_{b c} = a**2 (\eta_{b c} + h_{b c});
gup:= gup^{b c} = a**(-2)(\eta^{b c} - h^{b c}+  h^{b d} h^{c}_{d} - h^{b d} h_{d e} h^{e c});
Gamma:=\Gamma^{f}_{b c} =1/2 gup^{f d} ( \partial_{b}{gdown_{d c}} + \partial_{c}{gdown_{d b}} - \partial_{d}{gdown_{b c}});
substitute(Gamma, gup)
substitute(Gamma, gdown)
distribute(_,repeat=True)
product_rule(_)
distribute(_,repeat=True)
unwrap(_)
eliminate_metric(_,repeat=True)
rename_dummies(_)
orderx(_,3)
factor_out(_,$a**(-2)$);

It seems to lose the value of Gamma after the orderx(_,3) expression, ie the factor_out command does not work and prints out the 10 from the maxorder in the function orderex

If I use factor_out(Gamma,$a**(-2)$); it is fine.

I need to use the form "command(Gamma, etc... )" from then on, cannot use "command(_, etc)"

Its like the stream loses the last value property.

in General questions by (520 points)

1 Answer

0 votes

This is a known bug which is fixed in the current version on github.

by (76.4k points)
...