# Ticket #9717: polybori-0.6.4.p2.patch

File polybori-0.6.4.p2.patch, 1.6 KB (added by malb, 12 years ago)

Sage library patch fixing an issue with substitute_variable()

• ## sage/rings/polynomial/pbori.pyx

# HG changeset patch
# Date 1281444370 -3600
# Node ID a46f9f3374608411e8b4fb5940444833d06b1173
# Parent  848eec53713fb713902dc549ae5cd9575578c5d5
#9717 fixing parent ring in substitute_variable() (fix due to Alexander Dreyer)

diff -r 848eec53713f -r a46f9f337460 sage/rings/polynomial/pbori.pyx
 a ``var(i)`` is replaced by ``vec[i]`` in ``poly``. EXAMPLE:: sage: B. = BooleanPolynomialRing() sage: f = a*b + c + 1 sage: from polybori import substitute_variables a*b + a + b + c sage: substitute_variables([a+1,b+1,B(0)],f) a*b + a + b Substitution is also allowed with different rings:: sage: B. = BooleanPolynomialRing() sage: f = a*b + c + 1 sage: B. = BooleanPolynomialRing(order='deglex') sage: from polybori import substitute_variables sage: substitute_variables([x,y,z], f) * w w*x*y + w*z + w """ cdef BooleanPolynomialVector _vec _vec = BooleanPolynomialVector() for f in vec: _vec.append(f) return new_BP_from_PBPoly((poly._parent), pb_substitute_variables(_vec._vec, poly._pbpoly)) return new_BP_from_PBPoly((_vec._parent), pb_substitute_variables(_vec._vec, poly._pbpoly)) def set_random_seed(seed):