Re: Bug in Sum?

• To: mathgroup at smc.vnet.net
• Subject: [mg109122] Re: Bug in Sum?
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Mon, 19 Apr 2010 04:07:04 -0400 (EDT)

```Works fine on my system

\$Version

7.0 for Mac OS X x86 (64-bit) (February 19, 2009)

A = x^(i - n) (x^(i - n) (1 - r x^n) - s);

A == Expand[A] // Simplify

True

Sum[A, {i, 0, n - 1}]

-(((x^n - 1)*(r*x^(2*n) + r*x^n + s*x^(n + 1) +
s*x^n - x^n - 1))/(x^(2*n)*(x^2 - 1)))

Sum[Expand[A], {i, 0, n - 1}] // FullSimplify

-(((x^n - 1)*(x^n*(r*x^n + r + s*x + s - 1) - 1))/
(x^(2*n)*(x^2 - 1)))

% == %% // Simplify

True

Bob Hanlon

---- gopher <gophergoon at gmail.com> 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)
)

```

• Prev by Date: Re: Bug in Sum?
• Next by Date: Re: ListPlot with two horizontal axes
• Previous by thread: Re: Bug in Sum?
• Next by thread: Re: Bug in Sum?