This is more a pedagogical issue. When I'm teaching a maths class with some
programming, I am always stressing that one of particular things to be
learned is some programming, and this is potentially very useful, perhaps
more useful than the particular maths concepts I cover. (Given that the
ma
William
On Oct 30, 5:26 pm, William Stein wrote:
> // is in Python 2.x for integer quotient.
Ouch. I misread a webpage, badly.
I guess this quote from the Python website answers the original
question: "Because of severe backwards compatibility issues, not to
mention a major flamewar on c.l.py,
On Sun, Oct 30, 2011 at 11:15 AM, john_perry_usm wrote:
> On Oct 29, 10:09 am, michel paul wrote:
>> Here's a relatively minor issue that might not be minor for someone new to
>> Sage.
>>
>> In illustrating very simple probability as len(outcomes)/len(sample_space),
>> integer division occurs, so
Could there be a function slen() that retuns a Sage integer (analogous
to srange())? Or you can simply define it in your own worksheet:
def slen(lst):
return Integer(len(lst))
On Sun, Oct 30, 2011 at 12:53 AM, Jason Grout
wrote:
> On 10/29/11 10:24 PM, kcrisman wrote:
>>
>>
>> On Oct 29, 10
On Oct 29, 10:09 am, michel paul wrote:
> Here's a relatively minor issue that might not be minor for someone new to
> Sage.
>
> In illustrating very simple probability as len(outcomes)/len(sample_space),
> integer division occurs, so the probability becomes 0.
The origin of this behavior is that
On 10/29/11 10:24 PM, kcrisman wrote:
On Oct 29, 10:40 pm, Jason Grout wrote:
On 10/29/11 10:35 AM, David Joyner wrote:
I would suggest that this "feature" in Python, was "fixed" in Python 3.0.
Sage has not yet upgraded to 3.0.
Luckily, Python includes a time machine to import things from
On Oct 29, 10:40 pm, Jason Grout wrote:
> On 10/29/11 10:35 AM, David Joyner wrote:
>
> > I would suggest that this "feature" in Python, was "fixed" in Python 3.0.
> > Sage has not yet upgraded to 3.0.
>
> Luckily, Python includes a time machine to import things from the future ;)
>
> sage: from
> > Sure - typical simple intro - throwing two dice:
>
> > S = [(die1, die2) for die1 in [1..6] for die2 in [1..6]]
> > E = [throw for throw in S if sum(throw) == 7]
>
> > len(E)/len(S) will produce 0. We can very easily use 1.0*len(E)/len(S), or
> > we can use Integer(len(E))/len(S). I prefer t