Re: [sage-support] evaluation of polynomials mod 8

2022-09-27 Thread John Cremona
Thanks!

On Tuesday, September 27, 2022 at 3:02:25 PM UTC+1 Kwankyu wrote:

> This bug is tracked now in 
>
> https://trac.sagemath.org/ticket/34591
>
> On Tuesday, September 27, 2022 at 6:31:39 PM UTC+9 wdjo...@gmail.com 
> wrote:
>
>> On Tue, Sep 27, 2022 at 4:46 AM John Cremona  wrote:
>> >
>> > Am I doing something stupid here, or is this a bug?
>> >
>> > sage: R = Integers(8)
>> > sage: RXY. = R[]
>> > sage: F = X^3-X^2*Y+X*Y^2+Y^3
>> > sage: F([4,2])
>> > 6
>> > sage: 4^3-4^2*2+4*2^2+2^3
>> > 56
>> > sage: (4^3-4^2*2+4*2^2+2^3) % 8
>> > 0
>> >
>>
>> Even after coercion it doesn't evaluate in ZZ/8ZZ:
>>
>> sage: ZZ8 = IntegerModRing(8)
>> sage: R. = PolynomialRing(ZZ8, "x,y")
>> sage: f = x^3-x^2*y+x*y^2+y^3
>> sage: x0 = ZZ8(4)
>> sage: y0 = ZZ8(2)
>> sage: x0^3-x0^2*y0+x0*y0^2+y0^3
>> 0
>> sage: f(x0,y0)
>> 6
>> sage: f(4,2)
>> 6
>>
>> >
>> > Why does F not evaluate to 0 mod 8 at X=4, Y=2? Rather obviously, each
>> > of the terms in F(4,2) is 0 mod 8.
>> >
>> > John
>> >
>> > --
>> > You received this message because you are subscribed to the Google 
>> Groups "sage-support" group.
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> an email to sage-support...@googlegroups.com.
>> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/sage-support/CAD0p0K5hXexw5J20gstKUOXxzWdP2a2OTRbKmUtAyG41ySSR-A%40mail.gmail.com
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/a3bf46f4-f359-476d-897f-302ac3838cean%40googlegroups.com.


Re: [sage-support] evaluation of polynomials mod 8

2022-09-27 Thread Kwankyu
This bug is tracked now in 

https://trac.sagemath.org/ticket/34591

On Tuesday, September 27, 2022 at 6:31:39 PM UTC+9 wdjo...@gmail.com wrote:

> On Tue, Sep 27, 2022 at 4:46 AM John Cremona  wrote:
> >
> > Am I doing something stupid here, or is this a bug?
> >
> > sage: R = Integers(8)
> > sage: RXY. = R[]
> > sage: F = X^3-X^2*Y+X*Y^2+Y^3
> > sage: F([4,2])
> > 6
> > sage: 4^3-4^2*2+4*2^2+2^3
> > 56
> > sage: (4^3-4^2*2+4*2^2+2^3) % 8
> > 0
> >
>
> Even after coercion it doesn't evaluate in ZZ/8ZZ:
>
> sage: ZZ8 = IntegerModRing(8)
> sage: R. = PolynomialRing(ZZ8, "x,y")
> sage: f = x^3-x^2*y+x*y^2+y^3
> sage: x0 = ZZ8(4)
> sage: y0 = ZZ8(2)
> sage: x0^3-x0^2*y0+x0*y0^2+y0^3
> 0
> sage: f(x0,y0)
> 6
> sage: f(4,2)
> 6
>
> >
> > Why does F not evaluate to 0 mod 8 at X=4, Y=2? Rather obviously, each
> > of the terms in F(4,2) is 0 mod 8.
> >
> > John
> >
> > --
> > You received this message because you are subscribed to the Google 
> Groups "sage-support" group.
> > To unsubscribe from this group and stop receiving emails from it, send 
> an email to sage-support...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-support/CAD0p0K5hXexw5J20gstKUOXxzWdP2a2OTRbKmUtAyG41ySSR-A%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/ae69a416-cdb3-4eab-8639-8728152ae3b9n%40googlegroups.com.


Re: [sage-support] evaluation of polynomials mod 8

2022-09-27 Thread David Joyner
On Tue, Sep 27, 2022 at 4:46 AM John Cremona  wrote:
>
> Am I doing something stupid here, or is this a bug?
>
> sage: R = Integers(8)
> sage: RXY. = R[]
> sage: F = X^3-X^2*Y+X*Y^2+Y^3
> sage: F([4,2])
> 6
> sage: 4^3-4^2*2+4*2^2+2^3
> 56
> sage: (4^3-4^2*2+4*2^2+2^3) % 8
> 0
>

Even after coercion it doesn't evaluate in ZZ/8ZZ:

sage: ZZ8 = IntegerModRing(8)
sage: R. = PolynomialRing(ZZ8, "x,y")
sage: f = x^3-x^2*y+x*y^2+y^3
sage: x0 = ZZ8(4)
sage: y0 = ZZ8(2)
sage: x0^3-x0^2*y0+x0*y0^2+y0^3
0
sage: f(x0,y0)
6
sage: f(4,2)
6

>
> Why does F not evaluate to 0 mod 8 at X=4, Y=2? Rather obviously, each
> of the terms in F(4,2) is 0 mod 8.
>
> John
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-support/CAD0p0K5hXexw5J20gstKUOXxzWdP2a2OTRbKmUtAyG41ySSR-A%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAEQuuAWnh%3Dt97OQDgEx39TMyeYu7UYsih3JmN%2B2cSHSiuCGH5Q%40mail.gmail.com.


Re: [sage-support] evaluation of polynomials mod 8

2022-09-27 Thread Vincent Delecroix
The iterated subs turns out to be correct

sage: F.subs(X=4).subs(Y=2)
0
sage: F.subs(Y=2).subs(X=4)
0

But not the one shot version (which is supposedly equivalent to the evaluation)

sage: F.subs(X=4, Y=2)
6

There is definitely something wrong!!

Vincent

On Tue, 27 Sept 2022 at 10:46, John Cremona  wrote:
>
> Am I doing something stupid here, or is this a bug?
>
> sage: R = Integers(8)
> sage: RXY. = R[]
> sage: F = X^3-X^2*Y+X*Y^2+Y^3
> sage: F([4,2])
> 6
> sage: 4^3-4^2*2+4*2^2+2^3
> 56
> sage: (4^3-4^2*2+4*2^2+2^3) % 8
> 0
>
>
> Why does F not evaluate to 0 mod 8 at X=4, Y=2? Rather obviously, each
> of the terms in F(4,2) is 0 mod 8.
>
> John
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-support/CAD0p0K5hXexw5J20gstKUOXxzWdP2a2OTRbKmUtAyG41ySSR-A%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAGEwAAm12%3DBhuPHvb2WHzn0HfUJb%3DKcS_E5h8YiZ14Z5MEL9Mw%40mail.gmail.com.


[sage-support] evaluation of polynomials mod 8

2022-09-27 Thread John Cremona
Am I doing something stupid here, or is this a bug?

sage: R = Integers(8)
sage: RXY. = R[]
sage: F = X^3-X^2*Y+X*Y^2+Y^3
sage: F([4,2])
6
sage: 4^3-4^2*2+4*2^2+2^3
56
sage: (4^3-4^2*2+4*2^2+2^3) % 8
0


Why does F not evaluate to 0 mod 8 at X=4, Y=2? Rather obviously, each
of the terms in F(4,2) is 0 mod 8.

John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAD0p0K5hXexw5J20gstKUOXxzWdP2a2OTRbKmUtAyG41ySSR-A%40mail.gmail.com.