Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1997

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Q: Collect, Coefficient, and non-integer exponents

  • To: mathgroup at
  • Subject: [mg8771] Re: Q: Collect, Coefficient, and non-integer exponents
  • From: Daniel Lichtblau <danl>
  • Date: Thu, 25 Sep 1997 12:26:06 -0400
  • Organization: Wolfram Research, Inc.
  • Sender: owner-wri-mathgroup at

Sergio Rojas wrote:
> (**
>         Hi folks,
>         Assume that for fun one want to deal with an expression containing
>         non-integer powers of a certain variable x. Take as an illustration
>         the following expression;
>                                                                      ******)
> expr = Expand[Sum[(a*n +b*n -c)*x^(n+0.12/n),{n,1,4}]];
> (**
>         One knows in advance that a power of x is, for example, 1.12 and
>         we want to know its coefficient. Apparently Coefficient and Collect
>         work only with integers. Is there a way to deal with this situation?
> Salut,
> Rojas
> E-mail: sergio at
> PS.
>    I am using Mathematica:
> In[37]:= $Version
> Out[37]= DEC OSF/1 Alpha 2.2 (September 9, 1994)
>                                                                      ******)

In version 3 one can extract Coefficient with respect to more general
exponents. One caveat is that using inexact numbers might pose
difficulties (the exponent you think you have may not be exactly the
exponent you actually have).

One way to perform the Collect is to allow a pattern variable for the
exponent. This will in effect create a separate "variable" for each
distinct power, and this suffices to do what you want in this particular

In[10]:= expr = Expand[Sum[(a*n +b*n -c)*x^(n+0.12/n),{n,1,4}]];
In[11]:= Collect[expr, x^_.] // InputForm
  (a + b - c)*x^1.12 + (2*a + 2*b - c)*x^2.06 + (3*a + 3*b - c)*x^3.04 +
   (4*a + 4*b - c)*x^4.03

Daniel Lichtblau
Wolfram Research
danl at

  • Prev by Date:
  • Next by Date: AltGr and Delimiter-Flash
  • Previous by thread: Re: Q: Collect, Coefficient, and non-integer exponents
  • Next by thread: Re: Memory Leak