Strange behavior when evaluating multivariate polynomials over integers modulo n

34 views
Skip to first unread message

Alex Braat

unread,
Mar 8, 2021, 4:25:38 AM3/8/21
to sage-support
Hello,

I have encountered some strange behavior when I evaluate multivariate polynomials over the integers modulo n. For instance,

In:
p = 3
S = Integers(p^2)
R.<x,y> = PolynomialRing(S)
f = x^2 * y^2
print(f([S(p),S(1)]), f([S(1), S(p)]))

Out:
1 0

while both evaluations should ofcourse be equal to 0. This does not depend on the prime p, and is consistent in both of these versions of SageMath:

'SageMath version 8.7, Release Date: 2019-03-23'
'SageMath version 9.2, Release Date: 2020-10-24'

Am I doing something wrong or is this a bug?

Dima Pasechnik

unread,
Mar 8, 2021, 4:34:06 AM3/8/21
to sage-support
On Mon, Mar 8, 2021 at 9:25 AM Alex Braat <alex...@gmail.com> wrote:
>
> Hello,
>
> I have encountered some strange behavior when I evaluate multivariate polynomials over the integers modulo n. For instance,
>
> In:
> p = 3
> S = Integers(p^2)
> R.<x,y> = PolynomialRing(S)
> f = x^2 * y^2
> print(f([S(p),S(1)]), f([S(1), S(p)]))
>
> Out:
> 1 0
>
> while both evaluations should ofcourse be equal to 0. This does not depend on the prime p, and is consistent in both of these versions of SageMath:

looks like a bug (also in the 9.3.beta7)
sage: f(S(3),S(1))
1


>
> 'SageMath version 8.7, Release Date: 2019-03-23'
> 'SageMath version 9.2, Release Date: 2020-10-24'
>
> Am I doing something wrong or is this a bug?
>
> --
> 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/e3b67e84-1d8b-46e4-b0dd-5558f6d4929bn%40googlegroups.com.

Alex Braat

unread,
Mar 8, 2021, 7:27:06 AM3/8/21
to sage-support
Small update:
Replacing Integers(p^2) by QuotientRing(ZZ, p^2) seems to fix the issue.

Op maandag 8 maart 2021 om 10:34:06 UTC+1 schreef dim...@gmail.com:

Dima Pasechnik

unread,
Mar 8, 2021, 3:41:13 PM3/8/21
to sage-support
On Mon, Mar 8, 2021 at 12:27 PM Alex Braat <alex...@gmail.com> wrote:
>
> Small update:
> Replacing Integers(p^2) by QuotientRing(ZZ, p^2) seems to fix the issue.

Could you open a trac ticket on this?
It looks as if multivariate polynomial rings over Integers(p^2) are
directly using Singular,
but I don't think Singular can do such computations (over non-fields)

QuotientRing(ZZ, p^2) does something else.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/c860111e-aeea-43ff-b6c5-5c392e590789n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages