2
$\begingroup$

I have an equation in $x$ as follows:

$f(x)=\prod\limits_{j=0}^{k}(j+x)=x(1+x)(2+x)\cdots(k+x)$

I want to express this as a polynomial in $x$, i.e., as $a_0x^0+a_1x^1+\cdots+a_kx^k$

I tried doing the following:

Collect[Product[j + x, {j, 0, k}], x]

However, I get the result as $x (x+1)_k$ where $(a)_n$ is the Pochhammer symbol (rising factorial) which is equivalent to $(1+x).(2+x)\cdots(k+x)$ which is not quite what I was looking for.

Please help me obtain the above function as a polynomial in powers of $x$.

$\endgroup$
4
  • 1
    $\begingroup$ Your code seems a mixture of TeX and Mathematica, so it's not exactly clear what input you've given. Mathematica won't/can't expand the product with an indeterminate limit k. Are you looking for a formula for $a_n$? $\endgroup$
    – Michael E2
    Commented Apr 27, 2016 at 11:49
  • $\begingroup$ I wanted to expand the product for indeterminate limit $k$, but as you say, it seems to be impossible with mathematica $\endgroup$
    – Priya P
    Commented Apr 27, 2016 at 11:50
  • 2
    $\begingroup$ You can get a definite number of terms of the expansion with Series[Pochhammer[x, k+1], {x, 0, 3}], but you have specify a numeric degree like 3 at which to truncate the series. (Use something like @MichaelE2 to ensure a commenter gets notified of a reply. The author of a post is always notified.) $\endgroup$
    – Michael E2
    Commented Apr 27, 2016 at 12:08
  • $\begingroup$ @MichaelE2 Thank you $\endgroup$
    – Priya P
    Commented Apr 30, 2016 at 3:48

3 Answers 3

5
$\begingroup$

The expressions for the coefficients of the Pochhammer symbol are in fact well-known (see e.g. Concrete Mathematics):

$$\prod_{k=0}^{n-1}(x+k)=\sum_{k=0}^n \left[{n}\atop{k}\right]x^k$$

where $\left[{n}\atop{k}\right]$ is a Stirling cycle number. In Mathematica, this corresponds to (-1)^(n - k) StirlingS1[n, k].

Table[Product[x + k, {k, 0, n - 1}] == 
      Sum[(-1)^(n - k) StirlingS1[n, k] x^k, {k, 0, n}], {n, 0, 10}]
   {True, True, x (1 + x) == x + x^2, 
    x (1 + x) (2 + x) == 2 x + 3 x^2 + x^3, 
    x (1 + x) (2 + x) (3 + x) == 6 x + 11 x^2 + 6 x^3 + x^4, 
    x (1 + x) (2 + x) (3 + x) (4 + x) == 
    24 x + 50 x^2 + 35 x^3 + 10 x^4 + x^5}

And @@ Expand[%]
   True

For completeness, here is the corresponding formula for factorial powers:

And @@ Expand[Table[Product[x - k, {k, 0, n - 1}] == 
                    Sum[StirlingS1[n, k] x^k, {k, 0, n}], {n, 0, 5}]]
   True
$\endgroup$
1
  • $\begingroup$ Awesome!! Thank you :) $\endgroup$
    – Priya P
    Commented May 7, 2016 at 9:47
4
$\begingroup$
f[n_, x_] := Expand[Fold[(#2 + x - 2) #1 & , Range[n + 1]]]

e.g.

Grid[{f[#, t], CoefficientList[f[#, t], t]} & /@ Range[0, 10]]

enter image description here

Just to illustrate unexpanded polynomial:

g[n_, x_] := Fold[(#2 + x - 2) #1 & , Range[n + 1]]
TableForm[{#, g[#, u], g[#, 1], #!} & /@ Range[0, 5], 
 TableHeadings -> {None, {"n", "p(u)", "p(1)", "n!"}}]

enter image description here

$\endgroup$
1
$\begingroup$
f = Expand[# Denominator@FunctionExpand@FactorialPower[#, -#2 + 1]] &;

f[t, 3]

Mathematica graphics

Grid[{#, f[x, #], Rest@CoefficientList[f[x, #], x]} & /@ Range[5], 
    Alignment -> Left]

Mathematica graphics

Or

f2 = Expand[FunctionExpand[FactorialPower[#, #2]] /. i_Integer :> -i] &;
Grid[{#, f2[x, #]} & /@ Range[5], Alignment -> Left]

Mathematica graphics

$\endgroup$
1
  • $\begingroup$ I actually wanted the expansion for an indeterminate (denoted by $C$) number of terms, but I suppose I have to adjust with this. Thank you! $\endgroup$
    – Priya P
    Commented Apr 30, 2016 at 3:50

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.