I was trying to get Mathematica to simplify some moderately ugly sums and I ran into some pretty weird behaviour, which I tracked down to the following example. I'm working with Christoffel-Darboux-type sums of Hermite polynomials, which are known to simplify nicely, a fact of which Mathematica is aware:
Sum[(HermiteH[k, x] HermiteH[k, y])/(2^k k!), {k, 0, n}]
Out[1]= (2^(-1 - n) (HermiteH[n, y] HermiteH[1 + n, x] -
HermiteH[n, x] HermiteH[1 + n, y]))/((x - y) n!)
So far so good. However, even simple changes to the above expression make Mathematica output a far more complex answer which is not what I'm looking for in general and which in this case is evidently rather wrong:
Sum[(HermiteH[k, -x] HermiteH[k, y])/(2^k k!), {k, 0, n}]
The problem is somewhat related to this question on Simplify, but I can't see why Mathematica would think the code above is in any way simpler than just
-(2^(-1 - n) (HermiteH[n, y] HermiteH[1 + n, -x] -
HermiteH[n, -x] HermiteH[1 + n, y]))/((x + y) n!)
Can anyone share some insight? or is this some kind of bug?

Sum[...] /. ...doesn't work in this case because the simplification occurs first. TheSumhas to be held. So, while not quite as safe as a rule, this was the most straightforward method to accomplish the task automatically. – rcollyer Apr 13 '12 at 14:50DifferenceRoot, so that hopefully MM will try to explore other avenues? – Emilio Pisanty Apr 13 '12 at 15:36Sumwon't magically know about how to perform the simplification you want because it doesn't know about it now. Second, as these simplifications are handled internally, turning off this specific simplification would be difficult, and likely would require turning them all off. To turn them off, wrap the code in aBlock[{Sum}, <hand coded simplifications>; Sum[...]]. WhenBlockfinishes executing the old definition will take over, and anySumremaining will use the built-in simplifications. – rcollyer Apr 13 '12 at 15:54Blockyou still have toUnprotect[Sum]to be able to change its definitions. – rcollyer Apr 13 '12 at 15:55DifferenceRootso that sums MM cannot simplify are returned as is, and hopefully so that all other possible simplifications will be carried out. – Emilio Pisanty Apr 14 '12 at 19:18Simplify, I'd suggest using either of the optionsComplexityFunctionorTransformationFunctionsto accomplish what you want. But, the simplification occurs beforeSimplifyhas a chance to work. So, we need to rely on other means to forceSumto do what you wish. – rcollyer Apr 15 '12 at 01:10DifferenceRootwould be difficult, at best, to accomplish as its use is buried deep enough that it is out of user control. I understand your frustration; getting Mathematica to put an expression in a particular form is very difficult, most of the time. I'd argue that it works best as a guide in this particular endeavor, and is ultimately incapable of doing what you want without a lot of manual intervention. – rcollyer Apr 15 '12 at 01:18