---------- Forwarded message ----------
From: Peter Doyle (a Professor at Dartmouth)
Date: Sep 18, 2007 10:32 AM
Subject: Re: Calculus
To: William Stein <[EMAIL PROTECTED]>

Hi William,

>  There was a long thread on sage-devel about this:
>
>
http://groups.google.com/group/sage-devel/browse_thread/thread/674e88887d0da278
>

Thanks for pointing out this thread.  Regarding range(), I was struck
by how the discussion turned to the question of basing ranges at 0
rather than 1.  Having the default lower bound 0 actually doesn't
bother me at all.  The real problem as I see it is that in range(1,10)
the upper bound isn't included.  This can be justified in the case of
range(10) by viewing 10 as telling not the upper bound, but the length
of the list.  But in range(1,10), 10 tells neither the length of the
list nor the upper bound.  Or rather, it's the upper bound for a
half-open interval of integers,  which is not the kind of convention
that is going to be natural for mathematicians or calculus students.
Mathematicians *could* have defined $\sum_{i=1}^{10}$ not to include
the upper limit in the sum.  Only that's just not how we do it.

Anyway, what I like about your proposal to introduce the notation
1..10 is that it sidesteps the question of what range() ought to do.
Like it or not, range() does what it does.  Meanwhile, [1..10] does
what you expect it to do.  I can't believe anyone would argue that
[1..10] ought to omit 10.   I am sure there are people who never mess
up and expect range() to include the upper bound.  And with practice,
most people will learn that when a loop isn't working, they should
check the upper bound to make sure they didn't screw up because
range() doesn't work as they naturally expect.  But the beauty of a
notation like 1..10 is that it does what you expect.

This is not to say that I think you necessarily have to make this
addition to the preparser.  I think using Python was an inspired
decision, and is responsible for the fact that SAGE is so great.   I
can see why you would not want to deviate from it without a compelling
reason.  Not yet, anyway:  Maybe after all the hackers have moved on
to Ruby (and then Topaz, and then Tourmaline...), leaving Python
(i.e., SAGE) to the mathematicians.

Cheers,

Peter


-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to