1

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
J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
spaceKnot
  • 383
  • 1
  • 8

1 Answers1

7

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
Artes
  • 57,212
  • 12
  • 157
  • 245