2
$\begingroup$

There is supposed to be a command or set of commands to find the constant term of a binomial expression like

$$ \left(-2x^4 + \dfrac{-5}{x}\right)^{25} $$

(-2*x^4 - 5/x)^25

but I can manage to find it. Help would be greatly appreciated.

$\endgroup$
3
  • 1
    $\begingroup$ Cases[([Minus]2 x^4 [Minus] 5/x)^25 // Expand, x_ /; NumericQ[Simplify[x]]] $\endgroup$ Jan 28, 2022 at 11:58
  • 6
    $\begingroup$ Also: In[127]:= Residue[1/x*(-2*x^4 - 5/x)^25, {x, 0}] Out[127]= -162139892578125000000 $\endgroup$ Jan 28, 2022 at 14:07
  • $\begingroup$ Moreover (and I make this as a general remark), when you want to find such a term it often pays to look where you last remember having seen it, and retrace your steps from there. $\endgroup$ Jan 29, 2022 at 23:00

3 Answers 3

17
$\begingroup$
Coefficient[(-2*x^4 - 5/x)^25, x, 0]
(*    -162139892578125000000    *)
$\endgroup$
2
  • $\begingroup$ Superb, thank you!! $\endgroup$
    – Orm
    Jan 28, 2022 at 21:51
  • 1
    $\begingroup$ Note: SeriesCoefficient is a much safer option (e.g., Coefficient[Exp[x],x,0] returns Exp[x] while SeriesCoefficient returns the expected answer). $\endgroup$ Jan 29, 2022 at 10:47
6
$\begingroup$

The following, also, works:

(-2*x^4 - 5/x)^25 // SeriesCoefficient[#, {x, 0, 0}] &

Output is

-162139892578125000000

$\endgroup$
5
$\begingroup$
(-2*x^4 - 5/x)^25 // First @* ExpandAll
-162139892578125000000
$\endgroup$
1
  • $\begingroup$ Interesting. Simple way of doing it. Thanks! $\endgroup$
    – Orm
    Jan 28, 2022 at 21:52

Your Answer

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

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