How I can test this equality with sage?

How I can test this equality?

$$\sum_{n=0}^\infty\frac{(-1)^{n+1}}{3 n+6 (-1)^n}=\frac{\log(2)-1}{3}$$

Im interested in symbolic tests and numerical tests. My knowledge about the way to do this with sage (in general in any CAS, not only sage) is near to zero. Any help, link, etc. will be appreciated, thank you.

EDIT: I tried to use this code (what is a slight simplification of the above equality)

var("n")
sum(1/(n*(-1)^n+2),n,0,oo) == -log(2)+1


but, as expected, it dont work.

edit retag close merge delete

Sort by » oldest newest most voted

A way to do it is to check if the expression is true with bool() for example

bool(2==2)
True


Or

bool(2==4)
False


With your expression you would have:

var('n')
bool(sum((-1)^(n+1)/(3*n+6*(-1)^n),n,0,oo) == (log(2)-1)/3)


This returns false because sage doesn't seem to be able to prove their equality. So either they aren't equal or sage can't simplify it enough to prove it. So you might have to do some manipulation by hand until you can get it to a simpler state that sage can then work with.

Another option is to do a numerical approximation of the infinite sum:

var('n')
sum((-1)^(n + 1)/(3*n + 6*(-1)^n),n,0,100000).n()
−0.102292606438353

((log(2)-1)/3).n()
−0.102284273146685


This code approximates the sum with the first 100,000 terms. We can see that the numerical approximation of this function does seem to approach $$\frac{log(2)-1}{3}$$

more

This series is difficult to test. The equality is true but it fail in many CAS not only sage: mathematica, maple, sympy, etc... In mathematica, and probably all the other CAS, it is possible to see the value of the series after some manipulations. But I wanted to know if it would be possible in sage in a direct way.

( 2016-11-02 00:01:44 -0500 )edit

You can't get it directly, as far as I know. It seems to be a difficult sum for CAS to solve.

( 2016-11-02 00:23:59 -0500 )edit

@rtc for this question if we define f(n) = (-1)^(n+1)/(3n+6(-1)^n) and after we do sum(f(2n)+f(2n+1),n,0,oo) the answer is close to the truth but is not correct. But the same code (with light change due to be different languages) works in mathematica and maple perfectly, obtaining the correct answer. Why sage is not doing well here?

( 2016-11-02 03:29:23 -0500 )edit

That is a very good question. I am going to ask another question to see if someone knows. It seems that sage is improperly computing this sum. https://ask.sagemath.org/question/353...

( 2016-11-02 12:19:07 -0500 )edit