Trying to solve a linear Diophantine equation with Sage, one gets an error:

sage: from sympy.solvers.diophantine import diop_linear
sage: from sympy.abc import x, y
sage: diop_linear(214866*x+305900*y-419336)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-9-ff311ac80176> in <module>()
----> 1 diop_linear(Integer(214866)*x+Integer(305900)*y-Integer(419336))

/home/hb/Downloads/sage-6.8-x86_64-Linux/local/lib/python2.7/site-packages/sympy/solvers/diophantine.py
 in diop_linear(eq, param)
    375     diop_general_sum_of_squares()
    376     """
--> 377     var, coeff, diop_type = classify_diop(eq)
    378
    379     if diop_type == "linear":

/home/hb/Downloads/sage-6.8-x86_64-Linux/local/lib/python2.7/site-packages/sympy/solvers/diophantine.py
 in classify_diop(eq)
    232     ([x, y], {1: 5, x: 1, x**2: 1, y: 0, y**2: 1, x*y: -1}, 
'binary_quadratic')
    233     """
--> 234     eq = eq.expand(force=True)
    235     var = list(eq.free_symbols)
    236     var.sort(key=default_sort_key)

/home/hb/Downloads/sage-6.8-x86_64-Linux/src/sage/symbolic/expression.pyx in 
sage.symbolic.expression.Expression.expand 
(/opt/sagemath_tmonteil-debian-wheezy-64/sage-6.8/src/build/cythonized/sage/symbolic/expression.cpp:23858)()
   4069         return new_Expression_from_GEx(self._parent, 
series_to_poly(self._gobj))
   4070
-> 4071     def expand(Expression self, side=None):
   4072         """
   4073         Expand this symbolic expression. Products of sums and 
exponentiated

TypeError: expand() got an unexpected keyword argument 'force'


Doing the same thing in Python3, one gets the correct result:

>>> from sympy.solvers.diophantine import diop_linear
>>> from sympy.abc import x, y
>>> diop_linear(214866*x+305900*y-419336)
(6650*t - 21595804, -4671*t + 15169024)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-nt" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send an email to [email protected].
Visit this group at http://groups.google.com/group/sage-nt.
For more options, visit https://groups.google.com/d/optout.

Reply via email to