Simplify function notation
I propose a whitelist approach for functions you do want to display the contents of:
clean[expr_] :=
HoldForm[expr] /.
(h : Except[HoldForm | Equal | Power | Times | Plus | Log | Subscript])[args___] :> h
eqn = Subscript[R, ttϕ]^ϕ ==
D[ξ[r, z], r] D[ξ[r, z], z] Exp[4 ψ[r, z] - 2 ν[r, z]]/ξ[r, z];
eqn // clean
You have already shown how to handle the special case of Derivative
which can be combined with this method.
Alternatively you could show only full expressions for functions in a given context, e.g. System`
:
clean2[expr_] :=
HoldForm[expr] /.
h_Symbol[args___] /; Context@Unevaluated@h =!= "System`" :> h
eqn // clean2
Again this doesn't handle the case of Derivative
or SubValues
functions.
Restrict on arguments
As others have mentioned replacing all functions with arguments with just their names wouldn't leave you with something very useful, so you have to make some restrictions. It has been shown how you can restrict for which functions such replacements should be made. What I would like to add is the possibility to make such redefinitions only for certain kinds of arguments. This could be as simple as:
eqn = Subscript[R, ttϕ]^ϕ ==
D[ξ[r, z], r] D[ξ[r, z],
z] Exp[4 ψ[r, z] - 2 ν[r, z]]/ξ[r, z];
(eqn // pdConv) /. {f_[r, z] :> f}
for the example you gave.
Formal Parameters
A feature that is available since Mathematica 7 are special names for "formal parameters" which are Protected
so you can be reasonably sure they won't have values. I think it's just such formula type expressions as yours that these were introduced, so you might want to use them for your arguments. If you do so you could make this approach somewhat more general: First define the helper function:
formalQ[___] = False;
formalQ[x_Symbol] := StringMatchQ[
ToString[x, CharacterEncoding -> "ASCII"], "\\[Formal" ~~ __
];
and then define your expressions using those formal parameters (which you can enter with e.g. Esc-$-x-Esc).
eqn = Subscript[R, ttϕ]^ϕ ==
D[ξ[\[FormalR], \[FormalZ]], \[FormalR]] D[ξ[\[FormalR], \
\[FormalZ]], \[FormalZ]] Exp[
4 ψ[\[FormalR], \[FormalZ]] -
2 ν[\[FormalR], \[FormalZ]]]/ξ[\[FormalR], \[FormalZ]];
and now use something like this to get the desired simplification:
(eqn // pdConv) /. {f_[__?formalQ] /; Context[f] =!= "System`" :> f}
Interpretation
Another thing I would like to mention is that you could make your results look the way you want but still evaluate correctly by using Interpretation
. The following does this for a combination of pdConv
, the above replacement and some additional formatting so one can immediately see which of the variables are actually functions with left out parameters:
formatEqn[expr_] := Interpretation[TraditionalForm[
expr /. {
Derivative[inds__][g_][vars__] :> Interpretation[Apply[
HoldForm[D[g[vars], ##]] &, Transpose[{{vars}, {inds}}] /. {
{var_, 0} :> Sequence[],
{var_, 1} :> {var}
}],
Derivative[inds][g][vars]]
} /. {
\[FormalF]_Symbol[\[FormalA]__?formalQ] /;
Context[\[FormalF]] =!= "System`" ->
Interpretation[
Style[\[FormalF], RGBColor[0, 0.6, 0],
Bold], \[FormalF][\[FormalA]]]
}
],
expr
];
You should now be able to copy the result (or parts of it), paste to a new input cell and evaluate that new cell. It would also be possible to programmatically do further work with the result given above with something like this:
formattedEqn = eqn // formatEqn
(ToExpression[ToBoxes[formattedEqn]] /. ξ->Function[Sin[#1]*Cos[#2]])// formatEqn
I'm guess that this will not exactly match your needs but think with this and the information others gave and some further reading of the documentation of the functions used/mentioned above you should be well prepared to exactly build what you need...
As suggested in the comments
eqn =
Subscript[R, ttϕ]^ϕ ==
D[ξ[r, z], r] D[ξ[r, z],
z] Exp[4 ψ[r, z] - 2 ν[r, z]]/ξ[r, z]
Using a Format
rule:
Format[ξ[r, z]] = ξ;
Format[ψ[r, z]] = ψ;
Format[ν[r, z]] = ν;
eqn