as.1form.RdGiven a vector, return the corresponding 1-form; the exterior
derivative of a 0-form (that is, a scalar function). Function
grad() is a synonym.
as.1form(v)
grad(v)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\leqslant i_i < \cdots < i_k\leqslant 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\leqslant i_i < \cdots < i_k\leqslant 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.
A one-form
as.1form(1:9) # note ordering of terms
#> An alternating linear map from V^1 to R with V=R^9:
#> val
#> 9 = 9
#> 8 = 8
#> 7 = 7
#> 6 = 6
#> 5 = 5
#> 4 = 4
#> 3 = 3
#> 2 = 2
#> 1 = 1
as.1form(rnorm(20))
#> An alternating linear map from V^1 to R with V=R^20:
#> val
#> 1 = 0.48862881
#> 14 = 1.29839276
#> 2 = -1.69945057
#> 15 = 0.74879127
#> 3 = -1.47073631
#> 16 = 0.55622433
#> 4 = 0.28415034
#> 13 = 1.92434334
#> 12 = -0.09032729
#> 11 = 0.17218172
#> 10 = -0.10993567
#> 9 = 0.60674805
#> 8 = 0.52390979
#> 7 = 1.31829338
#> 20 = -0.15569378
#> 19 = -2.61233433
#> 6 = 0.23669628
#> 18 = 1.11053489
#> 5 = 1.33732041
#> 17 = -0.54825726
grad(c(4,7)) ^ grad(1:4)
#> An alternating linear map from V^2 to R with V=R^4:
#> val
#> 1 2 = 1
#> 1 3 = 12
#> 2 3 = 21
#> 1 4 = 16
#> 2 4 = 28