On Saturday, February 16, 2013 9:38:14 AM UTC+5:30, Santanu wrote:
>
> Dear all,
> I have the following problem.
>
>
> I am working with Boolean variables. So I call the following.
>
> from sage.crypto.boolean_function import BooleanFunction
> R.<x0,x1,x2,x3,x4,x5,x6,x7,x8,x9>=BooleanPolynomialRing(10)
>
>
> Suppose during run time of my code, I get three polynomials
> x1*x2+x3+x4, x0+x5, x4+x5. Now I want to replace last polynomial
> by x4=x1*x2+x3 & x5=x0. However this replacement is not constant.
> That is next time x4 may be replaced by x0+x1.
>
> How this is possible?
>
Hi,
The subs( ) function works with symbolic variables as well. Therefore, to
replace x4 by x1*x2 + x3 and x5 by x0, do the following:
sage:from sage.crypto.boolean_function import BooleanFunction
sage:R.<x0,x1,x2,x3,x4,x5,x6,x7,x8,x9>=BooleanPolynomialRing(10)
sage:f = x4 + x5
sage:f.subs({x4 :x1*x2 + x3, x5:x0})
x0 + x1*x2 + x3 #Answer returned by SAGE
If you have a single substitution to make, e.g replace only x5 by x0, there
is no need to pass a dictionary.
sage:f.subs(x5 = x0)
x0 + x4
I hope it is clear.
Regards,
AKHIL.
--
You received this message because you are subscribed to the Google Groups
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.