sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.34k stars 460 forks source link

Multivariate Generating Functions: critical cone cannot be described for non-rational critical point #32020

Open behackl opened 3 years ago

behackl commented 3 years ago

FractionWithFactoredDenominator.critical_cone returns None when the corresponding critical point has non-rational coordinates. Consider the following example:

sage: from sage.rings.asymptotic.asymptotics_multivariate_generating_functions import FractionWithFactoredDenominatorRing
sage: R.<x, y> = QQ[]
sage: FFPD = FractionWithFactoredDenominatorRing(R)
sage: G = 1; H = 1 - x - y - x*y
sage: Hfac = H.factor()
sage: G = G / Hfac.unit()
sage: F = FFPD(G, Hfac)

For a point with rational coordinates, everything works as expected:

sage: I = F.smooth_critical_ideal(alpha=(1, 1))
sage: points = solve([SR(z) for z in I.gens()], [SR(z) for z in R.gens()], solution_dict=true)
sage: F.critical_cone(points[1])
([(1, 1)], 1-d cone in 2-d lattice N)

For non-rational coordinates, the critical cone returns None:

sage: I = F.smooth_critical_ideal(alpha=(2, 1))
sage: points = solve([SR(z) for z in I.gens()], [SR(z) for z in R.gens()], solution_dict=true)
sage: F.critical_cone(points[1])
([(((sqrt(5) - 1)*(sqrt(5) - 2) + sqrt(5) - 1)/((sqrt(5) - 1)*(sqrt(5) - 2) + 2*sqrt(5) - 4),
   1)],
 None)

CC: @MarkCWilson @kliem

Component: asymptotic expansions

Issue created by migration from https://trac.sagemath.org/ticket/32020

mkoeppe commented 3 years ago
comment:1

Using Polyhedron instead of Cone in this case would be an option.

mkoeppe commented 3 years ago
comment:3

See also #30172, where an ABC for convex cones (not necessarily rational polyhedral) is in the works

behackl commented 3 years ago
comment:4

Replying to @mkoeppe:

Using Polyhedron instead of Cone in this case would be an option.

In this particular example, simplifying the ray directions would actually suffice. The ray list passed to Cone is

[(((sqrt(5) - 1)*(sqrt(5) - 2) + sqrt(5) - 1)/((sqrt(5) - 1)*(sqrt(5) - 2) + 2*sqrt(5) - 4),
  1)]

which actually is just

[(2, 1)]

But that doesn't change the fact that if the rays actually have non-rational components, Cone isn't suitable.

When I try to use Polyhedron with non-rational ray directions, I also get an error, e.g.,

sage: Polyhedron(rays=[(sqrt(2), 1)])
Traceback (most recent call last):
...
ValueError: no default backend for computations with Symbolic Ring

Did you mean that Polyhedron could be used after moving the rays to some more appropriate base ring? Or am I missing something else?

Also, thanks for the reference to #30172!

mkoeppe commented 3 years ago
comment:5

You would need to pass base_ring=AA. Polyhedron refuses to compute with SR.

behackl commented 3 years ago
comment:6

Replying to @mkoeppe:

You would need to pass base_ring=AA. Polyhedron refuses to compute with SR.

Makes sense, thanks.

mkoeppe commented 3 years ago
comment:7

If you need cones with transcendental data, #30234 would be an approach.