I'm crunching some infinite summations, and sometimes Mathematica generates results that have the PolyGamma[0, x]
function (which is the Digamma) and sometimes the HarmonicNumber[ ]
. I'd like to choose one or the other as to what's generated. My fallback is to use a rule for replacement, but curious as to how Mathematica chooses what to generate.
Here's an interesting example:
The first one has PolyGamma
in it, both before and after FullSimplify
res = m + Sum[2 (m - k + 1) 1/(1 - 4 (1 - k)^2), {k, 2, m}] // FullSimplify
(* 1/2 (EulerGamma + 2/(-1 + 2 m) + Log[4] + PolyGamma[0, -(1/2) + m]) *)
This one, same as the one above but without the presum of m
, resolves with PolyGamma
res = Sum[2 (m - k + 1) 1/(1 - 4 (1 - k)^2), {k, 2, m}]
(* (2 + 2 m - 4 m^2 + PolyGamma[0, 1/2] - 2 m PolyGamma[0, 1/2] - PolyGamma[0, -(1/2) + m] + 2 m PolyGamma[0, -(1/2) + m])/(2 (-1 + 2 m))
But if simplified, goes to the Harmonic Number
res // FullSimplify
(* (2 + (-1 + 2 m) HarmonicNumber[-(3/2) + m] - Log[4] + 2 m (1 - 2 m + Log[4]))/(-2 + 4 m) *)