I would like to compute expressions that have the following form:

$$\left(\partial_{p_1} - \partial_{p_2}\right)^2 \left(\partial_{p_1} - \partial_{p_2}\right)^2 \frac{(p_1-p_2)\cdot(p_3-p_4)}{p_1^2p_2^2p_3^2p_4^2},\tag{1}$$

where $p_i$ are $4$-vectors in Euclidean space. Since I have many similar terms, I would like to define the $p$'s symbolically without having to give the components. I did so in the following way:

$Assumptions = (p1 | p2 | p3 | p4) \[Element] Vectors[4, Reals];

Then I tried as a first test to reproduce

$$\partial_{p_1} \left( p_1 \cdot p_2 \right) = p_2 \tag{2}$$

by typing

Div[p1.p2, p1]

but that did not work. What would be the best way to deal with computations such as the one given in $(1)$?

I should also add that eq. $(1)$ is in the context of checking and later proving an identity, so anything that could help me to check if lhs==rhs is true is relevant.


You could define a function that generates the explicit components for you:

p[i_] := Array[HoldForm[p][i], 4]

so you can use p[2] for your $p_2$ vector:

(* Out: {p[2][1], p[2][2], p[2][3], p[2][4]} *)

With that in hand we can try your simple equality; perhaps I am misunderstanding your notation here, but I am not sure how your equality holds as you wrote it:

Div[p[1] p[2], p[1]]
(* Out: p[2][1] + p[2][2] + p[2][3] + p[2][4] *)
| improve this answer | |
  • $\begingroup$ Thanks for your answer! I am not sure how useful that would be if the answer is always expanded in components, but I'll give it a try! $\endgroup$ – Jxx Nov 17 '19 at 23:43
  • $\begingroup$ Regarding the computation, I was meaning $\partial_{p_1} (p_1 \cdot p_2) = \left(\partial_{p_1^1},\partial_{p_1^2},\partial_{p_1^3},\partial_{p_1^4}\right) \sum p_1^i p_2^i = \left(p_2^1,p_2^2,p_2^3,p_2^4\right) = p_2$, with the indices at the top denoting the $i$-th component of the vector. $\endgroup$ – Jxx Nov 17 '19 at 23:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.