Ask Your Question

Revision history [back]

It seems that the BooleanPolynomialRing constructor doesn't accept a map object as a list of variable names, only strings and lists and tuples. It doesn't recognize map(str, xx), so it converts it to a string, which yields '<map object at 0x7f9a3205e400>', which is not alphanumeric, so it says it's not valid as a name of a variable.

Instead, you can pass list(map(str, xx)).

An easier option is just P = BooleanPolynomialRing(l, f.variables()). The constructor converts all the elements of f.variables() to strings, to be used as the names of variables in P.


By the way, instead of inject_variables you can also do x = V.gens(), and then x[0] will be x0, etc. This is useful in library code, where you don't want to inject variables. In user code, injecting variables is fine.