<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>Working with fans</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="___Working_spwith_spfans_sp-_sp__Part_sp2.html">next</a> | <a href="___Working_spwith_spcones.html">previous</a> | <a href="___Working_spwith_spfans_sp-_sp__Part_sp2.html">forward</a> | <a href="___Working_spwith_spcones.html">backward</a> | up | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <hr/> <div><h1>Working with fans</h1> <div>We start by constructing a fan, which consists of a single cone and all of its faces:<table class="examples"><tr><td><pre>i1 : C = posHull matrix {{1,0,0},{0,1,0},{0,0,1}} o1 = {ambient dimension => 3 } dimension of lineality space => 0 dimension of the cone => 3 number of facets => 3 number of rays => 3 o1 : Cone</pre> </td></tr> <tr><td><pre>i2 : F = fan C o2 = {ambient dimension => 3 } number of generating cones => 1 number of rays => 3 top dimension of the cones => 3 o2 : Fan</pre> </td></tr> </table> <p/> By this, we have already constructed the fan consisting of the positive orthant and all of its faces. The package saves the generating cones of the fan, which can be accessed by:<table class="examples"><tr><td><pre>i3 : genCones F o3 = {{ambient dimension => 3 }} dimension of lineality space => 0 dimension of the cone => 3 number of facets => 3 number of rays => 3 o3 : List</pre> </td></tr> </table> <p/> Now we could expand the fan by adding more cones, for example the following:<table class="examples"><tr><td><pre>i4 : C1 = posHull matrix {{1,0,0},{1,1,0},{0,0,-1}} o4 = {ambient dimension => 3 } dimension of lineality space => 0 dimension of the cone => 3 number of facets => 3 number of rays => 3 o4 : Cone</pre> </td></tr> </table> <p/> But in this case we can not, because the two cones are not compatible, i.e. their intersection is not a face of each. So, when one tries to add a cone to a fan that is not compatible with one of the generating cones of the fan, the function <a href="_add__Cone.html" title="adds cones to a Fan">addCone</a> gives an error. For two cones one can check if their intersection is a common face by using <a href="_common__Face.html" title="checks if the intersection is a face of both Cones or Polyhedra, or of cones with fans">commonFace</a>:<table class="examples"><tr><td><pre>i5 : commonFace(C,C1) o5 = false</pre> </td></tr> </table> <p/> Since the intersection of both is already computed in this function there is a different function, which also returns the intersection, to save computation time when one needs the intersection afterward anyway:<table class="examples"><tr><td><pre>i6 : (b,C2) = areCompatible(C,C1) o6 = (false, {ambient dimension => 3 }) dimension of lineality space => 0 dimension of the cone => 2 number of facets => 2 number of rays => 2 o6 : Sequence</pre> </td></tr> <tr><td><pre>i7 : rays C2 o7 = | 0 1 | | 1 1 | | 0 0 | 3 2 o7 : Matrix QQ <--- QQ</pre> </td></tr> </table> <p/> So we can make the cone compatible and add it to the fan.<table class="examples"><tr><td><pre>i8 : C1 = posHull matrix {{1,0,0},{0,1,0},{0,0,-1}} o8 = {ambient dimension => 3 } dimension of lineality space => 0 dimension of the cone => 3 number of facets => 3 number of rays => 3 o8 : Cone</pre> </td></tr> <tr><td><pre>i9 : F = addCone(C1,F) o9 = {ambient dimension => 3 } number of generating cones => 2 number of rays => 4 top dimension of the cones => 3 o9 : Fan</pre> </td></tr> </table> <p/> Instead of creating a fan with one cone and then adding more cones, we can also make a fan out of a list of cones:<table class="examples"><tr><td><pre>i10 : C2 = posHull matrix {{-1,0,0},{0,1,0},{0,0,1}};</pre> </td></tr> <tr><td><pre>i11 : C3 = posHull matrix {{-1,0,0},{0,1,0},{0,0,-1}};</pre> </td></tr> <tr><td><pre>i12 : C4 = posHull matrix {{-1,0,0},{0,-1,0},{0,0,1}};</pre> </td></tr> <tr><td><pre>i13 : C5 = posHull matrix {{-1,0,0},{0,-1,0},{0,0,-1}};</pre> </td></tr> <tr><td><pre>i14 : F1 = fan {C2,C3,C4,C5} o14 = {ambient dimension => 3 } number of generating cones => 4 number of rays => 5 top dimension of the cones => 3 o14 : Fan</pre> </td></tr> </table> <p/> Furthermore, we could add a list of cones to an existing fan:<table class="examples"><tr><td><pre>i15 : C6 = posHull matrix {{1,0,0},{0,-1,0},{0,0,1}};</pre> </td></tr> <tr><td><pre>i16 : C7 = posHull matrix {{1,0,0},{0,-1,0},{0,0,-1}};</pre> </td></tr> <tr><td><pre>i17 : F1 = addCone( {C6,C7}, F1) o17 = {ambient dimension => 3 } number of generating cones => 6 number of rays => 6 top dimension of the cones => 3 o17 : Fan</pre> </td></tr> </table> <p/> Finally, we can add a whole fan to another fan:<table class="examples"><tr><td><pre>i18 : F1 = addCone(F,F1) o18 = {ambient dimension => 3 } number of generating cones => 8 number of rays => 6 top dimension of the cones => 3 o18 : Fan</pre> </td></tr> </table> <p/> So, <a href="_fan.html" title="generates a Fan">fan</a> and <a href="_add__Cone.html" title="adds cones to a Fan">addCone</a> are the methods to construct fans ''from scratch'', but there are also methods to get fans directly, for example <a href="_normal__Fan.html" title="computes the normalFan of a polyhedron">normalFan</a>, which constructs the inner normal fan of a polytope.<table class="examples"><tr><td><pre>i19 : P = hypercube 4 o19 = {ambient dimension => 4 } dimension of lineality space => 0 dimension of polyhedron => 4 number of facets => 8 number of rays => 0 number of vertices => 16 o19 : Polyhedron</pre> </td></tr> <tr><td><pre>i20 : F2 = normalFan P o20 = {ambient dimension => 4 } number of generating cones => 16 number of rays => 8 top dimension of the cones => 4 o20 : Fan</pre> </td></tr> </table> <p/> Now we have seen how to construct fans, so we turn to functions on fans, for example the direct product (<a href="_direct__Product.html" title="computes the direct product of two convex objects">directProduct</a>:<table class="examples"><tr><td><pre>i21 : F3 = fan {posHull matrix {{1}},posHull matrix {{-1}}} o21 = {ambient dimension => 1 } number of generating cones => 2 number of rays => 2 top dimension of the cones => 1 o21 : Fan</pre> </td></tr> <tr><td><pre>i22 : F1 = F3 * F1 o22 = {ambient dimension => 4 } number of generating cones => 16 number of rays => 8 top dimension of the cones => 4 o22 : Fan</pre> </td></tr> </table> <p/> The result is in the direct product of the ambient spaces.<table class="examples"><tr><td><pre>i23 : ambDim F1 o23 = 4</pre> </td></tr> </table> <p/> Of course, we can check if two fans are the same:<table class="examples"><tr><td><pre>i24 : F1 == F2 o24 = true</pre> </td></tr> </table> <p/> A bit more on fans can be found in part 2: <a href="___Working_spwith_spfans_sp-_sp__Part_sp2.html" title="">Working with fans - Part 2</a>.</div> </div> </body> </html>