Sum function evaluation problem



>>>>> "Chi" == Chi Ben <xbenchi at gmail.com> writes:

    Chi> Hi All,
    Chi> I was using this sum function:

    Chi>           sum((tan(1/(2*x))-tan(1/(2*x+1))),x,1,inf),simpsum=true;

    Chi> However, the evaluated result is the mathematical expression
    Chi> instead of a float value, even with simpsum=true.  How do I
    Chi> get a value?

Stavros has already explained why you don't get a float value.  But if
you still want one, you can do

sum(float(tan(1/(2*x))-tan(1/(2*x+1))),x,1,1000) -> .3435856189171599

But the terms look like 1/4/x^2 for large x, so the series doesn't
converge very fast, so 1000 terms may not be accurate enough for you.

However, you can let maxima help you evaluate this sum more
accurately.  First,

taylor(tan(1/(2*x))-tan(1/(2*x+1)),x,inf, 4) ->
1/(4*x^2)-1/(8*x^3)+1/(8*x^4)$

So the terms of the series are approximately that for large x.
Rewrite the series as

sum((tan(1/(2*x))-tan(1/(2*x+1))-(1/(4*x^2)-1/(8*x^3)+1/(8*x^4)),x,1,inf)
 + sum(1/(4*x^2),x,1,inf)-sum(1/(8*x^3),x,1,inf)+sum(1/(8*x^4),x,1,inf)

These latter sums can be evaluated by maxima:

simpsum:true;
sum(1/(4*x^2),x,1,inf)-sum(1/(8*x^3),x,1,inf)+sum(1/(8*x^4),x,1,inf);
-> -zeta(3)/8+%pi^4/720+%pi^2/24

Then

sum((tan(1/(2*x))-tan(1/(2*x+1))-(1/(4*x^2)-1/(8*x^3)+1/(8*x^4)),x,1,inf)

can be approximated by summing from 1 to 1000, since 1/1000^5 is about
1e-15.  Finally, the sum is

sum(float(tan(1/(2*x))-tan(1/(2*x+1))-(1/(4*x^2)-1/(8*x^3)+1/(8*x^4))),x,1,1000)
 + float(-zeta(3)/8+%pi^4/720+%pi^2/24)
-> 0.3438354315628996

I hope I got that all right.

Ray