On Sun, Feb 7, 2016 at 9:16 AM, Travis Scrimshaw wrote:
>
>
> On Sunday, February 7, 2016 at 7:54:03 AM UTC-6, Jeroen Demeyer wrote:
>>
>> On 2016-02-07 14:50, Travis Scrimshaw wrote:
>> > So then what do you think about the current behavior, where if there
>> > is no (implemented) is_prime(), we
On Sunday, February 7, 2016 at 7:54:03 AM UTC-6, Jeroen Demeyer wrote:
>
> On 2016-02-07 14:50, Travis Scrimshaw wrote:
> > So then what do you think about the current behavior, where if there
> > is no (implemented) is_prime(), we then try to convert to ZZ?
>
> We don't *try* to convert, we j
On 2016-02-07 14:50, Travis Scrimshaw wrote:
So then what do you think about the current behavior, where if there
is no (implemented) is_prime(), we then try to convert to ZZ?
We don't *try* to convert, we just convert. No problem with that.
--
You received this message because you are subscri
On Saturday, February 6, 2016 at 3:29:49 AM UTC-6, Jeroen Demeyer wrote:
>
> On 2016-02-06 00:07, Travis Scrimshaw wrote:
> > try to coerce it to the base ring
> -1
>
> These kind of conditionals only make things worse. Either you convert to
> the base ring or you don't convert to the base ri
On 2016-02-06 00:07, Travis Scrimshaw wrote:
try to coerce it to the base ring
-1
These kind of conditionals only make things worse. Either you convert to
the base ring or you don't convert to the base ring. But *trying* to
convert is the most confusing thing you can do.
Jeroen.
--
You rec
On Friday, February 5, 2016 at 3:29:29 PM UTC-6, Jeroen Demeyer wrote:
>
> On 2016-02-05 19:59, William Stein wrote:
> > Maybe is_prime for field elements should just raise an exception?
>
> This reminds me very much about the recent discussion we had about floor
> division... and which didn't
On 2016-02-05 19:59, William Stein wrote:
Maybe is_prime for field elements should just raise an exception?
This reminds me very much about the recent discussion we had about floor
division... and which didn't really come to a conclusion.
It's really the same problem: you have something whic
On 2016-02-05 20:45, Vincent Delecroix wrote:
About the code, the current version is
{{{
def is_prime(n):
try:
return n.is_prime()
except (AttributeError, NotImplementedError):
return ZZ(n).is_prime()
}}}
I think that we should change it to
{{{
from sage.structure.c
On Fri, Feb 5, 2016 at 9:50 AM, David Wong wrote:
> prime_number = bignumber / 2
> is_prime(prime_number) # -> False
>
> prime_number = bignumber // 2
> is_prime(prime_number) # -> True
>
> prime_number = ZZ(bignumber / 2)
> is_prime(prime_number) # -> True
>
>
> I've spent a couple of days arguin
About the code, the current version is
{{{
def is_prime(n):
try:
return n.is_prime()
except (AttributeError, NotImplementedError):
return ZZ(n).is_prime()
}}}
I think that we should change it to
{{{
from sage.structure.coerce import py_scalar_to_element
def is_prime(n):
On Fri, Feb 5, 2016 at 11:24 AM, Bruno Grenet wrote:
> Note that there is a difference between the example in the original email
> and the answers: The original email was about is_prime(something) not
> something.is_prime(). I do not know the mechanisms behind
> is_prime(something) but would it be
Note that there is a difference between the example in the original email and
the answers: The original email was about is_prime(something) not
something.is_prime(). I do not know the mechanisms behind is_prime(something)
but would it be possible that in this case the behavior is slightly differ
On Friday, February 5, 2016, David Roe wrote:
>
>
> On Fri, Feb 5, 2016 at 1:20 PM, Vincent Delecroix <
> 20100.delecr...@gmail.com
> > wrote:
>
>> Hello,
>>
>> Indeed, the definition given in the documentation of "is_prime" does not
>> coincide with what the method is doing.
>>
>> The mathematic
On Fri, Feb 5, 2016 at 1:20 PM, Vincent Delecroix <20100.delecr...@gmail.com
> wrote:
> Hello,
>
> Indeed, the definition given in the documentation of "is_prime" does not
> coincide with what the method is doing.
>
> The mathematical definition of prime *depends* on the ring. An element of
> a ri
Hello,
Indeed, the definition given in the documentation of "is_prime" does not
coincide with what the method is doing.
The mathematical definition of prime *depends* on the ring. An element
of a ring is prime if the ideal it generates is prime. And the ideal (3)
is prime in ZZ but not in QQ
prime_number = bignumber / 2
is_prime(prime_number) # -> False
prime_number = bignumber // 2
is_prime(prime_number) # -> True
prime_number = ZZ(bignumber / 2)
is_prime(prime_number) # -> True
I've spent a couple of days arguing with people about a number (not) being
a prime. Turns out it fails
16 matches
Mail list logo