Vector calculus expression formatting

I have the following example vector calculus code

gg := g[x, y, z];
gg[x_, y_, z_] := g[x, y, z];
Format[g[x, y, z]] = g;

f = Grad[x*gg, {x, y, z}];
f // MatrixForm // pdConv


which produces the output $$\displaystyle{\left( \begin{array}{c} x \frac{\partial g }{\partial x}+g\\ x \frac{\partial g }{\partial y}\\ x \frac{\partial g }{\partial z}\\ \end{array} \right)}$$ But I would like the output format to be $$x \nabla g + \left( \begin{array}{c} g \\ 0 \\ 0 \\ \end{array} \right)$$

Is there a way to accomplish this?

The above of course is a simple example. I would like to have a code that finds the gradient terms and extracts them.

I'm using the pdConv function

• Del is undefined: reference.wolfram.com/language/ref/Del.html I would say define del and then expand it? – CA Trevillian Jun 11 at 3:58
• @CATrevillian the hard part is recognizing when the partials in a 3D vector (ie a list) can be combined after performing a calculation – RFS Jun 11 at 16:33
• You could possibly define your own simplification rule? I will visit this later today and provide the reference if I can find it. – CA Trevillian Jun 11 at 21:33
• @CATrevillian Thank you! – RFS Jun 12 at 1:46