MathGroup Archive 2009

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

Search the Archive

Re: Re: Re: error with Sum and Infinity

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102383] Re: [mg102340] Re: [mg102318] Re: error with Sum and Infinity
  • From: George Woodrow III <georgevw3 at mac.com>
  • Date: Fri, 7 Aug 2009 05:31:47 -0400 (EDT)
  • References: <200908050944.FAA18234@smc.vnet.net>

You can get the performance you want by using Piecewise[]. That way, 
there is only one function definition.

t[x_] := Piecewise[{{0, x < 3}, {1, x == 3}, {0, x > 3}}]

In[2]:= Sum[t[i], {i, 1000000}]
Out[2]= 1

In[3]:= Sum[t[i], {i, 1000001}]
Out[3]= 1

In[4]:= Sum[t[i], {i, 1, =E2=88=9E}]
Out[4]= 1

(The last one sums to infinity -- the infinity sign may get corrupted 
in transit.)

The way that you define the function, the first form is used for 
'symbolic' sums, and the one exceptional point is ignored.

Using piecewise, there is only one definition.

Using Mathematica 7.0.1, OS X 10.5.8


george



On Aug 6, 2009, at 6:30 AM, Elton Kurt TeKolste wrote:

> Having skimmmed the responses I find the distinction between the 
> actual
> numerical sum and the ability of Mathematica to manipulate a symbolic
> expression to be appropriate.
>
> Apparently Mathematica has a well-defined transition point from rote
> calculation to symbolic manipulation:
>
> In[144]:= t[i_] := 0;
> t[3] = 1; {Sum[t[i], {i, 1000000}], Sum[t[i], {i, 1000001}]}
>
> Out[144]= {1, 0}
>
> On Wed, 05 Aug 2009 05:44 -0400, "Bill Rowe" <readnews at sbcglobal.net>
> wrote:
>> On 8/4/09 at 4:30 AM, fateman at cs.berkeley.edu (Richard Fateman)
>> wrote:
>>
>>> The underlying point is that Mathematica is conflating two concepts
>>> with the name Sum:
>>
>>> A.  A loop of finitely many terms evaluated in sequence and adding
>>> up the terms.   and
>>
>>> B.  A symbolic calculation based on various combinatorial ideas, the
>>> calculus of finite differences, and other systematic simplifications
>>> that reduces a summation, either finite or infinite, into a result
>>> that does not have any summation notation in it.  Like summing
>>> arithmetic progressions, geometric progressions, etc (and very
>>> advanced etc.).
>>
>>> For this second concept to work, the summand must be something that
>>> can be suitably manipulated, typically starting as a single
>>> algebraic expression. A programming segment, or a pattern match that
>>> requires that each value of the index be fed into an evaluator will
>>> not, generally work with algorithms for indefinite or
>>> definite/infinite summation. Obviously you cannot feed an infinite
>>> number of index values into a function and sum up all the terms.
>>
>>> A clean solution would be to separate these two concepts:  a loop
>>> and a symbolic closed-form simplifier for a summation. Or for
>>> Mathematica to use the Sum form, but somehow allow you to indicate
>>> to the system that you want it evaluated as a loop or simplified to
>>> a closed form.
>>
>> Your suggestion truly will not solve anything.
>>
>> Suppose Mathematica had functions SumA and SumB per your
>> description above. Now instead of a new user asking why Sum
>> doesn't return 1 when infinitely many terms exist, you will get
>> questions as to why SumB cannot deal with a finite number of
>> terms or the same question when SumA fails to work as the user
>> is expecting.
>>
>> It does not help clarify things to add a new function with a
>> different name for new users. In fact, it is more likely to
>> cause confusion since you would now have two things with similar
>> names that don't behave the same. And if the two names were not
>> similar, you almost certainly ensure a new user will not find
>> the one with the less intuitive name.
>>
>> And for the more experienced/knowledgeable user there is no
>> advantage to what you propose over the way things are now.
>>
>>
> Regards,
> Kurt Tekolste
>
>



  • Prev by Date: Re: Re: Simple Slideshow templates?
  • Next by Date: Re: Simple Slideshow templates?
  • Previous by thread: Re: Re: error with Sum and Infinity
  • Next by thread: Re: error with Sum and Infinity