# Exploring curl of a gradient of a scalar function

Suppose I want to explore $$\nabla \times \nabla V$$ where $$V$$ is some scalar function. It basically results in a zero. But I would only know why if I solve it on paper. I wanted to use Mathematica for it and I have found some solutions but I want something cleaner.

pdConv[
Curl[{Subscript[f, x][x, y, z], Subscript[f, y][x, y, z], Subscript[f, z][x, y, z]},
{x, y, z}
] /. {Subscript[f, x] -> Defer[D[V, x]],
Subscript[f, y] -> Defer[D[V, y]],
Subscript[f, z] -> Defer[D[V, z]]}
]


This gives this output:

I did have to do some unpleasant hackery and the other simpler attempt is

pdConv[Curl[{Hold[D[V[x, y, z], x]],
Hold[D[V[x, y, z], y]],
Hold[D[V[x, y, z], z]]}, {x, y, z}]]


This gives this output

which is just perfect, but I don't like the Hold appearing in the output and HoldForm,Inactivate,Inactive give weird stuff.

I have copied a function called pdConv from the Wolfram Blog that converts partial differential expressions to TraditionalForm. It is really helpful. Here is its definition:

pdConv[f_] := TraditionalForm[f /. Derivative[inds__][g_][vars___] :>
(Defer[D[g[vars],##1]] & ) @@ (Transpose[{{vars}, {inds}}] /. {{var_, 0} :>
Sequence[], {(var_)*1} :> {var}})]


What would be some more cleaner approaches?

• Not sure why you need all this machinery: Curl[Grad[f[x, y, z], {x, y, z}], {x, y, z}] returns {0, 0, 0} directly. You can also apply pdConv to the intermediate result of Grad, but I would not do computation of the results of *Form functions, as those are output wrappers only ("pretty-printers"). – MarcoB Jan 3 at 19:51

SetSystemOptions["DifferentiationOptions" -> "ExcludedFunctions" ->

You can now use your code with HoldForm instead of Hold. I'm a bit surprised that HoldForm isn't in that list by default. I'll see about adding it to get it to format as you want.