How can I define the nabla operator (also known as Del operator) as a an operator, acting on everything to the right of the operator!

enter image description here

Also taking \[Del]^2 would give the second derivivates.

I wish to be able to write \[Del]f[x,y,z] and then evaluate it according to the nabla operator.

What I have now, is just a simple expression:

Del = {D[#, x], D[#, y], D[#, z]} &

But it would be nice to be able to use the actual \[Del] for notation.

I've looked at different examples including: http://reference.wolfram.com/language/ref/NonCommutativeMultiply.html

But I really don't understand any of what's going on there.

  • $\begingroup$ I wonder if it is possible to use Del for the divergence and curl operators. The direct substitution of dot and cross products do not work. $\endgroup$
    – galadog
    Commented Feb 4, 2015 at 15:54
  • 2
    $\begingroup$ Your definition of the square is not consistent with conventional practice, where it would give the laplacian instead of just a vector of second derivatives. I don't think it's a good idea to overload Times and Power with these interpretations. Better use clearly distinct notation to make code easier to understand. $\endgroup$
    – Jens
    Commented Mar 5, 2015 at 17:24
  • 1
    $\begingroup$ If you are using v10, please check details sections of Grad and Laplacian, and related Div and Curl. These symbols have new input forms quite close to what you're asking for. $\endgroup$
    – kirma
    Commented Mar 5, 2015 at 19:51
  • 1
    $\begingroup$ closely related: Having the derivative be an operator $\endgroup$
    – Kuba
    Commented Mar 9, 2017 at 13:30
  • 1
    $\begingroup$ Yes, that is done automatically. Try HoldForm[Curl[v, {x, y, z}]] and see how it formats. This is different from interpreting that form when you enter it. Traditional notation is ambiguous. When you are talking to a computer you want to be clear and unambiguous. $\endgroup$
    – Szabolcs
    Commented Mar 9, 2017 at 14:08

3 Answers 3


Well, over-pursuing similarity of Mathematica code and traditional math notation does more harm than good, still, it's possible to create a nabla operator in Mathematica, here's my approach:

$PrePrint = # /. 
    Derivative[id__][f_][args__] :> 
      HoldForm@D[f[args], ##] &[
       Sequence @@ (DeleteCases[Transpose[{{args}, {id}}], {_, 0}] /. {x_, 1} :> x)]] &;

Clear[$independentVariable, ▽, Δ]
$independentVariable = {x, y, z};
▽ /: ▽ f_ := Grad[f, $independentVariable]
▽·f_ := Div[f, $independentVariable]
▽ /: ▽\[Cross]f_ := Curl[f, $independentVariable]
▽·▽ := Δ
▽ /: ▽^2 := Δ
Δ /: Δ f_ := Laplacian[f, $independentVariable]
CenterDot /: (v_·▽) f_ := Grad[f, $independentVariable].v
CenterDot /: (m_?MatrixQ·▽)\[Cross]f_ := 
 TensorContract[LeviCivitaTensor[3].D[f, {$independentVariable}].m\[Transpose], {2, 3}]


▽ f[x, y, z]

Mathematica graphics

▽·{f[x, y, z], g[x, y, z], h[x, y, z]}

Mathematica graphics

▽\[Cross]{f[x, y, z], g[x, y, z], h[x, y, z]}

Mathematica graphics

▽·▽ f[x, y, z]
▽^2 f[x, y, z]
Δ f[x, y, z]

Mathematica graphics

({Subscript[v, x], Subscript[v, y], Subscript[v, z]}·▽) f[x, y, z]

Mathematica graphics

({Subscript[v, x], Subscript[v, y], Subscript[v, z]}·▽){f[x, y, z], g[x, y, z],h[x, y, z]}

Mathematica graphics

Alst = Array[Subscript[A, ##] &, {3, 3}];
vector = #[x, y, z] & /@ {u, v, w};
test1 = (Alst·▽)\[Cross]vector

Mathematica graphics

Notice the · is \[CenterDot], and is \[EmptyDownTriangle] rather than \[Del].

To type easier, try the technique in this and this post.

Not sure if the solution will fail in more complicated cases.

BTW the $PrePrint function is modified from the code here.

  • 2
    $\begingroup$ I have merged these questions moving your answer in the process, as requested. $\endgroup$
    – Mr.Wizard
    Commented Mar 12, 2017 at 6:33

Does it not work as written?

enter image description here

Del = {D[#, x], D[#, y], D[#, z]} &;

∇f[x, y, z]


To extend this in the way that I believe you want you can use the Notation Package.



Then paste and evaluate:

 RowBox[{"Notation", "[", 
       SuperscriptBox["\[Del]", "n_"], "expr_"}]},
    "NotationTemplateTag"], " ", "\[DoubleLongRightArrow]", " ", 
       RowBox[{"del", "[", "n_", "]"}], "[", "expr_", "]"}]},
    "NotationTemplateTag"]}], "]"}]], "Input"]

Which should look like this in the Notebook:

enter image description here

(Or enter the equivalent using the Notation Palette.)

Then add these definitions:

Del = del[1];

del[n_Integer?Positive][expr_] := D[expr, {#, n}] & /@ {x, y, z}


enter image description here




  • $\begingroup$ It does seem to Work for just \[del], But do you also know if there is any way to make mathematica interpret the \[Del]^2f[x,y,z] as the second derivatives of the function f[x,y,z]? $\endgroup$
    – TehHO
    Commented Feb 3, 2015 at 9:48
  • $\begingroup$ @TehHO Possibly so, but my first attempt failed. I'll work on it. $\endgroup$
    – Mr.Wizard
    Commented Feb 3, 2015 at 9:58
  • $\begingroup$ Well, as far as I can tell, \[Del]^2 represent Laplacian and there is no definition for \[Del]^3, see the corresponding wiki page for more details. $\endgroup$
    – xzczd
    Commented Mar 12, 2017 at 4:44


grad[f_] := {D[f, x], D[f, y], D[f, z]}


grad[x + y]


{1, 1, 0}

Your Answer

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

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