Re: [sage-support] primes and integers

2011-07-24 Thread raman kurdi
Hi Dears First I must find all primes in the form p=8k+1 or p=8k+7 in range 1. Second I should find the all integers a and b such that p=a^2-2b^2 in range 1. Could you please help me for writing this program? On 7/24/11, raman kurdi raman.kurdi2...@gmail.com wrote: Dear Prof.Stein

[sage-support] primes and integers

2011-07-24 Thread raman
Hi Dears First I must find all primes in the form p=8k+1 or p=8k+7 in range 1. Second I should find the all integers a and b such that p=a^2-2b^2 in range 1. Could you please help me for writing this program? -- To post to this group, send email to sage-support@googlegroups.com To

[sage-support] Re: primes and integers

2011-07-24 Thread John Cremona
On Jul 24, 1:24 pm, raman raman.kurdi2...@gmail.com wrote: Hi Dears First I  must find all primes in the form p=8k+1 or p=8k+7 in range 1. [p for p in prime_range(10^4) if p%8 in [1,7]] Second I should find the all integers a and b such that p=a^2-2b^2 in range 1.

[sage-support] Re: primes and integers

2011-07-24 Thread Graham Enos
For the first question, since Sage has the prime_range() function: [p for p in prime_range(1) if mod(p, 8) in (1, 7)]. There are several ways of filtering a list in Python, but I tend to choose list comprehensions (http://en.wikipedia.org/wiki/ List_comprehension#Python) On Jul 24, 8:24 am,

Re: [sage-support] Re: primes and integers

2011-07-24 Thread William Stein
On Sun, Jul 24, 2011 at 10:46 AM, John Cremona john.crem...@gmail.comwrote: On Jul 24, 1:24 pm, raman raman.kurdi2...@gmail.com wrote: Hi Dears First I must find all primes in the form p=8k+1 or p=8k+7 in range 1. [p for p in prime_range(10^4) if p%8 in [1,7]] Second I should

[sage-support] Plots and Ticks

2011-07-24 Thread Dox
Hi people, I have a little doubt about ticks in plots. I'd like to know whether the following tasks are possible: - eliminate all ticks of a plot. - eliminate the dependent variable ticks. - changing the number by letter, either 1 by \eta and 2 by 2\eta or 1 by \eta and 1.2 by \xi.

[sage-support] how does one do this in Cython?

2011-07-24 Thread john_perry_usm
I want to declare c to be of the type defined by the class Rational. I'm sure this is easy, but what I want to do is this: from sage.rings.rational import Rational cdef Rational c but that doesn't work. Neither does cimport (which I found in a file somewhere, albeit commented out, and

Re: [sage-support] how does one do this in Cython?

2011-07-24 Thread William Stein
On Sun, Jul 24, 2011 at 5:47 PM, john_perry_usm john.pe...@usm.edu wrote: I want to declare c to be of the type defined by the class Rational. I'm sure this is easy, but what I want to do is this: from sage.rings.rational import Rational cdef Rational c but that doesn't work. Neither

[sage-support] Re: how does one do this in Cython?

2011-07-24 Thread john_perry_usm
What about not-the-notebook? :-) For example, I have the following file, called test_rational.pyx: from sage.rings.rational import Rational cpdef Rational add(a, b): return a + b When I try to attach it to sage, I get: [lots of output removed]

Re: [sage-support] how does one do this in Cython?

2011-07-24 Thread William Stein
On Sunday, July 24, 2011, john_perry_usm john.pe...@usm.edu wrote: What about not-the-notebook? :-) For example, I have the following file, called test_rational.pyx: from sage.rings.rational import Rational import --- cimport ?! cpdef Rational add(a, b): return a + b When I