5
$\begingroup$

I would like to perform a computation which involves fourth-order derivatives of a composite function of four variables. I am defining my function as

G[t_, x_, y_, z_] := (x - v*t)^2 + y^2 + z^2;
f[t_, x_, y_, z_] := f[G[t, x, y, z]];

So when I want to display the output of $f \partial_x f$ in traditional form, the command

TraditionalForm[f[t,x,y,z]*D[f[t,x,y,z],x]]

gives me $$2(x-tv)f((x-tv)^2 + y^2 + z^2)f'((x-tv)^2+y^2+z^2).$$

However, I would like to hide the independent variables here, and have TraditionalForm output an answer like $2(x-tv)ff'$ instead. I can hide the independent variables of derivatives using something like

TraditionalForm[...] /. Derivative[n_][x_][___] :> Derivative[n][x]

but I haven't been able to figure out how hide the dependent variables of the "zeroth" derivatives. Any advice would be appreciated!

$\endgroup$

2 Answers 2

3
$\begingroup$

A possible approach:

Format[f[args___], TraditionalForm] := f;
Format[Derivative[n_][fun_][args___], TraditionalForm] := Derivative[n][fun];

f[t, x, y, z]*D[f[t, x, y, z], x]
(* 2 (-t v + x) f[(-t v + x)^2 + y^2 + z^2] Derivative[1][f][(-t v + x)^2 + y^2 + z^2] *)

f[t, x, y, z]*D[f[t, x, y, z], x] // TraditionalForm

enter image description here

$\endgroup$
0
$\begingroup$

This is pretty hacky, but

G[t_, x_, y_, z_] := (x - v*t)^2 + y^2 + z^2;
f[t_, x_, y_, z_] := f[G[t, x, y, z]];
expr = f[t, x, y, z]*D[f[t, x, y, z], x];

TraditionalForm@ToExpression[
   ToBoxes[expr, TraditionalForm] /. {RowBox[{"f", __}] :> "f", RowBox[{SuperscriptBox["f", "\[Prime]", _], __}] :> SuperscriptBox["f", "\[Prime]"]}
  ]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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