First time here? Check out the FAQ!

Ask Your Question
0

ehrhart polynomial independent variable

asked 0 years ago

RMMM gravatar image

updated 0 years ago

I have noticed that the ehrhart_polynomial method in Polyhedron_ZZ returns a polynomial in t. Is the independent variable 't' hard coded into the library, or is it getting 't' from something in my setup?

On the other hand, there are other functions that return polynomials that seem to default to polynomials in 'x'.

How are users expected to determine what variable is going to come out of a calculation, and how do I manage the independent variables when I'm cobbling together a calculation out of polynomials that are coming in different variables?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 0 years ago

dan_fulea gravatar image

updated 0 years ago

After having an instance of the class, we can easily inspect the situation:

sage: P = Polyhedron([(0, 0, 0), (1, 0, 0), (0, 1, 0), (0, 0, 1)])
sage: P
A 3-dimensional polyhedron in ZZ^3 defined as the convex hull of 4 vertices
sage: P.ehrhart_polynomial()
1/6*t^3 + t^2 + 11/6*t + 1
sage: P.ehrhart_polynomial?

The last line gives information on the method ehrhart_polynomial of the object P. From the offered information let us pick the following part:

Return the Ehrhart polynomial of this polyhedron.

Let P be a lattice polytope in \RR^d and define L(P,t) = \# (tP \cap
\ZZ^d). Then E. Ehrhart proved in 1962 that L coincides with a
rational polynomial of degree d for integer t. L is called the
*Ehrhart polynomial* of P. For more information see the
https://en.wikipedia.org/wiki/Ehrhart_polynomial.

The Ehrhart polynomial may be computed using either  LattE Integrale
or Normaliz by setting "engine"  to 'latte' or 'normaliz'
respectively.

INPUT:

* "engine" -- string; the backend to use. Allowed values are:

  * "None" (default); When no input is given the Ehrhart polynomial is
    computed using LattE Integrale (optional)

  * "'latte'"; use LattE integrale program (optional)

  * "'normaliz'"; use Normaliz program (optional). The backend of
    "self" must be set to 'normaliz'.

* "variable" -- string (default: "'t'"); the variable in which the
  Ehrhart polynomial should be expressed

So the code of the method documents the default of the optional parameter variable. Possibly historical reasons were leading to this choice. We are free to use something else instead. For instance:

sage: var('X');
sage: P.ehrhart_polynomial(variable=X)
1/6*X^3 + X^2 + 11/6*X + 1
Preview: (hide)
link

Comments

OK, thanks. I looked for the "variable" parameter but didn't see it in the docstring. I must be blind!

In your answer, you chose X as variable. (I think you need quotes around the X.) Was that random, or is that a typical choice? I'd like to settle on something that is commonly used, and which will stand out in my source code and be easy to search on.

RMMM gravatar imageRMMM ( 0 years ago )

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 0 years ago

Seen: 67 times

Last updated: Feb 12