This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / Add-ons & Links / Standard Packages / Introduction /

Discrete Mathematics Packages

Discrete mathematics is concerned with enumerable mathematical structures, such as are studied in combinatorics, graph theory, and computational geometry. The DiscreteMath packages include, among others, Combinatorica, which provides over 200 functions for the study of combinatorics and graph theory and ComputationalGeometry, which provides several important geometric functions useful in nonparametric data analysis.

This causes each DiscreteMath package to load as needed.

In[1]:= <<DiscreteMath`

The Combinatorica package provides definitions of many graph objects. The five-dimensional hypercube has a three-dimensional cube in each corner of the square.

In[2]:= ShowGraph[ Hypercube[5] ]


This reads a file of piezometric-head data for the Wolfcamp aquifer in the western United States. The triples give an location with respect to an arbitrary origin and the water level in feet above sea level.

In[3]:= data = ReadList["",
Number, RecordLists->True];

The Voronoi polygons are useful in spatial statistics because they define a "region of influence" for each data point. The aquifer water level throughout a polygonal region can be approximated by the measurement at the center of the polygon.

In[4]:= (data2D = Map[Drop[#, -1]&, data];
triangulation = DelaunayTriangulation[data2D];
{polygonVertices, polygonVal} =
VoronoiDiagram[data2D, triangulation];
DiagramPlot[data2D, polygonVertices, polygonVal,
Axes -> True, AxesLabel -> {x, y},
AxesOrigin -> {-150, -30},
LabelPoints -> False, TrimPoints -> 6,
Ticks -> {Automatic, {-50, 0, 50, 100, 150, 200}}])


This displays the surface formed by a linear interpolation between the data points in the original three-dimensional set.

In[5]:= TriangularSurfacePlot[data, triangulation,
BoxRatios->{1, 1, .3}, Axes -> True,
ViewPoint -> {1.3, 2.4, 2.}]