Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Create polynomail

Hi all. I have a set od indexes of varibles and a need to create polynomial which can be evaluated from them. Example:

set = (2), (4), (5), (7,8)
polynomial = x2 + x4 + x5 + x7*x8

And I want to be able to evaluate it like this:

vector = (1, 0, 1, 0, 1, 0, 1, 0) 
result = polynomial(*vector)
# result = 0 + 0 + 1 + 1 * 0 = 1

Thank you

Create polynomailpolynomial

Hi all. I have a set od indexes of varibles and a need to create polynomial which can be evaluated from them. Example:

set = (2), (4), (5), (7,8)
polynomial = x2 + x4 + x5 + x7*x8

And I want to be able to evaluate it like this:

vector = (1, 0, 1, 0, 1, 0, 1, 0) 
result = polynomial(*vector)
# result = 0 + 0 + 1 + 1 * 0 = 1

Thank you