I have a function of $r$ which I expand at $\infty$ using Series. It is a complicated and messy function, with a parameter $0 \leq \epsilon < 1$. After expansion, the total series consists of terms like

$$ \left(\frac{r}{M}\right)^{2 + 2\epsilon} \left(\frac{a}{r^2} + r^{2 \epsilon} + ..... \right) $$

I want to collect the coefficients of $r$ from this series expansion which is denoted by serinf in the following code block. (I have not copied the entire expansion here, since it is too big. I have uploaded a Mathematica notebook here, and the series has been saved - it might take a minute or two to evaluate. When I use SeriesCoefficient I get back terms with the variable $r$ even though the series was obtained using Series[f[r], {r,∞, 4}] which is not what I want.

How do I get the coefficients of different powers of $r$, even those that include real but non-integral symbolic exponents?

  • 2
    $\begingroup$ There are ways to handle Puiseux series (en.wikipedia.org/wiki/Puiseux_series) involving terms such as $r^\epsilon$, but not using built-in functionality. In your notebook you write "Below is a series which has been expanded at infinity, up to order 4". I'd like to see f[r] before being expanded into an asymptotic series. And there are new(er) Asymptotic functions that might be better than Series for your problem. $\endgroup$
    – TheDoctor
    Commented Jul 6, 2022 at 21:48

2 Answers 2


Let your expression be myExpression. Then to obtain a list of coefficients of the powers of $r$, first extract all the exponents in theExp. Then supply the list of exponents to Coefficient:

theCoeff=Coefficient[myExpression,r,#]&/@ theExp;

You can go further and make a table of exponent and coefficient:


with the "//N" meaning to display the coefficient to machine precision. Or if you want to see the first ten for example:



Take for example your portion of the expression above:

myExpression = (r/theM)^(2 + 2 \[Epsilon]) (a/r^2 + r^(2 \[Epsilon]))
Exponent[myExpression, r, List]

(* {2 \[Epsilon], 2 + 4 \[Epsilon]} *)

However, when I attempt to retrieve the coefficients:

 theCoeff = Coefficient[Expand@myExpression, r, #] & /@ theExp

(* {(r^2 (r/theM)^(2 \[Epsilon]))/theM^2,0} *)

These are not correct. Should be:

$$ \left\{\frac{a}{m^{2+2\epsilon}},\frac{1}{m^{2+2\epsilon}}\right\} $$

Don't know what the problem is.

  • $\begingroup$ Exponent[myExpression,r,List] does not return any exponent that includes $\epsilon$. It looks like it's the same problem again, where Mathematica does not recognise non-integral/symbolic exponents. $\endgroup$
    – newtothis
    Commented Mar 24, 2022 at 5:53
  • $\begingroup$ Ok. It seems the exponents of your expression above were identified but when I attempted to retrieve the associated coefficients, Mathematica returned the wrong results. See above. $\endgroup$
    – josh
    Commented Mar 24, 2022 at 12:43

How about

(r/theM)^(2 + 2 \[Epsilon]) (a/r^2 + r^(2 \[Epsilon]));
Table[PowerExpand@Expand[expr][[j]] /. r -> 1, {j, 1, 

{a theM^(-2 - 2 \[Epsilon]), theM^(-2 - 2 \[Epsilon])}

? We put r==1 in the j-th term of the expanded expr to obtain the j-th coefficient.


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.