The exterior derivative of a \(k\)-form \(\phi\) is a
\((k+1)\)-form \(\mathrm{d}\phi\) given by
$$
\mathrm{d}\phi
\left(
P_\mathbf{x}\left(\mathbf{v}_i,\ldots,\mathbf{v}_{k+1}\right)
\right)
=
\lim_{h\longrightarrow 0}\frac{1}{h^{k+1}}\int_{\partial
P_\mathbf{x}\left(h\mathbf{v}_1,\ldots,h\mathbf{v}_{k+1}\right)}\phi
$$
We can use the facts that
$$
\mathrm{d}\left(f\,\mathrm{d}x_{i_1}\wedge\cdots\wedge\mathrm{d}x_{i_k}\right)=
\mathrm{d}f\wedge\mathrm{d}x_{i_1}\wedge\cdots\wedge\mathrm{d}x_{i_k}
$$
and
$$
\mathrm{d}f=\sum_{j=1}^n\left(D_j f\right)\,\mathrm{d}x_j
$$
to calculate differentials of general \(k\)-forms. Specifically, if
$$
\phi=\sum_{1\leq i_i < \cdots < i_k\leq n} a_{i_1\ldots
i_k}\mathrm{d}x_{i_1}\wedge\cdots\wedge\mathrm{d}x_{i_k}
$$
then
$$
\mathrm{d}\phi=
\sum_{1\leq i_i < \cdots < i_k\leq n}
[\sum_{j=1}^nD_ja_{i_1\ldots
i_k}\mathrm{d}x_j]\wedge\mathrm{d}x_{i_1}\wedge
\cdots\wedge\mathrm{d}x_{i_k.}
$$
The entry in square brackets is given by grad()
. See the
examples for appropriate R idiom.