此为 Mathematica 4 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.1)

Collect

Usage

Collect[expr, x]把涉及匹配 x的对象的相同幂的项合并到一起。
Collect[expr,   ,  , ...  ]把涉及匹配  ,  的对象的相同幂的项合并到一起。
Collect[expr, var, h] h 应用到形成获得的每一项的系数的表达式。


Notes

Collect[expr, x]有效的把expr写为一个 x 的多项式或 x 的分数幂。
• 例如: Collect[x + n x + m, x]LongRightArrow ; Collect[(1+x+y)^3, x]LongRightArrow .
Collect[expr, x, Simplify]可以用于分别简化每个系数。
• 参见Mathematica全书: 1.4.5 and 节 3.3.1.
• 同时参见: Series, CoefficientList, Together, Cases.
Further Examples

These two inputs collect terms first in the variable x and then in the variable y.

In[1]:=  

Out[1]=

In[2]:=  

Out[2]=

This first collects with respect to x, then collects coefficients with respect to y inside of each of the x coefficients.

In[3]:=  

Out[3]=

In this example we use Collect to rewrite an expression by pulling out factors common only to certain parts.

In[4]:=  

Out[4]=

This example has the usual two arguments.

In[5]:=  

Out[5]=

Collect applies an optional third argument to the innermost coefficients of the collected terms.

In[6]:=  

Out[6]=

You can use patterns to collect all the products of powers of x and y in a polynomial that involves other variables.

In[7]:=  

Out[7]=