Difficulty evaluating a boolean polynomial at a point specified by a tuple

21 views
Skip to first unread message

Stephen Kauffman

unread,
Jun 23, 2014, 10:57:39 PM6/23/14
to sage-s...@googlegroups.com
I have a boolean polynomial, poly, in a BooleanPolynomialRing() with in this case 108 variables. I have a tuple of length 108 (double checked) whose elements are definitely other boolean polynomials in the parent ring of poly. But when I execute:

poly(tuple(mat_list(GS)+mat_list(GC)+mat_list(GY))) # GS etc are matrices of boolean polynomials turned into lists, concatenated and then turned into a tuple

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_54.py", line 10, in <module>
exec compile(u'open("___code___.py","w").write("# -*- coding: utf-8 -*-\\n" + _support_.preparse_worksheet_cell(base64.b64decode("cG9seSh0dXBsZShtYXRfbGlzdChHUykrbWF0X2xpc3QoR0MpK21hdF9saXN0KEdZKSkp"),globals())+"\\n"); execfile(os.path.abspath("___code___.py"))
File "", line 1, in <module>

File "/tmp/tmpSB6nTU/___code___.py", line 2, in <module>
exec compile(u'poly(tuple(mat_list(GS)+mat_list(GC)+mat_list(GY)))
File "", line 1, in <module>

File "pbori.pyx", line 4023, in sage.rings.polynomial.pbori.BooleanPolynomial.__call__ (sage/rings/polynomial/pbori.cpp:27828)
ValueError: Number of arguments is different from the number of variables of parent ring.

I get the above error which doesn't make sense to me, since elsewhere in the documentation for evaluating (non boolean multivariate polynomials) f((1,2,3)) = f(1,2,3) should work.

Any ideas? thanks

-Steve

Nils Bruin

unread,
Jun 24, 2014, 12:47:59 AM6/24/14
to sage-s...@googlegroups.com
On Monday, June 23, 2014 7:57:39 PM UTC-7, Stephen Kauffman wrote:
poly(tuple(mat_list(GS)+mat_list(GC)+mat_list(GY)))                 # GS etc are matrices of boolean polynomials turned into lists, concatenated and then turned into a tuple

ValueError: Number of arguments is different from the number of variables of parent ring.

I get the above error which doesn't make sense to me, since elsewhere in the documentation for evaluating (non boolean multivariate polynomials) f((1,2,3)) = f(1,2,3) should work.
The convenience feature of allowing a tuple rather than the values separately is hardly necessary thanks to python's iterable unpacking operator * for arguments:

 poly( *(mat_list(GS)+mat_list(GC)+mat_list(GY)))

should do the trick.

It would be nice to harmonize boolean and other multivariate polynomials a bit. Whether that should consist of implementing tuples-as-arguments for boolean polys or deprecating that feature for other polynomials can be up for discussion.
Reply all
Reply to author
Forward
0 new messages