MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: simplifying inside sum, Mathematica 5.1

  • To: mathgroup at
  • Subject: [mg53780] Re: [mg53749] Re: simplifying inside sum, Mathematica 5.1
  • From: Richard Fateman <fateman at>
  • Date: Thu, 27 Jan 2005 05:41:18 -0500 (EST)
  • Organization: University of California, Berkeley
  • References: <ct4h70$av2$> <ct56p1$eca$> <> <>
  • Sender: owner-wri-mathgroup at

DrBob wrote:

> Richard,
> If the sum doesn't simplify because Mathematica is missing an "arguably 
> correct" rule, that's unfortunate ("arguably"). But it doesn't reach the 
> level of "bug" until it simplifies to something WRONG, and I don't mean 
> "arguably" wrong.
> If a[1]=Infinity, (or the same for ANY i>0) it's hard to see why 
> Sum[a[i]x^i,{i,0,Infinity}]/.x->0 should resolve to a[0] -- since one of 
> the terms is Indeterminate.

Your same argument holds for the expression a[1]-a[1]. Mathematica should
not simplify that to 0 just in case a[1] is Indeterminate, or a[1]
is Interval[{-1,1}].  Nevertheless, Mathematica treats a[1]-a[1] by
simplifying it to zero.  So your point, that Mathematica is being
smart, and is being cautious about simplifications just doesn't
hold water.  Mathematica is not so cautious elsewhere.

> Allowing the possibility that unknown terms might be Infinity, 
> ComplexInfinity, or Indeterminate can be inconvenient, and it may not be 
> a good reason Sum shouldn't simplify in this case. It probably isn't the 
> reason Mathematica doesn't simplify it, in fact.

I agree here. You are back on track.

> Still, if it did simplify, and if one of the a[i] WERE one of those 
> values, the simplification would be wrong, and we'd rightly call it a 
> bug. As things are, your "arguably correct" expectation is simply a rule 
> Mathematica doesn't know, among infinitely many other rules no CAS 
> happens to know and apply.
You are off track again.

> Anyway, a simple way to get the result you're seeking is the statement:

Now in the material below, you veer way off track.  My initial question
is not "can you write a complicated program to produce a particular result?"
It is shorthand for "I think this result is wrong. Maybe Mathematica should
be able to produce the right result.  Am I somehow using Mathematica
the wrong way?  Is there something like  "PrincipalValue->True"  or "Assumptions->{i>=0}"
etc  that will make this work? Or is it a bug? If so, can it be fixed?"

Your "solutions" below are presumably intended to be silly.

> a[0]
> or, if you prefer,
> First[Sum[a[i]*x^i, {i, 0, Infinity}]] /. i -> 0
> A more complete method is:
> firstTerm[s_Sum] :=
>   Block[{i = s[[2,1]]}, If[s[[2,2]] > 0, 0, s[[1]] /. i -> 0]]
> firstTerm[Sum[a[i]*x^i, {i, 0, Infinity}]]
> a[0]
> firstTerm[Sum[a[i]*x^i, {i, 1, Infinity}]]
> 0
> This kind of control would be harder if Mathematica had already applied 
> a rule that, in a given situation, turned out to be wrong. Also note 
> that all three methods avoid the 0^0 quandary -- as of course we should, 
> in mathematics or Mathematica.

As for avoiding 0^0, you might read about it on the internet.  Making it 1
is often just the right thing to do.

> Still, I agree that we often want the simple answer, without working for 
> it.

Um, back on track??
> Bobby

As for Andrzej's comment, that this does the job...

     0^(i_) := KroneckerDelta[i, 0]; Sum[a[i]*x^i, {i, 0, Infinity}]/. x
-> 0]

Here are some comments:

1. There is no need for Infinity to be bound inside the Block.

2. It is neat that one can Unprotect and temporarily redefine Power
by a Block binding. I was not aware of this feature. I wonder if
it is new?

3. The simplification of the Sum form takes into account the
presence of KroneckerDelta, which is nice to know because
then it could also use a similar technique for 0^i within Sum.

4. Your solution gives the wrong answer for
Sum[a[i]*x^i, {i, -1, Infinity}]

It also doesn't work for
Sum[a[i]*x^(i^2), {i, -1, Infinity}]

This latter problem suggests an inadequacy in the treatment of the
simplification of   Sum[KroneckerDelta[...]....]


  • Prev by Date: Re: compile / optimize
  • Next by Date: Re: Re: simplifying inside sum, Mathematica 5.1
  • Previous by thread: Re: Re: simplifying inside sum, Mathematica 5.1
  • Next by thread: Re: Re: simplifying inside sum, Mathematica 5.1