10
$\begingroup$

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)

$\endgroup$
8
  • $\begingroup$ reference.wolfram.com/mathematica/ref/GeneratingFunction.html ; first sentence under 'Details and Options' $\endgroup$
    – Eckhard
    Sep 3, 2013 at 15:37
  • $\begingroup$ 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 $\endgroup$ Sep 3, 2013 at 15:41
  • $\begingroup$ @István what expression is produced by GeneratingFunction[1/(n + 2), n, x]? $\endgroup$
    – Mr.Wizard
    Sep 3, 2013 at 15:42
  • $\begingroup$ @Mr.Wizard (-1 - Log[1 - x]/x)/x in v9. PolyLog[2, x]/x in v8. $\endgroup$
    – Szabolcs
    Sep 3, 2013 at 15:44
  • $\begingroup$ @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. $\endgroup$
    – Szabolcs
    Sep 3, 2013 at 15:45

1 Answer 1

8
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ Is there a way to know in advance if the result of GeneratingFunction[] will be correct, or two work around the problem? $\endgroup$
    – Eckhard
    Sep 3, 2013 at 16:04
  • 1
    $\begingroup$ @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. $\endgroup$
    – Szabolcs
    Sep 3, 2013 at 16:14

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.