Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

When evaluating the following

(Factorial[n + 1]/Factorial[(n + 1) - (k + 1)])

with Mathematica 9, the result is sent to output as

(1 + n)!/((n + 1) - (k + 1))!

I would like to show the expanded (if that's the correct term) form of the result , if possible, to show for example

(n + 1)n(n - 1)...(n+1-k)

Is there a function like Expand to accomplish this?

share|improve this question
1  
Think again about what do you want as a result. ... isn't valid syntax in Mathematica –  belisarius Sep 23 '13 at 1:34
    
How would you know the bounds for the expansion? What exactly do you want for output? –  Mr.Wizard Sep 23 '13 at 3:16
    
Your indeterminate product can be represented Product[i, {i, n + 1 - k, n + 1}], but Product evaluates to Pochhammer[1 - k + n, 1 + k]. One could perhaps format Pochhammer to display as you wish. Would that be what you're after? –  Michael E2 Sep 23 '13 at 12:44
add comment

1 Answer 1

up vote 3 down vote accepted

It is a nonstandard syntax but it can be easily implemented with UpValues

FactorialExpand[expr_] := 
   expr /. Binomial[n_, k_] :> n!/k!/(n - k)! /. Factorial[x_] :> ProductSequence[1, x];

ProductSequence /: ProductSequence[a_, b1_]/ProductSequence[a_, b2_] :=
   ProductSequence[b2 + 1, b1];

MakeBoxes[ProductSequence[a_, b_], StandardForm] ^:= 
 RowBox[{MakeBoxes[#1 #2], "...", MakeBoxes[#3 #4]}] &[a, a + 1, b - 1, b];

(1 + n)!/((n + 1) - (k + 1))! // FactorialExpand
(1 - k + n) (2 - k + n) ... n (1 + n)

I also add Binomial expansion

Binomial[n, k] // FactorialExpand
((1 + k) (2 + k) ... (-1 + n) n)/(1 2 ... (-1 - k + n) (-k + n))
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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