Wolfram mathematica 收集Mathematica中的常用术语

Wolfram mathematica 收集Mathematica中的常用术语,wolfram-mathematica,Wolfram Mathematica,给定一个大表达式,如何在Mathematica中收集变量的各种幂 例如: p = (1 + a + x)^4; Expand[p] Out: 1 + 4 a + 6 a^2 + 4 a^3 + a^4 + 4 x + 12 a x + 12 a^2 x + 4 a^3 x + 6 x^2 + 12 a x^2 + 6 a^2 x^2 + 4 x^3 + 4 a x^3 + x^4 使用收集[expression,variable]。从: 或系数列表。也可从以下网址: 您是否有一个简短

给定一个大表达式,如何在Mathematica中收集变量的各种幂

例如:

p = (1 + a + x)^4;
Expand[p]
Out: 1 + 4 a + 6 a^2 + 4 a^3 + a^4 + 4 x + 12 a x + 12 a^2 x +
     4 a^3 x + 6 x^2 + 12 a x^2 + 6 a^2 x^2 + 4 x^3 + 4 a x^3 + x^4

使用
收集[expression,variable]
。从:


系数列表
。也可从以下网址:


您是否有一个简短的示例,说明您试图收集的表达式类型?目前的答案涉及收集多项式表达式中的术语,它们可能并不完全符合您的需要。
In[1]:=Collect[(1 + a + x)^4, x]
Out[1]=(1 + a)^4 + 4 (1 + a)^3 x + 6 (1 + a)^2 x^2 + 4 (1 + a) x^3 + x^4
In[1]:= CoefficientList[(1 + x)^10 , x]

Out[1]= {1, 10, 45, 120, 210, 252, 210, 120, 45, 10, 1}

In[1]:= CoefficientList[1 + a x^2 + b x y + c y^2, {x, y}]

Out[1]= {{1, 0, c}, {0, b, 0}, {a, 0, 0}}