Ask Your Question

How I can test this equality with sage?

asked 2016-10-30 19:26:31 +0200

Masacroso gravatar image

updated 2016-11-01 01:56:15 +0200

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)

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

but, as expected, it dont work.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2016-11-02 03:53:01 +0200

rtc gravatar image

updated 2016-11-02 04:16:31 +0200

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




With your expression you would have:

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:

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


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}$$

edit flag offensive delete link 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.

Masacroso gravatar imageMasacroso ( 2016-11-02 06:01:44 +0200 )edit

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

rtc gravatar imagertc ( 2016-11-02 06:23:59 +0200 )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?

Masacroso gravatar imageMasacroso ( 2016-11-02 09:29:23 +0200 )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.

rtc gravatar imagertc ( 2016-11-02 18:19:07 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-10-30 19:26:31 +0200

Seen: 2,864 times

Last updated: Nov 02 '16