Ask Your Question

Revision history [back]

I can replicate the observed bug in Ubuntu 22.04.2 LTS (jammy) with

  • conda-installed SageMath 10.0
  • conda-installed LattE integrale 1.7.5.

But specifying algorithm=latte as in @FrédéricC's comment gives the correct integral.

sage: from sage.features.latte import Latte
sage: Latte().is_present()
FeatureTestResult('latte_int', True)

sage: P = polytopes.cube()
sage: x, y, z = polygens(QQ, names='x, y, z')
sage: f = x^2 * y^2 * z^2

sage: P.integrate(f)
0
sage: P.integrate(f, algorithm='latte')
8/27

The first example in the documentation of P.integrate, accessed with P.integrate?, or found at

  • https://github.com/sagemath/sage/blob/10.0/src/sage/geometry/polyhedron/base7.py#L775

reads:

  sage: P = polytopes.cube()
  sage: x, y, z = polygens(QQ, 'x, y, z')
  sage: P.integrate(x^2*y^2*z^2)    # optional - latte_int
  8/27

That example should probably be fixed to use algorithm=latte.

Without algorithm=latte, Sage should either detect whether LattE is available, and if so use it, or raise a "not implemented" error rather than returning a wrong result.

I'm curious why the bug is observed with conda-installed Sage and LattE, but not in other setups.

I can replicate the observed bug in Ubuntu 22.04.2 LTS (jammy) with

  • conda-installed SageMath 10.0
  • conda-installed LattE integrale 1.7.5.

But specifying algorithm=latte as in @FrédéricC's comment gives the correct integral.

sage: from sage.features.latte import Latte
sage: Latte().is_present()
FeatureTestResult('latte_int', True)

sage: P = polytopes.cube()
sage: x, y, z = polygens(QQ, names='x, y, z')
sage: f = x^2 * y^2 * z^2

sage: P.integrate(f)
0
sage: P.integrate(f, algorithm='latte')
8/27

The first example in the documentation of P.integrate, accessed with P.integrate?, or found at

  • https://github.com/sagemath/sage/blob/10.0/src/sage/geometry/polyhedron/base7.py#L775

reads:

  sage: P = polytopes.cube()
  sage: x, y, z = polygens(QQ, 'x, y, z')
  sage: P.integrate(x^2*y^2*z^2)    # optional - latte_int
  8/27

That example should probably be fixed to use algorithm=latte.

Without algorithm=latte, I think Sage should either detect checks whether LattE is available, and if so use it, or raise uses it. But apparently that detection fails in the conda setup.

In any case, at some point a "not implemented" error should be raised rather than returning a wrong result.

I'm curious curious

  • why the bug is observed with conda-installed Sage and LattE, LattE, but not in other setups.

    setups
  • what code path leads to returning zero as an answer