Viro Patchworking
Viro.sage is a Python class for using Viro Patchworking from within the computer algebra system Sage, written by Timo de Wolff, Emma Owusu Kwaakwah and Christopher O'Neill.
  • The code is used via two classes: ViroComplex (for Viro's original construction) and CIViroComplex (for Sturmfel's generalization to complete intersections). See the sample code below.
  • Autocomplete is supported in the Sage web interface, i.e. typing
    will give a list of available functions. Again, see the sample code below.
  • Comments and feature requests are encouraged, just send the authors an email!
Please note that this is an alpha version and subject to change without notice.
Given below is a current version of Viro.sage. You can also email the authors for a cutting-edge version.
  • Viro.sage (version 0.3a), posted May 31, 2016
Viro.sage is released under the terms of the MIT license. The MIT License is simple and easy to understand and it places almost no restrictions on what you can do with this software.
Action shots
The figure below depicts several plots produced by Viro.sage.
  • Upper left: a hypersurface example in 2 variables.
  • Upper right: a counterexample to the Ragsdale conjecture due to Viro and Itenberg.
  • Lower left: a complete intersection example in 2 variables due to Sturmfels.
  • Lower right: a hypersurface example in 3 variables.
To set up your machine to use Viro.sage, do the following.
  • First, install Sage on your machine. Instructions for doing so can be found here.
  • Next, download Viro.sage at the link above, and place it in your favorite folder.
The following code fragment gives an overview of how to use the ViroComplex class from within Sage, and more complete documentation will be added in the near future.
				sage: load('/PATH_TO_FILE/Viro.sage')

				sage: ragsviro = ViroComplex.RagsdaleCounterexample()
				sage: print ragsviro.virocomplex
				Simplicial complex with 610 vertices and 600 facets
				sage: ragsviro.virocomplex.homology()
				{0: Z^43, 1: Z^34}
				sage: ragsviro.Plot2D()

				sage: curvelist=[[[(0,3),0,1], [(1,2),1,-1], [(2,1),5,-1], [(3,0),12,1], 
				                  [(0,2),1,-1], [(1,1),4,1], [(2,0),9,-1], [(0,1),5,-1], 
				                  [(1,0),9,-1], [(0,0),12,1]], 
				                 [[(0,2),8,1], [(1,1),6,-1], [(2,0),6,1], [(0,1),3,-1], 
				                  [(1,0),2,-1], [(0,0),0,1]]]
				sage: civiro = CIViroComplex.FromBigLists(curvelist)
				sage: print civiro.virocomplex
				Simplicial complex with 6 vertices and 6 facets
				sage: print civiro.virocomplex.homology()
				{0: Z^5}
				sage: civiro.Plot2D()