So let's say f[x_, y_] := (2 x + 2 y + 1)^2
, when I type Coefficient[f[x, y], x y]
I receive 8
. But what can I input to receive 1
, when (x^0) (y^0)
? Thanks!
1 Answer
Pardon me if I misunderstand your request.
{0, 0} /. CoefficientRules[f[x, y], {x, y}]
1
Fold[Coefficient[##, 0] &, f[x, y], {x, y}]
1
CoefficientList[f[x, y], {x, y}][[1, 1]]
1
Or far more elegantly in this case as J.M. recommends in a comment:
f[0, 0]
1
-
-
2$\begingroup$ In fact, since it's a polynomial, even the humble
f[0, 0]
works nicely. $\endgroup$ May 21, 2015 at 19:58 -
$\begingroup$ You're right, I don't know why I never thought about that $\endgroup$– MathewMay 21, 2015 at 20:00
-
-
$\begingroup$ Not too late to edit, Wiz. ;) $\endgroup$ May 21, 2015 at 21:13
CoefficientArrays[]
. $\endgroup$