Re: Bug in Sum?
- To: mathgroup at smc.vnet.net
- Subject: [mg109145] Re: Bug in Sum?
- From: Erik Max Francis <max at alcyone.com>
- Date: Mon, 19 Apr 2010 04:11:15 -0400 (EDT)
- References: <hq0mqo$k1b$1@smc.vnet.net>
gopher wrote: > In the following, A and Expand[A] give different answers after when > summed (a finite geometric series.) The result of summing A is clearly > wrong, since it is independent of the parameters r and s. > > Abhishek > > In[44]:= A = x^(i - n) (x^(i - n) (1 - r x^n) - s); > A == Expand[A] // Simplify > > Out[45]= True > > In[46]:= Sum[A, {i, 0, n - 1}] > > Out[46]= (x^(-2 n) (-1 + x^(2 n)))/(-1 + x^2) > > In[47]:= Sum[Expand[A], {i, 0, n - 1}] // FullSimplify > > Out[47]= -(( > x^(-2 n) (-1 + x^n) (-1 + x^n (-1 + r + s + s x + r x^n)))/(-1 + x^2) > ) They're both equal. FullSimplify on the first sum results in the same thing: In[17]:= Sum[A, {i, 0, n - 1}] // FullSimplify Out[17]= -(( x^(-2 n) (-1 + x^n) (-1 + x^n (-1 + r + s + s x + r x^n)))/(-1 + x^2) ) By default Mathematica doesn't do a FullSimplify, so you end up with different, but equal answers. If you do FullSimplify on both, then the answers are not only equal, but identical. -- Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/ San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Skype erikmaxfrancis There is no fate that cannot be surmounted by scorn. -- Albert Camus