Evaluation of Boolean function at a point.

Hello! I am struggling with the following code. I have a random Boolean function, f, in n variables (n varies) and also a set of n tuples which is generated from some other code. Now I want to evaluate the function f at one of the points, i.e., I want to determine f(a). But a, being of the form say a = [random.randit(0,1) for i in range(n)], is not being taken as an input for f. Moreover changing a to tuple(a) or list(a) neither works. I am writing down the problem in the following code:

n = 4

R = BooleanPolynomialRing(n,['x%d'%i for i in range(n)])

f = R.random_element()

print(f)

import random

a = [random.randint(0,1) for i in range(n)]

print(f(a))

Upon running this shows the error:

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

edit retag close merge delete

Sort by ยป oldest newest most voted

A single argument consisting of a list or a tuple is not accepted as input. Only keyword arguments or n positional arguments (but not both) are accepted. To pass n positional arguments, you can do f(*a).

more