
To cite the stokes package in publications, please use
Hankin (2022). This function monograph
discusses convenience objects dx, dy, and
dz, corresponding to elementary differential forms (basis
vectors
,
,
are discussed in vignette ex).
Spivak (1965), in a memorable passage, states:
Fields and forms
If is differentiable, then . By a minor modification we therefore obtain a -form , defined by
Let us consider in particular the -forms 1. It is customary to let denote the function (on we often denote , , and by , , and ) Since , we see that is just the dual basis to .
- Michael Spivak, 1969 (Calculus on Manifolds, Perseus books). Page 89
Spivak goes on to observe that every
-form
can be written
.
If working in
,
we have three elementary forms
,
,
and
;
in the package we have the pre-defined objects dx,
dy, and dz. These are convenient for
reproducing textbook results.
We conceptualise dx as “picking out” the
-component
of a 3-vector and similarly for dy and dz.
Recall that
and we have
Noting that -forms are a vector space, we have in general
Numerically:
v <- c(2,3,7)
c(as.function(dx)(v),as.function(dx+dy)(v),as.function(dx+100*dz)(v))## [1] 2 5 702
As Spivak says, dx, dy and dz
are conjugate to
and these are defined using function e(). In this case it
is safer to pass n=3 to function e() in order
to specify that we are working in
.
e(1,3)## [1] 1 0 0
e(2,3)## [1] 0 1 0
e(3,3)## [1] 0 0 1
We will now verify numerically that dx, dy
and dz are indeed conjugate to
,
but to do this we will define an orthonormal set of vectors
:
u <- e(1,3)
v <- e(2,3)
w <- e(3,3)
matrix(c(
as.function(dx)(u), as.function(dx)(v), as.function(dx)(w),
as.function(dy)(u), as.function(dy)(v), as.function(dy)(w),
as.function(dz)(u), as.function(dz)(v), as.function(dz)(w)
),3,3)## [,1] [,2] [,3]
## [1,] 1 0 0
## [2,] 0 1 0
## [3,] 0 0 1
Above we see the conjugacy clearly [obtaining as expected].
The elementary forms may be combined with a wedge product. We note that and, for example,
and
Numerically:
as.function(dx ^ dy)(cbind(c(2,3,5),c(4,1,2)))## [1] -10
Above we see the package correctly giving .
Here I give some illustrations of the package print method.
dx## An alternating linear map from V^1 to R with V=R^1:
## val
## 1 = 1
This is somewhat opaque and difficult to understand. It is easier to start with a more complicated example: take :
(X <- dx^dy -7*dx^dz + 3*dy^dz)## An alternating linear map from V^2 to R with V=R^3:
## val
## 1 3 = -7
## 2 3 = 3
## 1 2 = 1
We see that X has three rows for the three elementary
components. Taking the row with coefficient
[which would be
],
this maps
to
and we have
The other two rows would be
and
Thus form would be, by linearity
We might want to verify that :
dx ^ dy == -dy ^ dx## [1] TRUE
The print method is configurable and can display kforms in symbolic
form. For working with dx dy dz we may set option
kform_symbolic_print to dx:
options(kform_symbolic_print = 'dx')Then the results of calculations are more natural:
dx## An alternating linear map from V^1 to R with V=R^1:
## + dx
dx^dy + 56*dy^dz## An alternating linear map from V^2 to R with V=R^3:
## + dx^dy +56 dy^dz
However, this setting can be confusing if we work with , for the print method runs out of alphabet:
rform()## An alternating linear map from V^3 to R with V=R^7:
## +6 dy^dNA^dNA +5 dy^dNA^dNA -9 dNA^dNA^dNA +4 dx^dz^dNA +7 dx^dNA^dNA -3 dy^dz^dNA -8 dx^dNA^dNA +2 dx^dy^dNA + dx^dNA^dNA
Above, we see the use of NA because there is no defined
symbol.
Function hodge() returns the Hodge dual:
hodge(dx^dy + 13*dy^dz)## An alternating linear map from V^1 to R with V=R^3:
## +13 dx + dz
Note that calling hodge(dx) can be confusing:
hodge(dx)## [1] 1
This returns a scalar because dx is interpreted as a
one-form on one-dimensional space, which is a scalar form. One usually
wants the result in three dimensions:
hodge(dx,3)## An alternating linear map from V^2 to R with V=R^3:
## + dy^dz
This is further discussed in the dovs vignette.
Package function d() will create elementary one-forms
but it is easier to interpret the output if we restore the default print
method
## An alternating linear map from V^1 to R with V=R^8:
## val
## 8 = 1
Following lines create dx.rda, residing in the
data/ directory of the package.
save(dx, dy, dz, file="dx.rda")Spivak introduces the notation on page 11: “if is the identity function, , then [its components are] ; the function is called the projection function”↩︎