Removing function arguments from expressions with derivatives

( This question is basically the opposite of this one: Variable dependency...easy one )

I would like to be able to output expressions in Mathematica that look more like pen-and-paper math. In particular I want to have derivatives of functions without displaying the function arguments. Here is an example: the simple expression (let's use a Euclidean metric in both indices, where $$\phi_i$$ is a complex-valued function on the variables $$(t,x,y,z)$$ )

$$\partial^\mu \phi^i \partial_\mu \phi_i$$

becomes in Mathematica

$$\left(\phi (1)^{(0,0,0,1)}(t,x,y,z)\right)^2+\left(\phi (2)^{(0,0,0,1)}(t,x,y,z)\right)^2+\left(\phi (3)^{(0,0,0,1)}(t,x,y,z)\right)^2+\left(\phi (1)^{(0,0,1,0)}(t,x,y,z)\right)^2+\left(\phi (2)^{(0,0,1,0)}(t,x,y,z)\right)^2+\left(\phi (3)^{(0,0,1,0)}(t,x,y,z)\right)^2+\left(\phi (1)^{(0,1,0,0)}(t,x,y,z)\right)^2+\left(\phi (2)^{(0,1,0,0)}(t,x,y,z)\right)^2+\left(\phi (3)^{(0,1,0,0)}(t,x,y,z)\right)^2+\left(\phi (1)^{(1,0,0,0)}(t,x,y,z)\right)^2+\left(\phi (2)^{(1,0,0,0)}(t,x,y,z)\right)^2+\left(\phi (3)^{(1,0,0,0)}(t,x,y,z)\right)^2$$

(here is the code:

\[Phi]Vec = {\[Phi][1][t, x, y, z], \[Phi][2][t, x, y, z], \[Phi][3][
t, x, y, z]};

expr = Sum[
Table[Inactive[D][\[Phi]Vec[[i]], \[Mu]], {\[Mu], {t, x, y, z}}] .
Table[Inactive[D][\[Phi]Vec[[i]], \[Mu]], {\[Mu], {t, x, y, z}}], {i, 1, 3}]


)

The number of terms aside, the visual noise of all the arguments quickly becomes totally untenable. Absent the use of a complicated package, what strategies can we employ to remove the function arguments?

Here is my attempt. It is not a good general strategy because inactive derivatives in the definition of expr will get in the way of algebraic simplification. Here there is no simplification that needs to be done so it works anyway.

Block[{\[Phi]},
\[Phi][n_][x___] := \[Phi][n];
expr;
% /. \[Phi][i_] -> Subscript[\[Phi], i]
]


The expression becomes

$$\left(\frac{\partial \phi _1}{\partial t}\right){}^2+\left(\frac{\partial \phi _2}{\partial t}\right){}^2+\left(\frac{\partial \phi _3}{\partial t}\right){}^2+\left(\frac{\partial \phi _1}{\partial x}\right){}^2+\left(\frac{\partial \phi _2}{\partial x}\right){}^2+\left(\frac{\partial \phi _3}{\partial x}\right){}^2+\left(\frac{\partial \phi _1}{\partial y}\right){}^2+\left(\frac{\partial \phi _2}{\partial y}\right){}^2+\left(\frac{\partial \phi _3}{\partial y}\right){}^2+\left(\frac{\partial \phi _1}{\partial z}\right){}^2+\left(\frac{\partial \phi _2}{\partial z}\right){}^2+\left(\frac{\partial \phi _3}{\partial z}\right){}^2$$

• Algebraic simplification/collection aside, you might like giving definitions to Format. For example, evaluating Format[\[Phi][n_][t_, x_, y_, z_]] := Subscript[\[Phi], n] causes expr to automatically render as the "cleaned up" version Jun 23 at 2:05
• @thorimur Thanks, Format is new to me and looks very useful indeed! Jul 3 at 18:30