[sage-support] Re: Arithmetic Progession syntax

2011-04-01 Thread achrzesz
sage: import scipy as sc
sage: map(floor,sc.arange(0.0,1.2,0.1))
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1]

On 1 Kwi, 21:17, ObsessiveMathsFreak 
wrote:
> Thanks for that, but I've run into another issue. I don't know whether
> this is related to the sequence syntax or not
>
> sage: for n in [0.0,0.1,..,1.1]:
> sage:     print n, floor(n)
> 0.000 0
> 0.100 0
> 0.200 0
> 0.300 0
> 0.400 0
> 0.500 0
> 0.600 0
> 0.700 0
> 0.800 0
> 0.900 0
> 1.00 0    <- What's going on here?
> 1.10 1
>
> I realise that the numbers are floating point and so on, but something
> appears to have gone awry here in a big way
>
> On Apr 1, 7:13 pm, Mike Hansen  wrote:
>
> > On Fri, Apr 1, 2011 at 8:08 PM, ObsessiveMathsFreak
>
> >  wrote:
> > >> sage: [0,0.2,..,1]
> > >> [0.000, 0.200, 0.400,
> > >> 0.600, 0.800, 1.00]
>
> > > May sage installation appears to be having trouble with this syntax
>
> > > OK Here
> > > sage: [0.0,0.2,..,0.9]
> > > [0.000, 0.200, 0.400,
> > > 0.600, 0.800]
>
> > > But what's going on here?
> > > sage: [0.1,0.2,..,0.9]
> > > [0.100, 0.200, 0.300,
> > > 0.400, 0.500, 0.600,
> > > 0.700, 0.800, 0.900]
>
> > The second number (0.2) is not the amount to be incremented each time,
> > it's the next number in the sequence.  Since, 0.2 differs from 0.1 by
> > 0.1, each additional number in the sequence will be incremented by
> > 0.1.
>
> > > Something's gone dreadfully wrong.
> > > sage: [0.2,0.2,..,0.9]
> > > OverflowError: cannot convert float infinity to integer
>
> > There's no difference between 0.2 and 0.2, so it will never make it to 0.9.
>
> > > Now I'm just confused.
> > > sage: [0.2,0.1,..,0.9]
> > > []
>
> > Going down from 0.2 to 0.1 and so on, you'll never reach 0.9.
>
> > --Mike
>
>

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] ring from operation tables

2011-04-01 Thread dstahlke
Given tables defining the addition and multiplication operations for a
finite ring, is there a way to construct such a Ring() in Sage?

For example:

add_tab = Matrix([
[0, 1, 2, 3],
[1, 0, 3, 2],
[2, 3, 0, 1],
[3, 2, 1, 0],
])

mul_tab = Matrix([
[0, 0, 0, 0],
[0, 0, 0, 0],
[0, 0, 1, 1],
[0, 0, 1, 1],
])

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Saving/Showing large animation consumes vast resources

2011-04-01 Thread ObsessiveMathsFreak
I was having a problem with sage when trying to animate large images
with many frames. Essentially, when the image was either being shown
or saved to a gif file, the Imagemagick convert process would consumes
gigabytes of memory, go out to swap, and the whole system would grind
to a halt.

I managed to solve this problem, as Imagemagick has done this to me
before. The fix involves changing the command in the animate.py file
where imagemagick is called.

The convert command line needs to be changed from

cmd = 'cd "%s"; sage-native-execute convert -delay %s -loop %s *.png
"%s"'%(d, int(delay), int(iterations), savefile)

to something like the following

cmd = 'cd "%s"; sage-native-execute convert -limit memory 64mb -limit
map 64mb -limit area 64mb -limit disk 128mb -delay %s -loop %s *.png
"%s"'%(d, int(delay), int(iterations), savefile)

Note the inclusion of resource usage limit commands. The numbers here
I have essentially plucked from mid air. They work for me, but
obviously need more looking into.

I hope this is of use to anyone who may be having the same problem
with showing and saving large animations.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Arithmetic Progession syntax

2011-04-01 Thread Jason Grout

On 4/1/11 2:17 PM, ObsessiveMathsFreak wrote:

Thanks for that, but I've run into another issue. I don't know whether
this is related to the sequence syntax or not

sage: for n in [0.0,0.1,..,1.1]:
sage: print n, floor(n)
0.000 0
0.100 0
0.200 0
0.300 0
0.400 0
0.500 0
0.600 0
0.700 0
0.800 0
0.900 0
1.00 0<- What's going on here?
1.10 1

I realise that the numbers are floating point and so on, but something
appears to have gone awry here in a big way



You've answered your own question here:

sage: a=[0.0,0.1,..,1.1]
sage: a[-2]
1.00
sage: a[-2]==1
False
sage: a[-2]-1
-1.11022302462516e-16
sage: a[-2]<1
True
sage: b=a[-2]
sage: b.str(truncate=False) # don't round
'0.99989'

If you want exact values and don't want to deal with messy floating 
point issues, then you can use exact values:


sage: a=[0,1/10,..,11/10]
sage: a
[0, 1/10, 1/5, 3/10, 2/5, 1/2, 3/5, 7/10, 4/5, 9/10, 1, 11/10]
sage: a[-2]==1
True

Jason

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Arithmetic Progession syntax

2011-04-01 Thread ObsessiveMathsFreak
Thanks for that, but I've run into another issue. I don't know whether
this is related to the sequence syntax or not

sage: for n in [0.0,0.1,..,1.1]:
sage: print n, floor(n)
0.000 0
0.100 0
0.200 0
0.300 0
0.400 0
0.500 0
0.600 0
0.700 0
0.800 0
0.900 0
1.00 0<- What's going on here?
1.10 1

I realise that the numbers are floating point and so on, but something
appears to have gone awry here in a big way

On Apr 1, 7:13 pm, Mike Hansen  wrote:
> On Fri, Apr 1, 2011 at 8:08 PM, ObsessiveMathsFreak
>
>
>
>  wrote:
> >> sage: [0,0.2,..,1]
> >> [0.000, 0.200, 0.400,
> >> 0.600, 0.800, 1.00]
>
> > May sage installation appears to be having trouble with this syntax
>
> > OK Here
> > sage: [0.0,0.2,..,0.9]
> > [0.000, 0.200, 0.400,
> > 0.600, 0.800]
>
> > But what's going on here?
> > sage: [0.1,0.2,..,0.9]
> > [0.100, 0.200, 0.300,
> > 0.400, 0.500, 0.600,
> > 0.700, 0.800, 0.900]
>
> The second number (0.2) is not the amount to be incremented each time,
> it's the next number in the sequence.  Since, 0.2 differs from 0.1 by
> 0.1, each additional number in the sequence will be incremented by
> 0.1.
>
> > Something's gone dreadfully wrong.
> > sage: [0.2,0.2,..,0.9]
> > OverflowError: cannot convert float infinity to integer
>
> There's no difference between 0.2 and 0.2, so it will never make it to 0.9.
>
> > Now I'm just confused.
> > sage: [0.2,0.1,..,0.9]
> > []
>
> Going down from 0.2 to 0.1 and so on, you'll never reach 0.9.
>
> --Mike

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Arithmetic Progession syntax

2011-04-01 Thread Mike Hansen
On Fri, Apr 1, 2011 at 8:08 PM, ObsessiveMathsFreak
 wrote:
>> sage: [0,0.2,..,1]
>> [0.000, 0.200, 0.400,
>> 0.600, 0.800, 1.00]
>
> May sage installation appears to be having trouble with this syntax
>
> OK Here
> sage: [0.0,0.2,..,0.9]
> [0.000, 0.200, 0.400,
> 0.600, 0.800]
>
>
> But what's going on here?
> sage: [0.1,0.2,..,0.9]
> [0.100, 0.200, 0.300,
> 0.400, 0.500, 0.600,
> 0.700, 0.800, 0.900]

The second number (0.2) is not the amount to be incremented each time,
it's the next number in the sequence.  Since, 0.2 differs from 0.1 by
0.1, each additional number in the sequence will be incremented by
0.1.

> Something's gone dreadfully wrong.
> sage: [0.2,0.2,..,0.9]
> OverflowError: cannot convert float infinity to integer

There's no difference between 0.2 and 0.2, so it will never make it to 0.9.

> Now I'm just confused.
> sage: [0.2,0.1,..,0.9]
> []

Going down from 0.2 to 0.1 and so on, you'll never reach 0.9.

--Mike

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Arithmetic Progession syntax

2011-04-01 Thread ObsessiveMathsFreak
> sage: [0,0.2,..,1]
> [0.000, 0.200, 0.400,
> 0.600, 0.800, 1.00]

May sage installation appears to be having trouble with this syntax

OK Here
sage: [0.0,0.2,..,0.9]
[0.000, 0.200, 0.400,
0.600, 0.800]


But what's going on here?
sage: [0.1,0.2,..,0.9]
[0.100, 0.200, 0.300,
0.400, 0.500, 0.600,
0.700, 0.800, 0.900]


Something's gone dreadfully wrong.
sage: [0.2,0.2,..,0.9]
OverflowError: cannot convert float infinity to integer


Now I'm just confused.
sage: [0.2,0.1,..,0.9]
[]

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] sagenb.org

2011-04-01 Thread VictorMiller
Is sagenb.org having problems?  I tried to log on yesterday (and
today, just now), and it said that my username was unknown!

Victor

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] commenting out

2011-04-01 Thread Håkan Granath
> In Python one can comment out a whole block of text with Alt+3, how
> can I do that in Sage ?

See this page:

http://www.sagemath.org/doc/reference/sagenb/notebook/config.html

/Håkan

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] commenting out

2011-04-01 Thread clodemil
Hi all,

In Python one can comment out a whole block of text with Alt+3, how
can I do that in Sage ?

TIA.

Claude

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: date call

2011-04-01 Thread clodemil
Thank you all, very useful.

Claude
On Mar 31, 4:08 pm, Dan Drake  wrote:
> On Thu, 31 Mar 2011 at 05:36AM -0700, clodemil wrote:
> > Is it possible to call up the calendar date and time, to be used in,
> > for instance, m=list(measurement,date) ?
>
> Python (and hence Sage) has a number of modules related to times and
> dates. Seehttp://docs.python.org/library/and search for "time" or
> "date".
>
> Dan
>
> --
> ---  Dan Drake
> -  http://mathsci.kaist.ac.kr/~drake
> ---
>
>  signature.asc
> < 1KViewDownload

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org