2
$\begingroup$

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!

$\endgroup$
1

1 Answer 1

3
$\begingroup$

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
$\endgroup$
5
  • $\begingroup$ Thank you! This answered my question $\endgroup$
    – Mathew
    Commented May 21, 2015 at 19:54
  • 2
    $\begingroup$ In fact, since it's a polynomial, even the humble f[0, 0] works nicely. $\endgroup$ Commented May 21, 2015 at 19:58
  • $\begingroup$ You're right, I don't know why I never thought about that $\endgroup$
    – Mathew
    Commented May 21, 2015 at 20:00
  • $\begingroup$ @J. M. Now I feel foolish. :-( $\endgroup$
    – Mr.Wizard
    Commented May 21, 2015 at 21:08
  • $\begingroup$ Not too late to edit, Wiz. ;) $\endgroup$ Commented May 21, 2015 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.