Picking Out Pieces of Algebraic Expressions

Functions to pick out pieces of polynomials.

Here is an algebraic expression:

e=Expand[(1+3x+4y^2)^2]

This gives the coefficient of x in e:

Coefficient[e,x]

(RefLink[Exponent, paclet:ref/Exponent])[expr,y] gives the highest power of y that appears in expr:

Exponent[e,y]

This gives the fourth term in e:

Part[e,4]

You may notice that the function (RefLink[Part, paclet:ref/Part])[expr,n] used to pick out the n(^th) term in a sum is the same as the function described in "Manipulating Elements of Lists" for picking out elements in lists. This is no coincidence. In fact, as discussed in "Manipulating Expressions like Lists", every Wolfram Language expression can be manipulated structurally much like a list. However, as discussed in "Manipulating Expressions like Lists", you must be careful, because the Wolfram Language often shows algebraic expressions in a form that is different from the way it treats them internally.

(RefLink[Coefficient, paclet:ref/Coefficient]) works even with polynomials that are not explicitly expanded out:

Coefficient[(1+3x+4y^2)^2,x]

Functions to pick out pieces of rational expressions.

Here is a rational expression:

r=(1+x)/(2 (2-y))

(RefLink[Denominator, paclet:ref/Denominator]) picks out the denominator:

Denominator[%]

(RefLink[Denominator, paclet:ref/Denominator]) gives 1 for expressions that are not explicit quotients:

Denominator[1/x+2/y]