1
$\begingroup$

Assumption:: m and n are integers and greater than zero.

$Assumptions = {Element[m, Integers] && m >= 0, Element[n, Integers] && n >= 0}

Consider the following,

Pochhammer[n + a_, m_] :>  Pochhammer[a, m + n]/Pochhammer[a, n]

This simplifies the Pochhammers with arguments (n+a+b,m).

in : Pochhammer[n + a + b, m]
out : Pochhammer[a + b, m + n]/Pochhammer[a + b, n]

I want to generalize it, so that it simlifies Pochhammer[3n + a + b, 2m] to Pochhammer[ a + b, 3n+2m]

I tried as follows,

Pochhammer[n_Integers + a_, m_Integers] :>  Pochhammer[a, m + n]/Pochhammer[a, n]

or

Pochhammer[n*x_Integers + a_, m*y_Integers] :>  Pochhammer[a, y*m + x*n]/Pochhammer[a, x*n]

None of them works. Can anyone tell what is wrong here, what the correct way?

$\endgroup$
6
  • 1
    $\begingroup$ You cannot use Integers this way. The pattern n_Integers represents any expression (Blank[]), here called n that has Head Integers. But in Mathematica, Integers is not used as a Head, it's used as an assumption for Solveing, Simplifying etc. $\endgroup$ Commented May 7, 2020 at 8:05
  • 1
    $\begingroup$ In your case, the inputs you are matching will either have Head equal to Symbol for your undefined variables, or if you input numbers, they will have one of several Heads used for numbers. In that case, the pattern should usually be n_?IntegerQ or n_?NumericQ. $\endgroup$ Commented May 7, 2020 at 8:07
  • $\begingroup$ @marius, there’s also the head Integer (notice the lack of “s”), so n_Integer would work as well. That is what IntegerQ looks for, according to the documentation. $\endgroup$
    – MarcoB
    Commented May 7, 2020 at 14:12
  • $\begingroup$ At the beginning, I assume m and n are integers and greater than zero then tried these, Pochhammer[a_ + n_Integer, m_] :> Pochhammer[a, m + n]/ Pochhammer[a, n] on Pochhammer[a + n, m]. This does not work $\endgroup$
    – Antimony51
    Commented May 8, 2020 at 6:36
  • $\begingroup$ Pochhammer[a_ + n_?IntegerQ, m_] :> Pochhammer[a, m + n]/ Pochhammer[a, n] does not help too. $\endgroup$
    – Antimony51
    Commented May 8, 2020 at 6:39

1 Answer 1

1
$\begingroup$

The answer that I was looking for is

sim = Pochhammer[ x_. (z_. n + a_), m___] :>  Pochhammer[  x a, m + x z n]/
 Pochhammer[x a, x z n]

It does the following simplifications

in:= Pochhammer[2 n + a, m] //. sim
out:=Pochhammer[a, m + 2 n]/Pochhammer[a, 2 n]
in:=Pochhammer[n + 3 a, m] //. sim
out:=Pochhammer[3 a, m + n]/Pochhammer[3 a, n]
in:=Pochhammer[-5 n + 3 a, m] //. sim
out:=Pochhammer[3 a, m - 5 n]/Pochhammer[3 a, -5 n]
in:=Pochhammer[-5 n + 3 a + 2 b - d, m] //. sim
out:=Pochhammer[3 a + 2 b - d, m - 5 n]/Pochhammer[3 a + 2 b - d, -5 n]

But,

in:=Pochhammer[-5 n + 3/2 (a - n) + 2 b - d/2, m] //. sim
out:=Pochhammer[2 b - d/2 + (3 (a - n))/2, m - 5 n]/Pochhammer[
 2 b - d/2 + (3 (a - n))/2, -5 n]

In order to avoid this problem,

in:=Together /@ Pochhammer[-5 n + 3/2 (a - n) + 2 b - d/2, m] //. sim
out:=Pochhammer[1/2 (3 a + 4 b - d), m - (13 n)/2]/Pochhammer[
 1/2 (3 a + 4 b - d), -((13 n)/2)]
$\endgroup$

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.