mvmesh-package: Multivariate meshes and histograms in arbitrary dimensions

Description Details Programming details and notes Examples

Description

Define, manipulate and plot multivariate meshes/grids in n-dimensional Euclidean space. Multivariate histograms based on these meshes are provided.

Details

A range of multivariate problems require working with simplices, spheres, balls, rectangular and tubular meshes in dimension n > 1. The multivariate histogram functions in this package provide routines to tabulate and display multivariate data. For example, directional histograms tablulate the number of points in a sequence of directions, see function histDirectional. Multivariate stable distributions and multivariate extreme value distributions are defined by a measure on a sphere or simplex. Also, simulation of generalized spherical laws involves a triangulation of some surface. Numerical quadrature problems on a region or surface in n space require the ability to specify and work with meshes, e.g. packages SphericalCubature and SimplicialCubature. Finally, these meshes can be used on their own to create and plot multivariate shapes not in the rgl package.

A key goal for this package is that the dimension n is not limited to 2 or 3, but in principle can be arbitrary. Of course, as n increases compute times and required memory will increase quickly. This package uses existing methods from computational geometry that work in arbitrary dimension. Several of these functions were written as prototypes, so getting something to work was the immediate goal, speed was not.

In this documentation we will use the term grid to mean a collection of points, usually approximately evenly spread on a solid or surface. We will use the term mesh to mean both the grid, and the grouping information that tells which points make up the simplices that triangulate/tesselate the region.

Please let me know if you find any mistakes. I will try to fix bugs promptly. Constructive comments for improvements are welcome; actually implementing any suggestions will be dependent on time constraints.

This research was supported by an agreement with Cornell University, Operations Research & Information Engineering, under contract W911NF-12-1-0385 from the Army Research Development and Engineering Command.

Version history:

Programming details and notes

The remainder of this section describes some of the internal details of the package. It is not needed for the average user.

Points in n-dimensional space are stored in row vectors as is customary in R. All simplices considered in this package are convex. A single convex simplex can be described/stored in two ways:

Both of these descriptions have their uses, so the core functions in this package calculate both. To store all the relevant information needed, the basic functions in this package return an object of class mvmesh. An object of class mvmesh has the following fields, extending the definitions above from a single simplex to a list of simplices:

type mvmesh.type m vps
--------------------- ------------- ------ ------
UnitSimplex 1 n-1 n
SolidSimplex 2 n n+1
UnitSphere, edgewise 3 n-1 n
UnitSphere, dyadic 4 n-1 n
UnitBall, edgewise 5 n n+1
UnitBall, dyadic 6 n n+1
SolidRectangle 7 n 2^n
Icosahedron 8 2 3
PolarSphere 9 n-1 2^(n-1)
PolarBall 10 n 2^(n-1) + 1
HollowTube 11 n-1 2*(n-1)
SolidTube 12 n 2*n
HollowRectangle 13 n 2^(n-1)

There are two generic S3 methods for objects of class mvmesh: print and plot. They are basic. The plot command only works for dimensions n=2 and n=3, is slow, and has some limitations. The main goal of this package is to provide grids/meshes in arbitrary dimensions, where plots are not possible.

This package represents points in n dimensional space as double precision numbers. This is convenient, but has potential problems. For example, determining whether points lie on a line or in a plane or on a sphere may not be possible with floating point arithmetic because coordinates can't be represented exactly. The computational geometry package rcdd on CRAN gives a way around this by using exact rational arithmetic. Using rational arithemetic works fine when points can be expressed as rational numbers, but not for points shifted by an irrational number or on more general surfaces, e.g. (sqrt(2)/2,sqrt(2)/2) is on the unit circle, but cannot be represented exactly as a rational number. Since we want to work in more situations, we use floating point numbers everywhere, accepting the fact that points may not be represented exactly. When the required package rcdd is loaded, it prints out a warning message about double precision numbers and encourages the use of rational arithmetic. I do not know how to suppress this message. That package warns that using doubles can lead to crashes in certain circumstances. I don't know what circumstances cause crashes; I have not seen any in the kinds of computations done in this package.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
UnitSimplex( n=2, k=3 )
UnitBall( n=3, k= 2 )

## Not run: 

plot( SolidSimplex( n=2, k=3 ), col="red" )
title("2d solid simplex")

plot( SolidSimplex( n=3, k=4 ) )
plot(  UnitSimplex( n=3,k=4), new.plot=FALSE, col="red", lwd=5 )
title3d("solid and unit simplex in 3d")
rgl.viewpoint( -45, 15)

# two plots on one window
plot( UnitSphere( n=3, k=2 ), col="blue")
mesh2 <- AffineTransform( UnitBall( n=3,k=2 ), A=diag(c(1,1,1)), shift=c(3,0,0) )
plot( mesh2, new.plot=FALSE, col="magenta" )
title3d("unit sphere and ball in 3d")


demo(mvmesh) # shows a range of meshes
demo(mvhist) # shows a range of multivariate histograms

## End(Not run)

mvmesh documentation built on Feb. 12, 2020, 1:09 a.m.