rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

bug in simplify_sum #1894

Open rtoy opened 1 month ago

rtoy commented 1 month ago

Imported from SourceForge on 2024-07-05 10:24:44 Created by rouxph on 2020-04-28 12:22:39 Original: https://sourceforge.net/p/maxima/bugs/3630


the function simplify_sum fails to compute the serie :

sum((k*sin((k*%pi)/3))/(4*k^2-1),k,1,inf)

I know the serie converge to

(sqrt(3)*%pi)/16=0.3400873807939158...

but simplify_sum find a closed form which is wrong (from its floating point approximation)

'(5*3^(3/2)*sqrt(%pi)*%i*erf(%i)-10*sqrt(3)*%e)/48=2.564242426927912...

The bug could comes from the Zeilberger/Gosper algorithm or a lack of knowledge on some special functions. Note that the website wolframalpha find a complex closed form but with the correct floating point value :

sum_(k=1)^∞ (k sin((π k)/3))/(4 k^2 - 1) = 1/6 ((-1)^(1/6) 2F1(1/2, 2, 5/2, -(-1)^(2/3)) - (-1)^(5/6) 2F1(1/2, 2, 5/2, (-1)^(1/3)))≈0.340087

see maxima mailing list for further discussions.

rtoy commented 1 month ago

Imported from SourceForge on 2024-07-05 10:24:45 Created by rouxph on 2023-05-14 12:18:16 Original: https://sourceforge.net/p/maxima/bugs/3630/#5ae5


here is another example where maxima (and sagemath) fails to simplify a summation . Wolframalpha.com also fails to find the pi/16 value but gives different closed forms and a numerical value compatible with pi/16. Here is a minimal example showing the problem :

'S=S:sum(sin(n*%pi/3)^3*cos(n*%pi/3)/n,n,1,inf);
'S=S:ratsimp(simplify_sum(S2)); /* false!*/
S_exact:%pi/16;
S_num:float(sum(sin(n*%pi/3)^3*cos(n*%pi/3)/n,n,1,10000));
S_exact=float(S_exact);

you can check that the value given by simplify_sum is far from the numerical value, and this one is compatible with pi/16 (which has been obtained by Dirichlet Theorem for the Fourier series of some piecewise constant function):

S= 3/8*sqrt(3)*e + 3/8*sqrt(3) = 2.4150948914066888
S_exact= 1/16*pi = 0.19634954084936207
S_num= 0.1965659389111564