Macaulay2 » Documentation
Packages » ConvexInterface :: ConvexInterface
next | previous | forward | backward | up | index | toc

ConvexInterface -- Interface to the Maple package Convex.


What's new:

July 13, 2010: Added a function mIsSubcone testing whether a cone is a subcone of another one.

October 4, 2009: Added a generic function callConvex taking a string with a program written in Convex syntax.

September 20, 2009: Added functions mPosHullFaces and mPosHullFacesAndDuals to compute the face complex of a cone. They have an Option toFile to store the result of a computation in a file, and a function readPosHullFaces to read the file.

September 10, 2009: Added a function mLatticePoints to compute the lattice points of polytope.

August 28, 2009: The interface now uses indexed vertices. This substantially improves computation time and memory usage.

August 25, 2009: Added an Option toFile to mConvexHullFaces and mConvexHullFacesAndDuals to store the result of a computation in a file, and a function readConvexHullFaces to read the file.


The goal of this package is to provide the functions of the Maple package Convex in Macaulay 2.

The Convex package is distributed by Matthias Franz under the GNU General Public License, see

for more information.

ConvexInterface is work in progress and so far accesses only a fraction of the functionality provided by Convex. If you would like to help to expand this you are welcome.

Note that there is a generic function callConvex with takes a String containing a program written in the Syntax of Maple/Convex.


So far the following functions are accessible via ConvexInterface:

mConvexHullFaces -- compute the faces of a convex hull

mConvexHullFacesAndDuals -- computing the faces and their duals

mHomology -- Compute the homology of a (not necessarily simplicial) complex

mLatticePoints -- computing the lattice points of a convex hull

mPosHullFaces -- compute the faces of a positive hull

mPosHullFacesAndDuals -- computing the faces and their duals of a positive hull

Other functions that may be interesting to access:

dual, hilbertbasis, simplicialsubdiv, minkowskisum, newtonpolytope

and also

affinehull, ambientdim, arecompatible, boundary, codim, contains, containsrelint, convhull, corank, corners, crosspolytope, cube, cyclicpolytope, delaunay, dim, directsum, distance, domain, dotprod, draw, dual, edges, emptypcomplex, emptypolyhedron, emptypolytope, facefan, faces, facets, fan, flagf, flagh, fullcone, fullpolyhedron, furthestdelaunay, fvector, genhpolynomial, genhvector, hilbertbasis, homology, hplanes, hspacenos, hspaces, hvector, image, incidencematrix, incidentfacets, incidentrays, intersection, isaffine, isbounded, iscomplete, iscontained, isempty, isface, isfulldim, islinear, ispointed, ispolytopal, isquasipolytopal, isregular, issimple, issimplex, issimplicial, issimplicial1, join, lensspace, lineality, linearhull, lines, maximal, maximum, minimal, minimum, minkowskisum, modz, newtonpolytope, normalfan, pcomplex, permutahedron, plotdata, polar, poshull, posorthant, pred, preimage, projspace, proximum, randompolytope, rank, raynos, rays, readpoly, recession, regularpart, regularsubdiv, relint, simplicialsubdiv, skeleton, stdsimplex, stellarsubdiv, succ, support, surface, torsion, transversalfan, traverse, traverse2, vertexnos, vertices, volume, voronoi, wprojspace, writepoly, zerocone, zerofan


This package needs the package MapleInterface, so set this up first.

Install the convex package in Maple, i.e., put the file

into the lib directory inside your Maple program directory. You can test it in Maple by typing with(convex);

Install the ConvexInterface package in M2 by typing


Additional remarks:

You can put the convex.m file in any directory which shows up when you type in Maple


You can change this global variable by editing the Maple init file.

You can also put the convex.m file in any directory you want, as long as you tell M2 about the path. In this case the installation goes as follows: Do


Edit the file init-ConvexInterface.m2 in the directory .Macaulay2 in your home directory changing the line

"ConvexPath" =""


"ConvexPath" =StringWithPathToConvex

where StringWithPathToConvex is a string containing the path to the directory containing the convex.m file.

In Unix type systems this will be something like


In Windows systems use double backslashes to separate directories and the triple-slash as string delimiter. See the beginning of the source code for an example.

To test whether the interface is set up properly do, e.g.,


which should return \{1,4,4,1\}.



This documentation describes version 0.33 of ConvexInterface.

Source code

The source code from which this documentation is derived is in the file ConvexInterface.m2. The auxiliary files accompanying it are in the directory ConvexInterface/.


  • Types
  • Functions and commands
  • Methods
    • callConvex(String) -- see callConvex -- Generic function to run a Convex program.
    • net(FinitelyGeneratedAbelianGroup) -- see FinitelyGeneratedAbelianGroup -- Class of finitely generated abelian groups.
    • mConvexHullFaces(List) -- see mConvexHullFaces -- Faces of a convex hull.
    • mConvexHullFacesAndDuals(List) -- see mConvexHullFacesAndDuals -- Faces and their duals of a convex hull.
    • mHomology(List) -- see mHomology -- Compute the homology.
    • mIsSubcone(List,List) -- see mIsSubcone -- Test whether a cone is a subcone of another cone.
    • mLatticePoints(List) -- see mLatticePoints -- Compute the lattice points of a convex hull.
    • mPosHullFaces(List) -- see mPosHullFaces -- Faces of a positive hull.
    • mPosHullFacesAndDuals(List) -- see mPosHullFacesAndDuals -- Faces and their duals of positive hull.
    • readConvexHullFaces(String) -- see readConvexHullFaces -- Read the result of a previous mConvexHullFaces or mConvexHullFacesAndDuals computation.
    • readPosHullFaces(String) -- see readPosHullFaces -- Read the result of a previous mPosHullFaces or mPosHullFacesAndDuals computation.
  • Symbols
    • toFile -- Store result in a file.

For the programmer

The object ConvexInterface is a package.