ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 02 Nov 2016 12:19:07 -0500How I can test this equality with sage?http://ask.sagemath.org/question/35305/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.Sun, 30 Oct 2016 13:26:31 -0500http://ask.sagemath.org/question/35305/how-i-can-test-this-equality-with-sage/Answer by rtc for <p>How I can test this equality?</p>
<p>$$\sum_{n=0}^\infty\frac{(-1)^{n+1}}{3 n+6 (-1)^n}=\frac{\log(2)-1}{3}$$</p>
<p>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.</p>
<hr>
<p><strong>EDIT:</strong> I tried to use this code (what is a slight simplification of the above equality)</p>
<pre><code>var("n")
sum(1/(n*(-1)^n+2),n,0,oo) == -log(2)+1
</code></pre>
<p>but, as expected, it dont work.</p>
http://ask.sagemath.org/question/35305/how-i-can-test-this-equality-with-sage/?answer=35332#post-id-35332A 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}$$Tue, 01 Nov 2016 21:53:01 -0500http://ask.sagemath.org/question/35305/how-i-can-test-this-equality-with-sage/?answer=35332#post-id-35332Comment by rtc for <p>A way to do it is to check if the expression is true with bool() for example</p>
<pre><code>bool(2==2)
True
</code></pre>
<p>Or</p>
<pre><code>bool(2==4)
False
</code></pre>
<p>With your expression you would have:</p>
<pre><code>var('n')
bool(sum((-1)^(n+1)/(3*n+6*(-1)^n),n,0,oo) == (log(2)-1)/3)
</code></pre>
<p>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.</p>
<p>Another option is to do a numerical approximation of the infinite sum: </p>
<pre><code>var('n')
sum((-1)^(n + 1)/(3*n + 6*(-1)^n),n,0,100000).n()
−0.102292606438353
((log(2)-1)/3).n()
−0.102284273146685
</code></pre>
<p>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}$$</p>
http://ask.sagemath.org/question/35305/how-i-can-test-this-equality-with-sage/?comment=35353#post-id-35353That 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/35354/sage-seems-to-be-improperly-computing-an-infinite-sum-and-giving-an-incorrect-answer/Wed, 02 Nov 2016 12:19:07 -0500http://ask.sagemath.org/question/35305/how-i-can-test-this-equality-with-sage/?comment=35353#post-id-35353Comment by Masacroso for <p>A way to do it is to check if the expression is true with bool() for example</p>
<pre><code>bool(2==2)
True
</code></pre>
<p>Or</p>
<pre><code>bool(2==4)
False
</code></pre>
<p>With your expression you would have:</p>
<pre><code>var('n')
bool(sum((-1)^(n+1)/(3*n+6*(-1)^n),n,0,oo) == (log(2)-1)/3)
</code></pre>
<p>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.</p>
<p>Another option is to do a numerical approximation of the infinite sum: </p>
<pre><code>var('n')
sum((-1)^(n + 1)/(3*n + 6*(-1)^n),n,0,100000).n()
−0.102292606438353
((log(2)-1)/3).n()
−0.102284273146685
</code></pre>
<p>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}$$</p>
http://ask.sagemath.org/question/35305/how-i-can-test-this-equality-with-sage/?comment=35340#post-id-35340@rtc for this question if we define f(n) = (-1)^(n+1)/(3*n+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?Wed, 02 Nov 2016 03:29:23 -0500http://ask.sagemath.org/question/35305/how-i-can-test-this-equality-with-sage/?comment=35340#post-id-35340Comment by rtc for <p>A way to do it is to check if the expression is true with bool() for example</p>
<pre><code>bool(2==2)
True
</code></pre>
<p>Or</p>
<pre><code>bool(2==4)
False
</code></pre>
<p>With your expression you would have:</p>
<pre><code>var('n')
bool(sum((-1)^(n+1)/(3*n+6*(-1)^n),n,0,oo) == (log(2)-1)/3)
</code></pre>
<p>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.</p>
<p>Another option is to do a numerical approximation of the infinite sum: </p>
<pre><code>var('n')
sum((-1)^(n + 1)/(3*n + 6*(-1)^n),n,0,100000).n()
−0.102292606438353
((log(2)-1)/3).n()
−0.102284273146685
</code></pre>
<p>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}$$</p>
http://ask.sagemath.org/question/35305/how-i-can-test-this-equality-with-sage/?comment=35335#post-id-35335You can't get it directly, as far as I know. It seems to be a difficult sum for CAS to solve.Wed, 02 Nov 2016 00:23:59 -0500http://ask.sagemath.org/question/35305/how-i-can-test-this-equality-with-sage/?comment=35335#post-id-35335Comment by Masacroso for <p>A way to do it is to check if the expression is true with bool() for example</p>
<pre><code>bool(2==2)
True
</code></pre>
<p>Or</p>
<pre><code>bool(2==4)
False
</code></pre>
<p>With your expression you would have:</p>
<pre><code>var('n')
bool(sum((-1)^(n+1)/(3*n+6*(-1)^n),n,0,oo) == (log(2)-1)/3)
</code></pre>
<p>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.</p>
<p>Another option is to do a numerical approximation of the infinite sum: </p>
<pre><code>var('n')
sum((-1)^(n + 1)/(3*n + 6*(-1)^n),n,0,100000).n()
−0.102292606438353
((log(2)-1)/3).n()
−0.102284273146685
</code></pre>
<p>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}$$</p>
http://ask.sagemath.org/question/35305/how-i-can-test-this-equality-with-sage/?comment=35334#post-id-35334This 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.Wed, 02 Nov 2016 00:01:44 -0500http://ask.sagemath.org/question/35305/how-i-can-test-this-equality-with-sage/?comment=35334#post-id-35334