First time here? Check out the FAQ!
answered 2021-10-15 20:29:33 +0100
You can use list comprehension and the fact that symbolic expressions have a degree method as follows:
degree
sage: L = [3*x+2, 4*x^3, x+x^2, SR(2)] sage: [i for i in L if 1 <= i.degree(x) <= 2] [3*x + 2, x^2 + x]