[sage-support] Re: How to compute half-weight coefficients?

2009-01-30 Thread William Stein

On Fri, Jan 30, 2009 at 1:47 PM, Kim  wrote:
>
> Is there a way to compute coefficients of half-integral-weight modular
> forms in Sage?
>
> Specifically I want the coefficients of the weight 5/2 form on Gamma_0
> (4*13) that is in Shimura-Kohnen correspondence with the weight 4
> newform (of degree 1) on Gamma_0(13).
>
> The first few coefficients of the weight 4 form are: q - 5*q^2 - 7*q^3
> + 17*q^4 - 7*q^5 +...
>
> (I can get the right coefficients up to sign using the Jacobi form of
> weight 3 and index 13 but can't get the right signs of the
> coefficients this way...)

There is a command in sage called half_integral_weight_modform_basis
that you might find useful.  Type

sage: half_integral_weight_modform_basis?

for examples and help.

William

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Notebook Plotting

2009-01-30 Thread William Stein

On Fri, Jan 30, 2009 at 3:32 PM, bizoid  wrote:
>
> Sage Support:
>
> I am a new Sage user and I have a question regarding the plot function
> in Notebook.
>
> Below is a little snippet of code I wrote to plot the Bessel_J
> function for various nu on different intervals.  The snippet below is
> just an exercise in learning python and its plot function.
>
> I have one question:
>
> Question #1:
>
> In line 4 of the code below, I assign P = plot().  I do this
> because the P += plot() will not work unless P has been previously
> assigned.  How do I assign P an empty plot "object" so line 4 is
> unnecessary and line 5 works?
>
>  - - - - - Code - - - - - -
>
> 1  def plot_Bessel_J(nu, z):
> 2  for m in range(0,nu):
> 3  if m == 0:
> 4  P = plot(lambda y:bessel_J(m, y), (1, z))   #
> Question 1 is in regards to this line
> 5  P += plot(lambda y:bessel_J(m, y),(1, z))
> 6  P.show()
> 7
> 8  plot_Bessel_J(0,10)
>
> Thank you in advance for any help that you provide.

Do

P = Graphics()

William

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Notebook Plotting

2009-01-30 Thread bizoid

Sage Support:

I am a new Sage user and I have a question regarding the plot function
in Notebook.

Below is a little snippet of code I wrote to plot the Bessel_J
function for various nu on different intervals.  The snippet below is
just an exercise in learning python and its plot function.

I have one question:

Question #1:

In line 4 of the code below, I assign P = plot().  I do this
because the P += plot() will not work unless P has been previously
assigned.  How do I assign P an empty plot "object" so line 4 is
unnecessary and line 5 works?

 - - - - - Code - - - - - -

1  def plot_Bessel_J(nu, z):
2  for m in range(0,nu):
3  if m == 0:
4  P = plot(lambda y:bessel_J(m, y), (1, z))   #
Question 1 is in regards to this line
5  P += plot(lambda y:bessel_J(m, y),(1, z))
6  P.show()
7
8  plot_Bessel_J(0,10)

Thank you in advance for any help that you provide.

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] How to compute half-weight coefficients?

2009-01-30 Thread Kim

Is there a way to compute coefficients of half-integral-weight modular
forms in Sage?

Specifically I want the coefficients of the weight 5/2 form on Gamma_0
(4*13) that is in Shimura-Kohnen correspondence with the weight 4
newform (of degree 1) on Gamma_0(13).

The first few coefficients of the weight 4 form are: q - 5*q^2 - 7*q^3
+ 17*q^4 - 7*q^5 +...

(I can get the right coefficients up to sign using the Jacobi form of
weight 3 and index 13 but can't get the right signs of the
coefficients this way...)

Thanks,

Kim

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: problem with GraphDatabase

2009-01-30 Thread Jason Grout

davidp wrote:
> Hi,
> 
> Cutting and pasting commands from the Reference:
> 
> http://sagemath.org/doc/ref/node47.html
> 
> gives me:
> 
> ===
>>> sage
> --
> | Sage Version 3.2.2, Release Date: 2008-12-18   |
> | Type notebook() for the GUI, and license() for information.|
> --
> sage: graphs_query = GraphDatabase()
> sage: L = graphs_query.get_list(num_vertices=7, diameter=5)
> ---
> AttributeErrorTraceback (most recent call
> last)
> 
> /home/davidp/math/sandpile/sage/sage-sandpile1.2/ in
> ()
> 
> AttributeError: 'GraphDatabase' object has no attribute 'get_list'
> sage:
> ===
> I have also tried cutting and pasting code from the online
> documentation for GenericGraphQuery and similar functions, also
> getting errors.
> 
> I am running sage under Fedora.
> 
> Any suggestions would be much appreciated.  (I have a thesis student
> who would like to use these functions.)


I'm not sure about the errors above, but if you want to access the 
online version that the database is based on, it's available here:

http://good.math.iastate.edu/grout/graphs/

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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] problem with GraphDatabase

2009-01-30 Thread davidp

Hi,

Cutting and pasting commands from the Reference:

http://sagemath.org/doc/ref/node47.html

gives me:

===
>> sage
--
| Sage Version 3.2.2, Release Date: 2008-12-18   |
| Type notebook() for the GUI, and license() for information.|
--
sage: graphs_query = GraphDatabase()
sage: L = graphs_query.get_list(num_vertices=7, diameter=5)
---
AttributeErrorTraceback (most recent call
last)

/home/davidp/math/sandpile/sage/sage-sandpile1.2/ in
()

AttributeError: 'GraphDatabase' object has no attribute 'get_list'
sage:
===
I have also tried cutting and pasting code from the online
documentation for GenericGraphQuery and similar functions, also
getting errors.

I am running sage under Fedora.

Any suggestions would be much appreciated.  (I have a thesis student
who would like to use these functions.)

Thanks,
Dave

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Factorization

2009-01-30 Thread Paul Zimmermann

> I want to collect all divisors less than 2^30 of a large positive integer N
> using Elliptic Curve Factorization Method.  How this is possible using SAGE?

William pointed out the Cython interface to GMP-ECM. However this does not
completely answer your question, since it will only find *some* factors of
N, but does not guarantee to find *all* factors less than 2^30.

What you want is a deterministic ECM method, i.e., a set of ECM curves
(with Stage 1 and 2 bounds) which guarantees to find all divisors less than
2^30. This is a nice research problem, but to my best knowledge, no solution
is known so far.

Paul Zimmermann



--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: How can I make a topographic map with Sage?

2009-01-30 Thread Benjamin J. Racine

A fellow named Gael Varoquaux uses the topographic map of France as a common 
example for showing off mayavi (a 3D vtk-based viz tool) so this may be more of 
an Enthought Python Distribution question (vs. sage).  Mayavi may be found 
here: http://mayavi.sourceforge.net/ and perhaps elsewhere.  I would just write 
the mayavi list-serve... they are great... and you're likely to get this exact 
example from there.  I might be able to as well, if I remember when I'm on 
other machine.

HTH,
Ben R.

-Original Message-
From: sage-support@googlegroups.com [mailto:sage-supp...@googlegroups.com] On 
Behalf Of Sage
Sent: Thursday, January 29, 2009 5:33 PM
To: sage-support
Subject: [sage-support] How can I make a topographic map with Sage?


Is Sage suitable for topography? I have collected the data of a see, discreate 
data points. I need to make regressions on the data. Then, I think the contour 
plot creates the final topographic map. Or am I wrong? How are topographic maps 
dene in Sage? Can I give the data as an input and get the map back as an output?



--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Iterators in compiled code?

2009-01-30 Thread William Stein

On Fri, Jan 30, 2009 at 7:23 AM, Jason Grout
 wrote:
> Is there a reason you didn't use the less scary alternative below, other
> than avoiding one function call?
>
> v = iter(Permutations(range(n)))
>

I didn't use that because I woke up a few minutes ago and I'm still groggy. :-)

William

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Iterators in compiled code?

2009-01-30 Thread Jason Grout

William Stein wrote:
> On Fri, Jan 30, 2009 at 4:23 AM, Alasdair  wrote:
>> I was recently experimenting with iterators over permutations, and
>> using them to find if a graph was Hamiltonian.  This was done by brute
>> force - no clever tricks - simply by trying every possible permutation
>> of vertices and seeing if each was a cycle.
>>
>> Now there seem to be (at least) two ways of iteration over
>> permutations:
>>
>> v=Permutations(range(n))
>> vp=v.first()
>> ...more code here...
>> for i in range(factorial(n)):
>>   vp=v.next(vp)
>>
>> and
>>
>> v=(p for p in Permutations(range(n)))
>> ...more code here...
>> for i in range(factorial(n)):
>>   vp=v.next()
>>
>> Now the second is much much faster than the first.  On my rather
>> elderly laptop, with n=7, the second code takes less then 3 seconds,
>> and the first code takes nearly 82 seconds!
>>
>> But here's the thing: when I tried to compile my function (as a spyx
>> file), there was an error converting Pyrex to C when using the second
>> iteration; I was stuck with the slower first method (and importing
>> Permutations from sage.combinat.permutation).
>>
>> So how can I obtain a fast iteration over permutations in compiled
>> code?
> 
> Cython doesn't support closures, so you can use the second.  Yes,
> v=(p for p in Permutations(range(n))) is a closure.
> 
> Use this instead of either of your loops:
> 
> v=Permutations(range(n)).__iter__()
> ...
> for i in range(factorial(n)):
> vp = v.next()


Is there a reason you didn't use the less scary alternative below, other 
than avoiding one function call?

v = iter(Permutations(range(n)))

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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Iterators in compiled code?

2009-01-30 Thread William Stein

On Fri, Jan 30, 2009 at 7:19 AM, Jason Grout
 wrote:
>
> William Stein wrote:
>> On Fri, Jan 30, 2009 at 4:23 AM, Alasdair  wrote:
>>> I was recently experimenting with iterators over permutations, and
>>> using them to find if a graph was Hamiltonian.  This was done by brute
>>> force - no clever tricks - simply by trying every possible permutation
>>> of vertices and seeing if each was a cycle.
>>>
>>> Now there seem to be (at least) two ways of iteration over
>>> permutations:
>>>
>>> v=Permutations(range(n))
>>> vp=v.first()
>>> ...more code here...
>>> for i in range(factorial(n)):
>>>   vp=v.next(vp)
>>>
>>> and
>>>
>>> v=(p for p in Permutations(range(n)))
>>> ...more code here...
>>> for i in range(factorial(n)):
>>>   vp=v.next()
>>>
>>> Now the second is much much faster than the first.  On my rather
>>> elderly laptop, with n=7, the second code takes less then 3 seconds,
>>> and the first code takes nearly 82 seconds!
>>>
>>> But here's the thing: when I tried to compile my function (as a spyx
>>> file), there was an error converting Pyrex to C when using the second
>>> iteration; I was stuck with the slower first method (and importing
>>> Permutations from sage.combinat.permutation).
>>>
>>> So how can I obtain a fast iteration over permutations in compiled
>>> code?
>>
>> Cython doesn't support closures, so you can use the second.  Yes,
>> v=(p for p in Permutations(range(n))) is a closure.
>>
>
> I think he meant to say that you can *not* use the second.

Thanks for the clarification.  That's what I meant.  I should also add
that the first for loop is so slow because it uses

   vp=v.next(vp)

which probably requires iterating all the way up to vp every single
time, which is insanely slow.  I wonder why sage-combinat doesn't
cache say the last value iterated to, though?

William

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Iterators in compiled code?

2009-01-30 Thread Jason Grout

William Stein wrote:
> On Fri, Jan 30, 2009 at 4:23 AM, Alasdair  wrote:
>> I was recently experimenting with iterators over permutations, and
>> using them to find if a graph was Hamiltonian.  This was done by brute
>> force - no clever tricks - simply by trying every possible permutation
>> of vertices and seeing if each was a cycle.
>>
>> Now there seem to be (at least) two ways of iteration over
>> permutations:
>>
>> v=Permutations(range(n))
>> vp=v.first()
>> ...more code here...
>> for i in range(factorial(n)):
>>   vp=v.next(vp)
>>
>> and
>>
>> v=(p for p in Permutations(range(n)))
>> ...more code here...
>> for i in range(factorial(n)):
>>   vp=v.next()
>>
>> Now the second is much much faster than the first.  On my rather
>> elderly laptop, with n=7, the second code takes less then 3 seconds,
>> and the first code takes nearly 82 seconds!
>>
>> But here's the thing: when I tried to compile my function (as a spyx
>> file), there was an error converting Pyrex to C when using the second
>> iteration; I was stuck with the slower first method (and importing
>> Permutations from sage.combinat.permutation).
>>
>> So how can I obtain a fast iteration over permutations in compiled
>> code?
> 
> Cython doesn't support closures, so you can use the second.  Yes,
> v=(p for p in Permutations(range(n))) is a closure.
> 

I think he meant to say that you can *not* use the second.


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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: ILLEGAL INSTRUCTION sse4_pni

2009-01-30 Thread William Stein

On Fri, Jan 30, 2009 at 4:47 AM, littlemathteacher
 wrote:
>
> I am running Sage 3.2.3 on an old Pentium 4 M with Ubuntu Linux for
> some hours now and I am getting the well known ILLEGAL INSTRUCTION
> message:

Precisely which binary did you install?  Was it this one:

http://sagemath.org/bin/linux/32bit/sage-3.2.3-pentiumM-ubuntu32bit-i686-Linux.tar.gz

Any other binary should not work.

William


> ...
>  The following processor
> flags were on the build machine but are not on this computer:
>
> sse4_1 pni
>
> I am running Sage Notebook in my browser and as far I can see in these
> few hours it works quite well. Do I have to change anything anyhow?
> What is the problem?
>
> Thanks a lot.
> Yours,
> littlemathteacher
>
> >
>



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

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Iterators in compiled code?

2009-01-30 Thread William Stein

On Fri, Jan 30, 2009 at 4:23 AM, Alasdair  wrote:
>
> I was recently experimenting with iterators over permutations, and
> using them to find if a graph was Hamiltonian.  This was done by brute
> force - no clever tricks - simply by trying every possible permutation
> of vertices and seeing if each was a cycle.
>
> Now there seem to be (at least) two ways of iteration over
> permutations:
>
> v=Permutations(range(n))
> vp=v.first()
> ...more code here...
> for i in range(factorial(n)):
>   vp=v.next(vp)
>
> and
>
> v=(p for p in Permutations(range(n)))
> ...more code here...
> for i in range(factorial(n)):
>   vp=v.next()
>
> Now the second is much much faster than the first.  On my rather
> elderly laptop, with n=7, the second code takes less then 3 seconds,
> and the first code takes nearly 82 seconds!
>
> But here's the thing: when I tried to compile my function (as a spyx
> file), there was an error converting Pyrex to C when using the second
> iteration; I was stuck with the slower first method (and importing
> Permutations from sage.combinat.permutation).
>
> So how can I obtain a fast iteration over permutations in compiled
> code?

Cython doesn't support closures, so you can use the second.  Yes,
v=(p for p in Permutations(range(n))) is a closure.

Use this instead of either of your loops:

v=Permutations(range(n)).__iter__()
...
for i in range(factorial(n)):
vp = v.next()

It's the same as your second version, but doesn't use a closure
(=generator expression in this case).

William

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] ILLEGAL INSTRUCTION sse4_pni

2009-01-30 Thread littlemathteacher

I am running Sage 3.2.3 on an old Pentium 4 M with Ubuntu Linux for
some hours now and I am getting the well known ILLEGAL INSTRUCTION
message:
...
 The following processor
flags were on the build machine but are not on this computer:

sse4_1 pni

I am running Sage Notebook in my browser and as far I can see in these
few hours it works quite well. Do I have to change anything anyhow?
What is the problem?

Thanks a lot.
Yours,
littlemathteacher

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Jmol applets disappear

2009-01-30 Thread Håkan Granath

Hi,

Having several Jmol plots in a worksheet often leads to problem for
me. For example, the following procedure consistently gives failure:

1. Open a new worksheet.
2. Create two cells with content "sphere()" and evaluate them. Two
Jmol
   plots appear.
3. Save and quit the worksheet.
4. Load the worksheet. Both plots appear.
5. Evaluate one of the cells. The other plot will now disappear, only
   a grey area remains.

My Sage and browser versions are:

Sage Version 3.2.3, Release Date: 2009-01-05

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5) Gecko/2008121621
Ubuntu/8.04 (hardy) Firefox/3.0.5


Maybe this is a browser problem and not a Sage bug?

/Håkan Granath

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Iterators in compiled code?

2009-01-30 Thread Alasdair

I was recently experimenting with iterators over permutations, and
using them to find if a graph was Hamiltonian.  This was done by brute
force - no clever tricks - simply by trying every possible permutation
of vertices and seeing if each was a cycle.

Now there seem to be (at least) two ways of iteration over
permutations:

v=Permutations(range(n))
vp=v.first()
...more code here...
for i in range(factorial(n)):
   vp=v.next(vp)

and

v=(p for p in Permutations(range(n)))
...more code here...
for i in range(factorial(n)):
   vp=v.next()

Now the second is much much faster than the first.  On my rather
elderly laptop, with n=7, the second code takes less then 3 seconds,
and the first code takes nearly 82 seconds!

But here's the thing: when I tried to compile my function (as a spyx
file), there was an error converting Pyrex to C when using the second
iteration; I was stuck with the slower first method (and importing
Permutations from sage.combinat.permutation).

So how can I obtain a fast iteration over permutations in compiled
code?

Thanks,
Alasdair
--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: How can I make a topographic map with Sage?

2009-01-30 Thread Jason Grout

David Joyner wrote:
> I don't know if there is anything Sage specific. However, Sage contains
> matplotlib, which apparently can do such things. For example, I googled
> maps matplotlib and got this:
> http://www.scipy.org/Cookbook/Matplotlib/Maps


For the interested developer:

http://trac.sagemath.org/sage_trac/ticket/5128 contains the start of a 
nice way to integrate matplotlib output into the rest of Sage by 
trivially wrapping a matplotlib artist in a Sage Graphics() object. 
Finishing this ticket should be easy and would be a good introduction to 
Sage development, if someone wanted to take it up.

That said, it looks like we don't distribute the basemap extension to 
matplotlib by default.  It's big (100MB tarball); it contains lots of 
data by default.  It would be nice to have an optional spkg, though.

To the original poster: it would be very easy for you to install basemap 
into the Sage installation.  Let us know if basemap does what you want 
and if you want instructions for installing it into Sage.

Thanks,

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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---