Ask Your Question

Visualizing Toric fans in Sage

asked 2017-11-09 21:42:47 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I am learning basics of toric geometry as applied to physics. I would like to know if there's a way to visualize toric fans using Sagemath, and also draw dual toric diagrams.

For example, if I give explicit coordinates of vectors defining a fan, can I visualize the fan and also its dual toric fan using Sage?

I have found resources on the net about using Sage for toric varieties, but I am currently looking for answers to much simpler questions.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-11-10 21:17:21 +0200

dan_fulea gravatar image

updated 2017-11-10 21:18:38 +0200

The following did not fit as a comment, so it became an answer. In such cases it is always a good idea to provide a minimal, non-trivial, relevant example, give the expectation, and references for the definition of the involved objects, if not standard. (I was somehow puzzled about the meaning of a "dual toric diagram" and "dual toric fan"... Please give definitions or links to their meanings.)

Of course, sage code that initializes sample data would be wonderful for potential helpers to get immediately in the matter.

If i understand the post, we want the following:

  • (0) not given / specified, but implicitly needed, fix some vectors.
  • (1) given explicit coordinates of vectors, associate the corresponding fan.
  • (2) vizualize a fan. (Simple after construction. Just plot it!)
  • (3) associate the toric variety of a fan.
  • (4) associate the dual (toric?) fan (?) of a fan.
  • (5) = (3*) associate the toric variety of the dual fan.

Here is some sample lines of code addressing these points, for more we need more (input).

import pprint

# (0) construct some vertices and the polyhedron determined by them
R = [ 0,
      +3, +4, +5,
      -3, -4, -5, ]
V = [ (s,t,u)
      for (s,t,u) in cartesian_product( [R,R,R] )
      if   s^2 + t^2 + u^2 == 5^2 ]
P = Polyhedron( vertices = V )
L = P.lattice_polytope()

print "P has the following vertices:"
pprint.pprint( P.vertices_list() )
print "A plot of P..."

# (1) associate the fan of the polyhedron P
F = FaceFan( L )

# (2) plot the fan
print "The fan of the lattice L is as follows..."
print "The rays of the fan F are as follows:"
print F.rays()

# (3) associate the toric variety of the fan
T = ToricVariety( F )
print "A plot of the associated toric variety T..."

# (4) dual fan (?)
# there is only a dual lattice, that i can associate to a given lattice.
# or we may pass from a cone to its dual cone,
# but this is an operation that may map
# disjoint (open) cones to intersecting dual cones.
# example

c = F.cones()[3][0]    # first cone in the fan F
print "The rays of the first cone are:\n", c.rays() 

cd = c.dual()
print "The rays of its dual cone are:\n", cd.rays() 

Methods of the constructed objects can be detected by using dir, e.g. dir(F), or using in the sage console the TAB-extensions list. (For this, type F., then hit the TAB (twice).)

edit flag offensive delete link more


Thank you, Dan! Sorry for my late reply. This is indeed helpful. I meant "dual toric diagram" not "dual fan" (thanks for correcting me). What if I had to go backward (dual of dual toric diagram)? Would this method still work?

If you see, essentially what I want to do is generate either one of Figure 2.3 given the other.

toricweb gravatar imagetoricweb ( 2017-11-15 22:09:44 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-11-09 21:42:47 +0200

Seen: 289 times

Last updated: Nov 10 '17