# Bug in GeneratingFunction?

Bug introduced in 7.0 and fixed in 9.0.0

According to the documentation

GeneratingFunction[a[n],n,x]==Sum[a[n]x^n,{n,0,Infinity}]


However, for $a_n=1/(n+2)$ I obtain

{Sum[1/(n + 2) x^n, {n, 0, Infinity}], GeneratingFunction[1/(n + 2), n, x]} // FullSimplify
% /. x -> .2
(*{-((x + Log[1 - x])/x^2), PolyLog[2, x]/x}*)
(*{0.578589, 1.05502}*)


Thanks

Edit:

I'm using Mathematica 8.0.0.0 on a Linux x86 (32-bit)

• reference.wolfram.com/mathematica/ref/GeneratingFunction.html ; first sentence under 'Details and Options' Sep 3, 2013 at 15:37
• For me it gives identical results (0.578589) under v9.0.1. Which version do you use? GeneratingFunction[1/(n + 2), n, x] ==> (-1-(Log[1-x]/x))/x Sep 3, 2013 at 15:41
• @István what expression is produced by GeneratingFunction[1/(n + 2), n, x]? Sep 3, 2013 at 15:42
• @Mr.Wizard (-1 - Log[1 - x]/x)/x in v9. PolyLog[2, x]/x in v8. Sep 3, 2013 at 15:44
• @Eckhard If you suspect a bug and you are using anything else than the latest version (9.0.1 at this time), please indicate the version in the question. Sep 3, 2013 at 15:45

This appears to be a bug in version 8 that was fixed in version 9.

Sum[a[n] x^n, {n, 0, Infinity}] gives (-x - Log[1 - x])/x^2 in both.

In version 8.0.4,

GeneratingFunction[a[n], n, x] gives PolyLog[2, x]/x, which is incorrect.

In version 9.0.1,

GeneratingFunction[a[n], n, x] gives (-1 - Log[1 - x]/x)/x which is equivalent to the result from Sum.

• Is there a way to know in advance if the result of GeneratingFunction[] will be correct, or two work around the problem? Sep 3, 2013 at 16:04
• @Eckhard Well, a bug is a bug. It's not intentionally included. Symbolic results can typically be verified numerically, in the same way you did. You can calculate the function value for a particular x using NSum (the numerical version of Sum) and check that the results match. Numerical calculations can go awry too, but this happens less frequently than with symbolic ones. Generally, symbolic algebra software do have bugs, no matter which one you are using, and it is good practice to verify results. Sep 3, 2013 at 16:14