| 2025-12-04 15:30:52 +0100 | received badge | ● Popular Question (source) |
| 2025-10-13 07:47:22 +0100 | marked best answer | Analyzing affine monoids I am studying a family of affine monoids. The programs Normaliz and libnormaliz are great for this, and some of their functionality is available in SageMath. For instance, I can do and from the output one notes that the affine monoid generated by the extreme rays of the cone is not integrally closed (in the lattice Z^4). However, Normaliz also allows one to find the sublattice that the monoid generates inside Z^4, as well as finding the Hilbert series of the (appropriately graded) affine monoid. Is this functionality exposed in SageMath? I could not find it. I can certainly drag in libnormaliz and do it, but as you see below, it is cumbersome: gives This shows that the sublattice has index 2; reasonable, since all generators have even total sum. I got the Hilbert series of the affine monoid, not that of its integral closure --- nice. But I had to randomly convert some integers to python integers, switch from snake_case to CamelCase, overload Cone with the Normaliz version, which has a different syntax. This is irksome. Questions:
Edit: Max Alekseyev answered the Hilbert Series question. Guided by this, I found the "The Normaliz backend for polyhedral computations" section of the sagemath docs. It seems the most of the PyNormaliz functionality is implemented, but not the lattice algorithms of libnormaliz? For instance, in plain normaliz, using the input file I get at the end of the output file: This tells me that all lattice points in the affine monoid lies in the sublattice consisting of those lattice points (a,b,c,d) with a+b+c+d congruent 0 mod 2, and that there are no further restrictions. How can I use sagemath to do this calculation? Edit 2: The functionality for finding the generated sublattice is available in PyNormaliz (somewhat poorly documented, I had to experiment): prints |
| 2025-10-13 07:47:16 +0100 | commented answer | Analyzing affine monoids Yes, since it seems the desired functionality is already in PyNormaliz, see my second edit, it should be possible to add |
| 2025-10-13 07:43:09 +0100 | edited question | Analyzing affine monoids Analyzing affine monoids I am studying a family of affine monoids. The programs Normaliz and libnormaliz are great for t |
| 2025-10-12 17:36:51 +0100 | commented answer | Analyzing affine monoids Thank you, that answers one of my questions. I would also like to find the lattice gp(M) inside Z^4 generated by the aff |
| 2025-10-12 17:34:54 +0100 | received badge | ● Associate Editor (source) |
| 2025-10-12 17:34:54 +0100 | edited question | Analyzing affine monoids Analyzing affine monoids I am studying a family of affine monoids. The programs Normaliz and libnormaliz are great for t |
| 2025-10-12 12:03:31 +0100 | asked a question | Analyzing affine monoids Analyzing affine monoids I am studying a family of affine monoids. The programs Normaliz and libnormaliz are great for t |
| 2025-10-02 12:38:49 +0100 | received badge | ● Notable Question (source) |
| 2025-07-14 19:39:28 +0100 | received badge | ● Popular Question (source) |
| 2025-02-17 17:41:19 +0100 | marked best answer | 0/1-equivalence for polytopes Dear all,
for polytopes there is a method
I would like to test two 0/1-polytopes, i.e. polytopes which are the convex hull of a subset of the vertices of a (canonically embedded) hypercube $Q_n \subset [0,1]^n$, for 0/1-equivalence. This means that there is an automorphism of $Q_n$ that maps $P$ to $Q$. Explicitly, the automorphism should be a combination of permuting the variables and flipping $x_i \to 1 - x_i$. A reference is Ziegler, Lectures on 0/1-polytopes. He also mentions:
It would be great to have access to a database of 0/1-polytopes, and be able to compare all facets of dimension at most 4 of some polytope P to candidates in the database, and classify them, something similar to but for 0/1-polytopes. Of secondary importance (to me) would be checking two polytopes for for affine equivalence and congruence. Is this implemented i Sagemath? Edit: the answer by Max Alekseyev points me in the right direction. I will investigate the polydb and polymake docs. Thanks for the help! |
| 2025-02-17 17:40:55 +0100 | marked best answer | How to inherit from polytopes Dear all, I want to write a very simple class that inherits from existing polytopes functionality, creates one particular type of polytopes, and adds some functionality which is only relevant for this type of polytopes. However, I am a python beginner, and am having a hard time navigating the sagemath src directory to find exactly from which class (Polyhedron or Polyhedra) that I should inherit, and how to do this. Here is a toy example: suppose I want to investigate "depleted cubes", ie polytopes combinatorially equivalent with hypercubes with one corner neatly sliced off. I also want to easily retrieve the cut-off facet. This works: I can now go but I would like to be able to do so as not to dilute the precious namespace! I.e., the function should be a "method" to some "class" that inherits from, either Polyhedron or Polyhedra or polyhedron_base_with_backend_cpp or ... Can someone provide an example, skeleton implementation of a polytope class that inherits from somewhere? As I mentioned, I tried looking at the src directory, but the relevant files are extremely long and littered with docstrings and doctests and cruft; I can make neither head nor tails of them. Edit: As per the answer by dan_fulea, it is not worthwhile to try to turn the functions into a method. I will undogmatically refrain from doing so, then. Thank you for the tour through the internals of sagemath; I was not aware of the f.?? method of getting the code of a function/object. |
| 2025-02-17 16:44:00 +0100 | received badge | ● Famous Question (source) |
| 2025-02-17 16:39:00 +0100 | edited question | How to inherit from polytopes How to inherit from polytopes Dear all, I want to write a very simple class that inherits from existing polytopes functi |
| 2025-02-13 14:09:46 +0100 | edited question | 0/1-equivalence for polytopes 0/1-equivalence for polytopes Dear all, for polytopes there is a method P.is_combinatorially_isomorphic(Q) which tests |
| 2025-02-13 14:00:04 +0100 | received badge | ● Famous Question (source) |
| 2025-02-13 14:00:04 +0100 | received badge | ● Notable Question (source) |
| 2025-02-13 14:00:04 +0100 | received badge | ● Popular Question (source) |
| 2025-02-13 11:23:53 +0100 | commented answer | 0/1-equivalence for polytopes This looks promising, thanks! Many useful refeernces indeed. Poking around, I found clear instructions for accessing po |
| 2025-02-12 16:04:35 +0100 | asked a question | 0/1-equivalence for polytopes 0/1-equivalence for polytopes Dear all, for polytopes there is a method P.is_combinatorially_isomorphic(Q) which tests |
| 2025-02-05 21:50:46 +0100 | answered a question | Lattice of maximum-length antichains in sage Here is my attempt: def smallerB(a,B,P): if len([b for b in B if P.is_lequal(a,b)]) > 0: return true else: r |
| 2025-02-04 19:48:19 +0100 | received badge | ● Enthusiast |
| 2025-02-03 21:38:12 +0100 | asked a question | How to inherit from polytopes How to inherit from polytopes Dear all, I want to write a very simple class that inherits from existing polytopes functi |
| 2024-11-20 08:26:24 +0100 | received badge | ● Notable Question (source) |
| 2023-10-20 13:29:38 +0100 | edited question | Multivariate Pade approximation, recognizing rational function Multivariate Pade approximation, recognizing rational function (Question edited) Suppose that I have a taylor polynomia |
| 2023-10-19 13:30:14 +0100 | commented question | Multivariate Pade approximation, recognizing rational function Let me show my work so far. S.<y> = QQ[] R.<x> = S[] T.<y,x> = PowerSeriesRing(QQ,default_prec=8) U.& |
| 2023-10-18 17:09:03 +0100 | edited question | Multivariate Pade approximation, recognizing rational function Multivariate Pade approximation, recognizing rational function Suppose that I have a taylor polynomial approximation of |
| 2023-10-18 17:06:56 +0100 | edited question | Multivariate Pade approximation, recognizing rational function Multivariate Pade approximation, recognizing rational function Suppose that I have a taylor polynomial approximation of |
| 2023-10-18 17:05:41 +0100 | edited question | Multivariate Pade approximation, recognizing rational function Multivariate Pade approximation, recognizing rational function Suppose that I have a taylor polynomial approximation of |
| 2023-10-18 17:05:22 +0100 | edited question | Multivariate Pade approximation, recognizing rational function Multivariate Pade approximation, recognizing rational function Suppose that I have a taylor polynomial approximation of |
| 2023-10-18 17:04:20 +0100 | asked a question | Multivariate Pade approximation, recognizing rational function Multivariate Pade approximation, recognizing rational function Suppose that I have a taylor polynomial approximation of |
| 2023-10-02 19:56:14 +0100 | received badge | ● Popular Question (source) |
| 2023-09-01 00:16:43 +0100 | received badge | ● Nice Answer (source) |
| 2023-08-31 12:50:40 +0100 | answered a question | Diagonalisability check Malfunctioning Your matrix is not symmetric: A = matrix(QQbar, [[2,-1,0],[-1,2,1],[0,-1,2]]) A.is_symmetric() |
| 2023-06-13 15:57:01 +0100 | received badge | ● Notable Question (source) |
| 2023-06-13 15:57:01 +0100 | received badge | ● Popular Question (source) |
| 2022-07-16 18:31:41 +0100 | received badge | ● Nice Answer (source) |
| 2022-07-16 18:14:58 +0100 | received badge | ● Self-Learner (source) |
| 2022-07-16 16:39:16 +0100 | answered a question | latex for Hasse diagram of poset not properly laid out Adding dot2tex to the Sage installation, as suggested by FrédéricC and John Palmieri, did work for me and produces Hass |
| 2022-07-10 21:37:58 +0100 | edited question | latex for Hasse diagram of poset not properly laid out latex for Hasse diagram of poset not properly laid out The plot method on a poset displays the Hasse diagram in a satisf |
| 2022-07-10 15:03:53 +0100 | asked a question | latex for Hasse diagram of poset not properly laid out latex for Hasse diagram of poset not properly laid out The plot method on a poset displays the Hasse diagram in a satisf |
| 2022-06-23 16:03:18 +0100 | edited answer | taylor series of expression involving modulus of a complex expression You could expand around t=0 instead, for t = w + 0.1 var('t') bmac = b.substitute(w=t-0.1).taylor(t,0,3) cmac = c.subst |
| 2022-06-23 16:03:01 +0100 | answered a question | taylor series of expression involving modulus of a complex expression You could expand around t=0 instead, for t = w + 0. var('t') bmac = b.substitute(w=t-0.1).taylor(t,0,3) cmac = c.substi |
| 2022-06-22 20:25:29 +0100 | asked a question | Displaying and typesetting partitions Displaying and typesetting partitions A partition can be viewed as a list or pretty-printed using ascii art. This works |
| 2022-06-21 19:47:32 +0100 | received badge | ● Supporter (source) |
| 2022-06-21 19:44:15 +0100 | marked best answer | Simplifying factorials, limits, Maxima crash I am trying to simplify some binomial expressions using Sage. Now I want the limit of this expression as n -> +Infininty. Maple can do it, it correctly returns I can get Sage to calculate the limit for specific values of a: However, when I try I get an error from the underlying Maxima engine: Is SAGE able to compute this limit? Should i provide other provisos? Is there another approach I should try? Edit: The following works: so I guess all is well. I do not know if the fact that Maxima throws an exception when the taylor keyword is ommitted is a bug or not. The documentation for limit says
Maybe this should be amended to indicate that in some cases, taylor=False causes crashes. |
| 2022-06-21 19:44:15 +0100 | received badge | ● Scholar (source) |
| 2022-06-21 15:53:39 +0100 | edited answer | Simplifying factorials, limits, Maxima crash The function limit() has a keyword taylor, which might help or hinder. In this case, Uan.limit(n=Infinity,dir='+',taylo |
| 2022-06-21 15:52:32 +0100 | answered a question | Simplifying factorials, limits, Maxima crash The function limit() has a keyword taylor, which might help or hinder. In this case, Uan.limit(n=Infinity,dir='+' |
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.