ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 21 Jul 2020 05:22:20 -0500how to evaluate a polynomial in a quotient ring ?https://ask.sagemath.org/question/52596/how-to-evaluate-a-polynomial-in-a-quotient-ring/I define a polynomial ring and its quotient by an ideal:
sage: F = ZZ.quo(3*ZZ); F
Ring of integers modulo 3
sage: A.<X, Y, Z> = PolynomialRing(F); A
Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
sage: R.<x, y, z> = A.quotient(ideal(X^2 - 1, Y^2 - 1, Z^2 - 1)); R
Quotient of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
by the ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)
I define an element in this quotient ring:
sage: f = x*y*z; f
x*y*z
sage: f.parent()
Quotient of Multivariate Polynomial Ring in X, Y, Z
over Ring of integers modulo 3
by the ideal (X^2 + 2, Y^2 + 2, Z^2 + 2)
I want to evaluate this element at $(x, y, z) = (2, 3, 4)$.
I tried this, and got this error message:
sage: f(2, 3, 4)
Traceback (most recent call last)
...
TypeError: 'QuotientRing_generic_with_category.element_class' object is not callable
How can I calculate `f(2, 3, 4)` with Sage?andriamTue, 21 Jul 2020 05:22:20 -0500https://ask.sagemath.org/question/52596/center lift of a polynomial?https://ask.sagemath.org/question/49613/center-lift-of-a-polynomial/Hello! I am trying to code up the NTRU example in Hoffstein, Pipher and Silverman. Anyone know if the "center lift" of a polynomial is implemented in Sage? I am working the quotient ring:
Z_7[x] / x^5 - 1
I have a(x) = 5 + 3x - 6x^2 + 2x^3 + 4x^4
The center lift takes this a polynomial with coefficients in the range of - 7/2 < coeff <= 7/2.
Thus a(x) -> -2 + 3x + x^2 + 2x^3 - 3x^4
But what I get is:
N = 5
q = 7
P.<x> = GF(q)[]
Q = QuotientRing(P, x^N - 1)
a = 5 + 3*x - 6*x^2 + 2*x^3 + 4*x^4
aa = Q(a)
aa.lift()
4*x^4 + 2*x^3 + x^2 + 3*x + 5
Any thoughts? I guess I could write my own function to do the center lifting...
Thanks!
Susansusan_in_AnnapolisMon, 20 Jan 2020 18:55:52 -0600https://ask.sagemath.org/question/49613/Rings, Ideals, Quotient Rings in Sagehttps://ask.sagemath.org/question/29990/rings-ideals-quotient-rings-in-sage/Hi everybody.
I am new to sage. I want to construct rings, ideals, and quotient rings.
I used Z.IntegerRing() to generate the ring of integers.
Question 1:
Then I used I = Z.ideal(2) to get the ideal generated by 2 (even numbers).
Question: How can I display the Elements. E.g. I(2) does not work in order to display the second element of the ideal.
Question 2:
To generate the quotientring Z/2Z i used S = Z.quotient_ring(I).
What if I want to generate the quotientring 2Z/6Z ? S = I.quotient_ring(J) does not work (I = Z.ideal(2), J = Z.ideal(6).
Thanks for any help
DesperateUserWed, 14 Oct 2015 02:38:47 -0500https://ask.sagemath.org/question/29990/