Ask Your Question

DerekH's profile - activity

2022-10-30 02:16:52 +0200 received badge  Notable Question (source)
2021-12-24 10:03:32 +0200 received badge  Popular Question (source)
2020-06-09 21:34:25 +0200 answered a question Toric Ideal of Point Configuration Yielding Whole Ring?

I believe I have some more insight as to why this issue was happening. Since I want to consider toric ideals in the context of a lattice polytope $P$, my point configuration matrix should have had a row of $1$'s appended to the bottom since I'm really looking at the polytope embedded at height $1$ in the cone over $P$ (${\rm cone}(P)$). I was operating in the wrong dimension! Generating the whole ring makes sense with the setup in my original problem statement since two of the lattice points are the standard basis vectors. I made this realization because the ideal should be homogenenous as the polytope given as the convex hull of those $7$ points is IDP but several of the generators contained a constant term. So, I should have had something more along the lines of

R = PolynomialRing(QQ, 'z', 7, order='lex')
z = R.gens()
IA = ToricIdeal([[1,0,0,0,-1,-1,-2],[0,1,0,-1,-1,-2,-3],[1,1,1,1,1,1,1]],polynomial_ring=R)
2020-06-09 19:26:41 +0200 received badge  Good Question (source)
2020-06-09 17:52:17 +0200 commented answer Toric Ideal of Point Configuration Yielding Whole Ring?

Not sure if this is useful for anyone, but I wrote another implementation that obtains the appropriate naive ideal using the basis for kernel of the point configuration matrix. The answer is the same as _naive_ideal() method.

from sage.rings.polynomial.polydict import ETuple
R = PolynomialRing(QQ, 'z', 7, order='invlex')
z = R.gens()
IA = ToricIdeal([[1,0,0,0,-1,-1,-2],[0,1,0,-1,-1,-2,-3]])
A = IA.A()
V = A.right_kernel();B = V.basis_matrix()
gens = []
for i in range(B.nrows()):
    u = ETuple(list(B[i]));other = ETuple([0]*len(u))
    uplus = tuple(u.combine_to_positives(other)[1])
    uminus = tuple(u.combine_to_positives(other)[2])
    gens.append(R.monomial(*uplus) - R.monomial(*uminus))
I = ideal(gens)
GB = I.groebner_basis()
2020-06-09 17:15:15 +0200 commented answer Toric Ideal of Point Configuration Yielding Whole Ring?

Awesome, thank you so much! I think this will work well for my purposes. Greatly appreciate it!

2020-06-09 17:13:11 +0200 commented question Toric Ideal of Point Configuration Yielding Whole Ring?

Thank you so much!

2020-06-09 17:11:23 +0200 received badge  Supporter (source)
2020-06-09 12:54:35 +0200 received badge  Nice Question (source)
2020-06-09 07:33:36 +0200 received badge  Editor (source)
2020-06-09 07:03:49 +0200 asked a question Toric Ideal of Point Configuration Yielding Whole Ring?

So I am trying to find the toric ideal of a point configuration given by the lattice points contained within a family of polytopes I am studying to assess regularity/unimodularity of triangulations of the point configuration (I'm attempting to follow the guidelines specified in Bernd Sturmfels' text Grobner Bases and Convex Polytopes). I know that toric ideals are supposed to be prime and their reduced Grobner bases are generated by binomials, but for whatever reason, the ToricIdeal() sage function is indicating that the corresponding ideal is the entire ring, which should definitely not be the case.

For example, say that we're looking at the point configuration given by the lattice points (1,0), (0,1), (0,0), (0,-1), (-1,-1), (-1,-2), (-2,-3). Inputting these points as columns in a matrix and computing the toric ideal as indicated in the sage documentation should be as simple as:

A = matrix([[1,0,0,0,-1,-1,-2],[0,1,0,-1,-1,-2,-3]])
IA = ToricIdeal(A); IA

However, when I run this I get the following output:

Ideal (1) of Multivariate Polynomial Ring in z0, z1, z2, z3, z4, z5, z6 over Rational Field

I cannot determine why this is the case. For some context, I asked a colleague to compute the toric ideal using Macaulay2, and that program indicated that the toric ideal is generated by z2 - 1, z1*z3 - 1, z0*z1*z4 - 1, z0*z1^2*z5 - 1, z0^2*z1^3*z6 - 1, z0^4*z1^7*z2*z3*z4*z5*z6 - 1 which seems far more reasonable. Any idea if my input is incorrect or misguided? I'm having a similar issue on another project when attempting to compute toric ideals of point configurations comprised of the vertices of order polytopes. Without the correct toric ideal, I cannot compute a corresponding Grobner basis to assess regularity or unimodularity. Any help is greatly appreciated. Thank you.

2020-04-27 17:58:07 +0200 commented answer Attribute error: "'Graphics' object has no attribute 'get_pos'" with plotting Hasse diagram of poset

You are my hero! Worked like a charm. Thank you so much. I greatly appreciate it.

2020-04-27 16:27:26 +0200 commented answer Attribute error: "'Graphics' object has no attribute 'get_pos'" with plotting Hasse diagram of poset

Thank you for your comment! So this makes sense if I want to obtain the positions of H, but I was actually hoping to obtain the positions used when executing P.plot() so I can use those in constructing the hasse diagram graph via P.hasse_diagram(). Ultimately, I want the vertices of H to be in the same position as their corresponding element of the poset P is placed when displaying the poset via P.plot(). I hope that makes sense.

2020-04-26 01:21:18 +0200 commented question Attribute error: "'Graphics' object has no attribute 'get_pos'" with plotting Hasse diagram of poset

If you were to insert P.plot() after defining P, this is what I want to record the positions of. In this case, this saves the positions of the Hasse diagram which are different from those used in plotting P. Does that make sense?

2020-04-26 01:16:07 +0200 commented answer Attribute error: "'Graphics' object has no attribute 'get_pos'" with plotting Hasse diagram of poset

I see. Thank you.

So there is no way to obtain the positions used for displaying the Hasse diagram of the poset?

2020-04-25 02:04:12 +0200 received badge  Student (source)
2020-04-25 02:03:07 +0200 asked a question Attribute error: "'Graphics' object has no attribute 'get_pos'" with plotting Hasse diagram of poset

So I am trying to obtain the position dictionary used for displaying a poset P that can be used in the plotting of the Hasse diagram of P through the hasse_diagram() function.

To clarify, if I run the following code:

P = posets.BooleanLattice(3)
P.plot()
G = P.hasse_diagram().to_undirected()
G.plot()

The locations of the vertices of G do not line up with where the corresponding elements of the poset were. I know that we can save the position dictionary for graphs, but for whatever reason, I'm struggling with obtaining the position dictionary of elements in a poset. (With the specific posets I am working with, maintaining the position when obtaining the undirected Hasse diagram is important because I need a particular planar embedding which is not being preserved if I simply use the hasse_diagram() function in its canned form).

In the finite posets SageMath documentation, the plot() function says that it also accepts all options of GenericGraph.plot which should include the save_pos option and get_pos(). However, when I run

P = posets.BooleanLattice(3)
Pplot = P.plot(save_pos=True)
G = P.hasse_diagram().to_undirected()
position = Pplot.get_pos()
G.plot(pos = position)

I get an attribute error:

Error in lines 4-4
Traceback (most recent call last):
  File "/cocalc/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 1234, in execute
    flags=compile_flags), namespace, locals)
  File "", line 1, in <module>
AttributeError: 'Graphics' object has no attribute 'get_pos'

Is there any way to extract a position dictionary of a graphics object corresponding to the Hasse diagram of a poset?