Message Boards Message Boards


Coefficient command

Posted 10 years ago
2 Replies
0 Total Likes

I have tried to use the command Coefficient in the following polynomial: (x+y+z)^3 but it did not work as showed below:
 In[144]:= poly = (x + y + z)^3;
 Coefficient[poly, xyz]
 Out[145]= 0
 In[107]:= Expand[(x + y + z)^3]
 Out[107]= x^3 + 3 x^2 y + 3 x y^2 + y^3 + 3 x^2 z + 6 x y z +
  3 y^2 z + 3 x z^2 + 3 y z^2 + z^3
 In[148]:= poly = (x + y + z)^3;

Coefficient[poly, x*y*z]
Out[149]= 6

As you can see above the right coefficient for xyz is 6 and not 0. This command just worked when I used x*y*z instead of xyz. Could you help me to understand this failure?

Thank you
POSTED BY: Ana Squadri
2 Replies
The spaces are necessary so that the product x y z is not interpreted as the single symbol xyz.
In[1]:= Coefficient[(x + y + z)^3, x y z]

Out[1]= 6
POSTED BY: Ilian Gachevski
Posted 10 years ago
Thank you
POSTED BY: Ana Squadri
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract