Opened 22 months ago

Last modified 6 weeks ago

#19989 new defect

asymptotics for multivariate generating functions: zero division error on last coordinate

Reported by: dkrenn Owned by:
Priority: major Milestone: sage-8.1
Component: asymptotic expansions Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: #10519 Stopgaps:

Description (last modified by jdemeyer)

sage: from sage.rings.asymptotic.asymptotics_multivariate_generating_functions import FractionWithFactoredDenominatorRing
sage: R.<x,y,t> = PolynomialRing(QQ)
sage: FFPD = FractionWithFactoredDenominatorRing(R)
sage: H = (1 - y) * (1 + x^2) * (1 - t*(1 + x^2 + x*y^2))
sage: G = (1 + x) * (1 + x^2 - x*y^2)
sage: Hfac = H.factor()
sage: G = G / Hfac.unit()
sage: F = FFPD(G, Hfac)
sage: p = {x: 1, y: 1, t: 1/3}
sage: alpha = [1, 1, 1]
sage: F.asymptotics_multiple(p, alpha, 1, var('r'))
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-4-82ca86d72d26> in <module>()
      9 p = {x: Integer(1), y: Integer(1), t: Integer(1)/Integer(3)}
     10 alpha = [Integer(1), Integer(1), Integer(1)]
---> 11 F.asymptotics_multiple(p, alpha, Integer(1), var('r'))

/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.pyc in asymptotics_multiple(self, p, alpha, N, asy_var, coordinate, numerical, verbose)
   2184         n = len(H)
   2185         P = {SR(x): p[x] for x in R.gens()}
-> 2186         Sstar = self._crit_cone_combo(p, alpha, coordinate)
   2187 
   2188         # Put the given convenient variable at end of variable list.

/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.pyc in _crit_cone_combo(self, p, alpha, coordinate)
   2428         d = self.dimension()
   2429         n = len(self.denominator_factored())
-> 2430         Gamma = matrix([direction(v, coordinate) for v in self.log_grads(p)])
   2431         beta = direction(alpha, coordinate)
   2432         # solve_left() fails when working in SR :-(.

/usr/local/src/sage-config/local/lib/python2.7/site-packages/sage/rings/asymptotic/asymptotics_multivariate_generating_functions.pyc in direction(v, coordinate)
   4260     if coordinate is None:
   4261         coordinate = len(v) - 1
-> 4262     return tuple([vv / v[coordinate] for vv in v])
   4263 
   4264 

/usr/local/src/sage-config/src/sage/rings/rational.pyx in sage.rings.rational.Rational.__div__ (build/cythonized/sage/rings/rational.c:21767)()
   2355         if type(left) is type(right):
   2356             if mpq_cmp_si((<Rational> right).value, 0, 1) == 0:
-> 2357                 raise ZeroDivisionError('rational division by zero')
   2358             x = <Rational> Rational.__new__(Rational)
   2359             mpq_div(x.value, (<Rational>left).value, (<Rational>right).value)

ZeroDivisionError: rational division by zero

This gives a divison by zero since the direction is normalized by the last coordinate.

This is a follow-up of #10519.

Change History (2)

comment:1 Changed 6 weeks ago by jdemeyer

  • Description modified (diff)

comment:2 Changed 6 weeks ago by jdemeyer

  • Description modified (diff)
  • Milestone changed from sage-7.1 to sage-8.1
Note: See TracTickets for help on using tickets.