Hi,
I couldn't find any mention of the Lie derivative in any documentation of Cadabra (this website, github, additional literature).
I'm trying to write a method that expands the expression Lie_V{\<tensor-with_free_indices>} into the formula of the Lie derivative with partial derivatives. The method will be something like
expand_Lie(ex,$V$,$m$)
The first argument is some expression that has inside "L{...}", the second argument is the vector, and the third argument is for a dummy index.
I started working with the code in p.36 of "The Cadabra Book.pdf" (by Peeters) - this implements expansion of the covariant derivative (nabla).
I need help to add a dummy index to the first term (replacing "L{..}") and multiplying it by the vector. My code currently changes the name "L" into the "v^{p} \partial_{p}" but I think this is incorrect.
def expand_Lie(ex,v,dummy):
for Lie in ex["L"]:
Lie.name=r"v^{p} \partial_{p}"
#Lie.indices().add(@(dummy)})
#Lie *= v^{@(dummy)}
for arg in Lie.args():
ret:=0;
for index in arg.free_indices():
t2:= @(arg);
if index.parent_rel==sub:
t1:= \partial_{@(index)}{v^{@(dummy)}};
t2[index]:= _{@(dummy)};
else:
t1:= -\partial_{@(dummy)}{v^{@(index)}};
t2[index]:= ^{@(dummy)};
ret += Ex(str(Lie.multiplier)) * t1 * t2
Lie += ret
return ex
`