Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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."

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."