MathGroup Archive 2005

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

Search the Archive

Re: Re: simplifying inside sum, Mathematica 5.1

  • To: mathgroup at smc.vnet.net
  • Subject: [mg53784] Re: [mg53749] Re: simplifying inside sum, Mathematica 5.1
  • From: DrBob <drbob at bigfoot.com>
  • Date: Thu, 27 Jan 2005 05:41:23 -0500 (EST)
  • References: <ct4h70$av2$1@smc.vnet.net> <ct56p1$eca$1@smc.vnet.net> <200501260936.EAA00194@smc.vnet.net> <opsk7uawdtiz9bcq@monster.ma.dl.cox.net> <41F7DE08.7090001@cs.berkeley.edu>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

Agreed, Mathematica often ignores odd possibilities in simplifying expressions; that doesn't mean it always should. Infinite sums are subject to convergence questions even when all the a[i] are finite, after all.

>> 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.

But leaving the Sum unevaluated ISN'T wrong. At worst it's unhelpful and, in case any of the a[i] are undefined, it's more correct than your simplification. Anyway, picking off the 0th term isn't difficult, if that's what you want to achieve. My silly solutions manage it quite easily, and it's also easy to temporarily remove Sum's HoldAll attribute.

>> As for avoiding 0^0, you might read about it on the internet.

Having studied mathematics and written code for 35 years, I'm not likely to change my mind just because somebody wrote the opposing view on a website somewhere. (Neither will anyone else, I think, on either side.)

>> Making it 1 is often just the right thing to do.

Extending the reach of the binomial theorem is tempting, but I'm not sure 0^0 should evaluate to 1 unless it would always be correct, rather than often. We're not applying the binomial theorem in every line of code we write, after all.

Still, I'll grant a case could be made that (in Mathematica) (0.)^(0.) must be undefined but 0^0 need not be, since an exact 0 won't arise in a sequence of nonzero reals.

It would take a lot of analysis to ensure this didn't break existing code, however, and I'll gladly leave that task to Wolfram. It also begs the question what to do with (0.)^0 and 0^(0.). Things could get more confusing, not less.

Bobby

On Wed, 26 Jan 2005 10:14:32 -0800, Richard Fateman <fateman at cs.berkeley.edu> wrote:

> 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.
> See
> http://db.uwaterloo.ca/~alopez-o/math-faq/mathtext/node14.html
>
>>
>> Still, I agree that we often want the simple answer, without working for
>> it.
>
> Um, back on track??
>>
>> Bobby
>> .....<snip>
>
> As for Andrzej's comment, that this does the job...
>
>
> Block[{Power,Infinity},
>      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[...]....]
>
> RJF
>
>
>
>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: Re: simplifying inside sum, Mathematica 5.1
  • 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