# Revision history [back]

You are looking to substitute some x_i by 0 into f

To get the x_i, you can use (i chose k=3, n=7 in this example):

sage: B.gens()
(x0, x1, x2, x3, x4, x5, x6)


For example, to select the first k inderetminates, you can do:

sage: B.gens()[:k]
(x0, x1, x2)


For the substitution, you have to produce a dictionary whose keys are the selected indeterminates and the values are always 0:

sage: in_dict = {g:0 for g in B.gens()[:k]}
sage: in_dict
{x2: 0, x1: 0, x0: 0}


Then you can make your substitution:

sage: f
x0 + x1*x3 + x1*x6 + x2*x4 + x3*x5 + x3
sage: f.subs(in_dict)
x3*x5 + x3


You are looking to substitute some x_i by 0 into f

To get the x_i, you can use (i chose k=3, n=7 in this example):

sage: B.gens()
(x0, x1, x2, x3, x4, x5, x6)


For example, to To select the first k inderetminates, you can do:

sage: B.gens()[:k]
(x0, x1, x2)


For the substitution, you have to produce a dictionary whose keys are the selected indeterminates and the values are always 0:

sage: in_dict = {g:0 for g in B.gens()[:k]}
sage: in_dict
{x2: 0, x1: 0, x0: 0}


Then you can make your substitution:

sage: f
x0 + x1*x3 + x1*x6 + x2*x4 + x3*x5 + x3
sage: f.subs(in_dict)
x3*x5 + x3