ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 27 May 2021 00:37:22 +0200Evaluation of Boolean function at a point.https://ask.sagemath.org/question/57285/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."`DodulThu, 27 May 2021 00:37:22 +0200https://ask.sagemath.org/question/57285/