1
$\begingroup$

I am new to Mathematica, I am searching for a way to create an expression with a sequence of terms such as:

(x-1)/x  (x-2)/x  (x-3)/x  (x-4)/x … (x-n)/x
$\endgroup$
7
$\begingroup$

Since you are looking for the best method try symbolic capabilities of Mathematica, so this is the recommended way to go :

Product[(x - i)/x, {i, n}]
(-(1/x))^n Pochhammer[1 - x, n]

this result might be represented in a different way e.g. using FunctionExpand with TraditionalForm :

Product[(x - i)/x, {i, n}] // FunctionExpand // TraditionalForm

enter image description here

i.e. we have expressed the Pochhammer function in terms of the Euler gamma function. In general one could use simply indefinite Product (since the ver.7 there are also indefinite sums and product), however we have to remember that the convention is the following e.g.

Product[n, n]
(-1 + n)!

instead of n! as one might expect so using an indefinite product would be more complicated to get the result.

Another ways (though not so elegant) use e.g. lists e.g. Table or Range but then you have to replace a formal variable n by a natural number, e.g. :

Times @@ ((x - Range[n /. n -> 10])/x)
Unevaluated[ Times @@ ((x - Range[n])/x) == (Product[(x - i)/x, {i, n}])] /. n -> 10
((-10 + x)(-9 + x)(-8 + x)(-7 + x)(-6 + x)(-5 + x)(-4 + x)(-3 + x)(-2 + x)(-1 + x))/x^10

 True

while with Product one can operate on a purely symbolic level.

We had to enclose the equality in Unevaluated for several reasons, to examine what might go wrong try to use it without Unevaluated. I recommend to take a closer look at the evaluation sequence of the last code line, e.g.

Unevaluated[ Times@@((x - Range[n])/x) == (Product[(x - i)/x, {i, n}])] /.n -> 10 //Trace
| improve this answer | |
$\endgroup$
  • $\begingroup$ Thank you very much. That is exactly what I was looking for! $\endgroup$ – spaceKnot Mar 27 '13 at 15:25
  • 1
    $\begingroup$ I'd have used x^-n FactorialPower[x - 1, n] or n! x^-n Binomial[x - 1, n] myself... $\endgroup$ – J. M.'s discontentment Jun 14 '13 at 20:02
  • $\begingroup$ Product[(x - i)/x, {i, n}] is a bit simpler if we are pleased with Pochhammer. $\endgroup$ – Artes Jun 14 '13 at 20:08
  • $\begingroup$ @spaceKnot I'm glad it was helpful however since "That is exactly what I was looking for" I'm curious why it's remained unaccepted. $\endgroup$ – Artes Jun 30 '17 at 15:27
  • $\begingroup$ @Artes Sorry missed it. $\endgroup$ – spaceKnot Jul 2 '17 at 0:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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