0
$\begingroup$

I want to implement a command in Mathematica in order to simplify factorials in the following way

$$(n+x)!=(n+x)(n+x-1)\cdots n!$$

I started to build this up slowly. I have managed to implement

$$(n+x)!=(n+x)(n+x-1)!$$

in the following way

factorialproperty[function_] := # (# - 1)! &@function
(p + 3) // factorialproperty

And then I thought, to use this in a NestWhile to iterate the procedure, however, I have not managed to make it work. What I tried to do is the following

fctrl[function_] := 
 Module[{a = function}, 
  NestWhile[a, Product[(# - i)! &@a, {i, 0, 100}], a >= 0]]

And when I tried

(p + 3) // factorialproperty

I got the wrong result. I thought that I am telling Mma to do the product starting with a, a number of times (I chose i to be 100 because I will never have to compute something higher than that), until applying the product gives negative values, but clearly I have some mistake.

Any help would be appreciated.

Thanks.

$\endgroup$
2
$\begingroup$

Is this what you want?

transform = (a_ + x_Integer/;x>=1)! -> Pochhammer[a+1,x]*a!;
(p + 3)! /. transform

(1 + p) (2 + p) (3 + p) p!

This also works on more general expressions:

(p + q + 3)! /. transform

(1 + p + q) (2 + p + q) (3 + p + q) (p + q)!

(Sqrt[2] + 3)! /. transform

(1 + Sqrt[2]) (2 + Sqrt[2]) (3 + Sqrt[2]) Sqrt[2]!

$\endgroup$
1
$\begingroup$

You could start with something like this:

expandFactorial[expr_] := ReplaceRepeated[expr, (x_Symbol + i_Integer)! :> (x + i) (x + i - 1)!];

expandFactorial[(p + 3)!]

(1 + p) (2 + p) (3 + p) p!

$\endgroup$

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.