
volumefunction (n)
{
as.kform(seq_len(n))
}
To cite the stokes package in publications, please use
Hankin (2022); this function monograph
discusses volume(). Spivak (1965), in a memorable passage,
states:
The volume element
The fact that is probably not new to you, since is often defined as the unique element such that . For a general vector space there is no extra criterion of this sort to distinguish a particular . Suppose, however, that an inner product for is given. If and are two bases which are orthonormal with respect to , and the matrix is defined by , then
In other words, if denotes the transpose of the matrix , then we have , so . It follows from Theorem 4-6 that if satisfies , then . If an orientation for has also been given, it follows that there is a unique such that whenever is an orthornormal basis such that . This unique is called the volume element of , determined by the inner product and orientation . Note that is the volume element of determined by the usual inner product and usual orientation, and that is the volume of the parallelepiped spanned by the line segments from to each of .- Michael Spivak, 1969 (Calculus on Manifolds, Perseus books). Page 83
In the stokes package, function volume(n)
returns the volume element on the usual basis, that is,
.
We will take
as an example:
(V <- volume(7))## An alternating linear map from V^7 to R with V=R^7:
## val
## 1 2 3 4 5 6 7 = 1
We can verify Spivak’s reasoning as follows:
f <- as.function(V)
f(diag(7))## [1] 1
Above, we see that . To verify that , where :
## LHS RHS diff
## 1.770074 1.770074 0.000000
Now we create , another orthonormal set. We may verify by generating a random orthogonal matrix and permuting its rows:
M1 <- qr.Q(qr(matrix(rnorm(49),7,7))) # M1: a random orthogonal matrix
M2 <- M1[c(2,1,3,4,5,6,7),] # M2: (odd) permutation of rows of M1
c(f(M1),f(M2))## [1] 1 -1
Above we see that the volume element of M1 and
M2 are
to within numerical precision.