Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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)

share|improve this question
    
reference.wolfram.com/mathematica/ref/GeneratingFunction.html ; first sentence under 'Details and Options' –  Eckhard Sep 3 '13 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 –  István Zachar Sep 3 '13 at 15:41
    
@István what expression is produced by GeneratingFunction[1/(n + 2), n, x]? –  Mr.Wizard Sep 3 '13 at 15:42
    
@Mr.Wizard (-1 - Log[1 - x]/x)/x in v9. PolyLog[2, x]/x in v8. –  Szabolcs Sep 3 '13 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. –  Szabolcs Sep 3 '13 at 15:45
show 3 more comments

1 Answer

up vote 6 down vote accepted

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.

share|improve this answer
    
Is there a way to know in advance if the result of GeneratingFunction[] will be correct, or two work around the problem? –  Eckhard Sep 3 '13 at 16:04
1  
@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. –  Szabolcs Sep 3 '13 at 16:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.