# How to define custom operator for working with tensors with multiple indices?

I've symmetric tensor $$h(z)$$ with rank $$s$$.

Instead of writing symmetric tensor with its components I use the following notation

$$h^{(s)}(z;a) = \sum_{\mu_i}(\prod_{i=1}^{s}a^{\mu_i})h^{(s)}_{\mu_1\mu_2 ... \mu_s}(z)$$

And I use the following $$*_{a}$$ operator for contracting tensors in this notation

$$*_{a} = \frac{1}{(s!)^2}\prod_{i=1}^{s} \overset{\leftarrow}{\partial^{\mu_i}_{a}} \overset{\rightarrow}{\partial_{\mu_i}^{a}}$$

Arrows on derivatives show the direction of differentiation.

with this operator, tensor contraction can be written without components.

$$g^{(s)}(z;a) *_a h^{(s)}(z;a) = g^{\mu_1\mu_2...\mu_s} h_{\mu_1\mu_2...\mu_s} = gh$$

Now I'm trying to implement this operator in Wolfram Mathematica, but all my attempts failed. Is it possible to define such an operator in Mattematica, and if yes how can I achieve that?

• "I use the following notation" - how is it represented in Mathematica? – J. M.'s technical difficulties Sep 26 '18 at 6:18
• @Melik Karapetyan Do you have a clear example of using this definition? – Alex Trounev Sep 26 '18 at 6:31
• I don't get it. Your method is a very obfuscated way of writing Flatten[g].Flatten[h]. – Henrik Schumacher Sep 26 '18 at 8:03
• I've took the notation from arxiv.org/pdf/1002.1358.pdf I'm trying to automate the computation with this notation using Mathematica and searching a way to represent it in Matematica. The clear example of using this definition can be found on Section 1 of that paper. – Melik Karapetyan Sep 26 '18 at 9:43