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

Hi,

I was looking for a rule involving partial derivative action on a tensor. Suppose I have an expression like

\begin{align} \partial_{a} A^{a}+ A_{a}B^{a} + (\partial_{a b}A_{a}) B^{b} + \partial_{b}A_{a} \partial^{b}B^{a} \end{align}

I wish to define a rule such that I need to set the quadratic terms that involves the derivatives to vanish , i.e, I need to set $\partial_{a b}{A_{a}} B^{b} \rightarrow 0, \partial_{b}A_{a} \partial^{b}B^{a} \rightarrow 0$, I am not abe to get a proper rule to do this.

Also is there any way in which I can also set a partial derivative that involves any no f derivatives to zero, like I need to set \begin{align} \partial_{a} A^{c} =0; \partial_{a b} A^{c}=0; \end{align}

etc

I was thinking of something like

ex:= \partial{#}{A{#}} -> 0;

But didnt seem to work. can you please help me out

in Feature requests by (650 points)

1 Answer

0 votes
 
Best answer

Hi, I've got a similar problem before, and it is due (to my understanding) to the fact that cadabra uses the notation

$\partial_{ab}$

to denote

$\partial{a}\partial{b}.$

I solved my problem by adding a dummy symbol that can be then set to one after the simplification (if it is still around), I used the symbol I in the ex2 below

{a,b,c}::Indices.
\partial{#}::PartialDerivative.

ex := \partial_{a}{ A^a } + A_a B^a + \partial_{a}{ \partial_{b}{ A^a }} B^b 
    + \partial_{a}{ A^b } \partial_{b}{ B^a };
ex2 := \partial_{a}{ A^a } + A_a B^a + \partial_{a}{ I \partial_{b}{ A^a }} B^b 
    + \partial_{a}{ A^b } \partial_{b}{ B^a };
rl := \partial_{a}{ A^{b} } -> 0;

substitute(ex, rl);

substitute(ex2, rl);

See the result here

Hope this can be useful.


Update:

Another solution is that you could declare \partial{#}::Derivative. instead of like a partial derivative. The difference is that Derivative does not simplify the notation

$\partial{a}\partial{b}$

to

$\partial_{ab},$

and the substitution works properly.

See the updated code and result

by (13.2k points)
edited by

Hi,

Thanks for the suggestions and i will try to incorporate this in the code. But the problem is that this was just a prototype of a long result i had after a number of computations , so is there any way in which i can include this "I" in the expressions..because i am using distribute and product rule for getting this result and if i include "I" in the begining this might get lost..

Another solution is that you could declare \partial{#}::Derivative. instead of like a partial derivative. The difference is that Derivative does not simplify the notation \partial_a \partial_b to \partial{{ab}, and the substitution works properly.

I've updated the answer.

...