collect - Collect coefficients

Syntax

R = collect(S)
R = collect(S,v)

Description

R = collect(S) returns an array of collected polynomials for each polynomial in the array S of polynomials.

R = collect(S,v) collects terms containing the variable v.

Examples

The following statements

syms x y;
R1 = collect((exp(x)+x)*(x+2))
R2 = collect((x+y)*(x^2+y^2+1), y)
R3 = collect([(x+1)*(y+1),x+y])

return

R1 = 
x^2+(exp(x)+2)*x+2*exp(x)

R2 = 
y^3+x*y^2+(x^2+1)*y+x*(x^2+1)

R3 = 
[(y+1)*x+y+1, x+y]

See Also

expand, factor, simple, simplify, syms

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS