Method on @sym: curl (F)
Method on @sym: curl (F, x)

Symbolic curl of symbolic expression.

Consider a vector expression F:

syms f(x,y,z) g(x,y,z) h(x,y,z)
F = [f; g; h]
  ⇒ F = (sym 3×1 matrix)
      ⎡f(x, y, z)⎤
      ⎢          ⎥
      ⎢g(x, y, z)⎥
      ⎢          ⎥
      ⎣h(x, y, z)⎦

The curl of F is the vector expression:

curl(F)
  ⇒ (sym 3×1 matrix)
      ⎡  ∂                ∂             ⎤
      ⎢- ──(g(x, y, z)) + ──(h(x, y, z))⎥
      ⎢  ∂z               ∂y            ⎥
      ⎢                                 ⎥
      ⎢ ∂                ∂              ⎥
      ⎢ ──(f(x, y, z)) - ──(h(x, y, z)) ⎥
      ⎢ ∂z               ∂x             ⎥
      ⎢                                 ⎥
      ⎢  ∂                ∂             ⎥
      ⎢- ──(f(x, y, z)) + ──(g(x, y, z))⎥
      ⎣  ∂y               ∂x            ⎦

F and x should be vectors of length three. If omitted, x is determined using symvar.

Example:

syms x y z
F = [y -x 0];
curl(F, {x y z})
  ⇒ (sym 3×1 matrix)
      ⎡0 ⎤
      ⎢  ⎥
      ⎢0 ⎥
      ⎢  ⎥
      ⎣-2⎦

Example verifying an identity:

syms f(x, y, z)
curl(gradient(f))
  ⇒ (sym 3×1 matrix)
      ⎡0⎤
      ⎢ ⎥
      ⎢0⎥
      ⎢ ⎥
      ⎣0⎦

Note: assumes x is a Cartesian coordinate system.

See also: @sym/divergence, @sym/gradient, @sym/laplacian, @sym/jacobian, @sym/hessian.

Package: symbolic