Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can use the function like

def myreduce(f):
    return f.parent()._from_dict( {d:c for d,c in f if max(d,default=0)<=5 and 1 not in d} )

then myreduce(f) where f is your polynomial gives just

-160*e[2, 2, 2, 2] - 3328*e[3, 3, 2] + 2304*e[4, 2, 2] + 17920*e[4, 4] - 14144*e[5, 3]

You can use the function like

def myreduce(f):
    return f.parent()._from_dict( {d:c for d,c in f if max(d,default=0)<=5 d[0]<=5 and 1 not in d} d[-1]>=2} )

then myreduce(f) , where f is your polynomial gives justpolynomial, gives

-160*e[2, 2, 2, 2] - 3328*e[3, 3, 2] + 2304*e[4, 2, 2] + 17920*e[4, 4] - 14144*e[5, 3]

You can use the function like

def myreduce(f):
    return f.parent()._from_dict( {d:c for d,c in f if d[0]<=5 and d[-1]>=2} )

then myreduce(f), where f is your polynomial, gives

-160*e[2, 2, 2, 2] - 3328*e[3, 3, 2] + 2304*e[4, 2, 2] + 17920*e[4, 4] - 14144*e[5, 3]

See also this answer.