sage: R.<x,y,z> = BooleanPolynomialRing(3) sage: f = R.random_element() sage: G = [R.random_element() for _ in range(3)] sage: f.sub f.subs f.substitute sage: f.subs(x=1) y*z sage: f(*G) x*y + x*z + x + y + 1
On Tuesday 17 Jul 2012, virensule wrote: > How do I evaluate and compose Boolean functions in Boolean polynomial ring? > > For example I have > > R=BooleanPolynomialRing(3,x) > x=R.gens() > f=BooleanFunction(x[0]*x[1]+x[1]*x[2]+x[1]+1) > > Now how do I find the function g=f(evaluated when x[0]=1)? > > Also if g is another function defined similarly, how do I compute f(g()) > composition? > > Can someone help please? > > Thanks in advance. > Virendra Cheers, Martin -- name: Martin Albrecht _pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF _www: http://martinralbrecht.wordpress.com/ _jab: [email protected] -- To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
