ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 24 May 2019 12:43:09 -0500installing the kohel databasehttp://ask.sagemath.org/question/46654/installing-the-kohel-database/ I'm trying to work with modular polynomials and Hilbert class polynomials in sage, and I would try the code
Phi = ClassicalModularPolynomialDatabase()
print(Phi[2])
The resulting error is a "LookupError: filename /opt/sagemath-8.6/local/share/kohel/PolMod/Cls/pol.002.dbz does not exist"
Okay, no big deal, I just need to download the right database follow the path that sage is looking for the file at and put it there right? The problem is, when I went to download the database, from the sage website (http://ftp.yz.yamagata-u.ac.jp/pub/math/sage/spkg/upstream/database_kohel/index.html) I get a strange .gz document, that doesn't let me use the classical modular polynomial database like I need to. I'm I doing this right? If not, where can I download the required package, and if I am, what's the next step to be able to use this database in sage? I'm using version 8.6.JRHalesFri, 24 May 2019 12:43:09 -0500http://ask.sagemath.org/question/46654/How to use modular polynomials in Sage?http://ask.sagemath.org/question/41271/how-to-use-modular-polynomials-in-sage/I want to perform some calculations using modular polynomials, and I saw that Sage already offers some databases for this. Most notably, I came across [this](https://doc.sagemath.org/html/en/reference/databases/sage/databases/db_modular_polynomials.html#sage.databases.db_modular_polynomials.ClassicalModularPolynomialDatabase). But, I couldn't find any documentation or tutorial as how this database is actually used, or what it actually includes. I can do something like this, but it doesn't give much information:
db = ClassicalModularPolynomialDatabase()
print db
Is there any tutorial or documentation as how to use modular polynomials in Sage?ninhoMon, 26 Feb 2018 14:41:17 -0600http://ask.sagemath.org/question/41271/Trouble with sage small_rootshttp://ask.sagemath.org/question/40655/trouble-with-sage-small_roots/# ...some code above
P.<x> = PolynomialRing(Zmod(n), implementation='NTL')
f = P(coef)
print(f(x=b)) # return 0, (b)**f.degree() < n(condition for coppersmith method)
print(f.small_roots(X = b + 1)) # return nothing(also without kwargs), but should contain b ?
Edit:
Coef are list of coefficients, b is polynomial root(line 3). Why small._root didnt return list with b, if b is "small_root"-
(b)**f.degree() < n(condition for coppersmith method)cptYossarian1234Wed, 17 Jan 2018 08:46:20 -0600http://ask.sagemath.org/question/40655/calculating the modulo of a "number" in a binary finite fieldhttp://ask.sagemath.org/question/38735/calculating-the-modulo-of-a-number-in-a-binary-finite-field/Polynomial equations in binary finite fields are often represented as numbers. eg. $x^2 + 1$ is basically the same thing as $1x^2 + 0x^1 + 1x^0$ and thus would be represented as $101_2$ or $5_{10}$.
In that spirit I'm trying to use a hexadecimal number to represent a polynomial equation. The polynomial equation is larger than the modulo I'm using ($x^{113} + x^9 + 1$) so I'm trying to get the result of the modulo operation.
Here's what I've tried:
BF.<a> = FiniteField(2^113);
X = Integer(0x61661990d3b1f7a608ad095a01d727380850d2592f5b9f88f66a20e8);
X_bf = BF._cache.fetch_int(X);
X_bf.mod(x^113 + x^9 + 1)
Unfortunately, this doesn't seem to work and instead gets me the following error messages:
TypeError Traceback (most recent call last)
<ipython-input-4-dba4addbde0d> in <module>()
2
3 X = Integer(Integer(0x61661990d3b1f7a608ad095a01d727380850d2592f5b9f88f66a20e8));
----> 4 X_bf = BF._cache.fetch_int(X);
5
6 X_bf.mod(x**Integer(113) + x**Integer(9) + Integer(1))
/home/sage/sage-8.0/src/sage/rings/finite_rings/element_ntl_gf2e.pyx in sage.rings.finite_rings.element_ntl_gf2e.Cache_ntl_gf2e.fetch_int (/home/sage/sage/src/build/cythonized/sage/rings/finite_rings/element_ntl_gf2e.cpp:7596)()
400 raise ValueError("Cannot coerce element %s to this field." % e)
401
--> 402 cpdef FiniteField_ntl_gf2eElement fetch_int(self, number):
403 """
404 Given an integer less than `p^n` with base `2`
/home/sage/sage-8.0/src/sage/rings/finite_rings/element_ntl_gf2e.pyx in sage.rings.finite_rings.element_ntl_gf2e.Cache_ntl_gf2e.fetch_int (/home/sage/sage/src/build/cythonized/sage/rings/finite_rings/element_ntl_gf2e.cpp:7212)()
431
432 if number < 0 or number >= self.order():
--> 433 raise TypeError("n must be between 0 and self.order()")
434
435 if isinstance(number, int) or isinstance(number, long):
TypeError: n must be between 0 and self.order()
I realize that what I'm doing isn't technically a finite field but idk how else I might get a "number" turned into a polynomial equation.
Any ideas?neubertMon, 04 Sep 2017 01:02:35 -0500http://ask.sagemath.org/question/38735/pre-reduction multiplication result in binary fieldhttp://ask.sagemath.org/question/38734/pre-reduction-multiplication-result-in-binary-field/The following will do multiplication in a finite field:
X = Integer(0x009D73616F35F4AB1407D73562C10F);
Y = Integer(0x00A52830277958EE84D1315ED31886);
F.<x> = GF(2)[];
p = x^113 + x^9 + 1;
BF = GF(2^113, 'x', modulus=p);
X_bf = BF._cache.fetch_int(X);
Y_bf = BF._cache.fetch_int(Y);
temp = Y * X; temp
The problem with this is that the result you get back has had the reduction step already ran. I'd like to see the multiplication result pre-reduction.
Any ideas?neubertSun, 03 Sep 2017 22:44:52 -0500http://ask.sagemath.org/question/38734/How to compute syzygy module of an ideal in a quotient ring?http://ask.sagemath.org/question/37320/how-to-compute-syzygy-module-of-an-ideal-in-a-quotient-ring/I am trying to compute the syzygy module of an ideal generated by two polynomials `<p,q>` modulo `I`, where `I` is another ideal. This means to compute a generating set `[(p1,q1),...,(ps,qs)]` of the module `{(g,h): gp+hq is in I}`. I know that in Sage, we can use singular command to compute syzygy module:
R.<x,y> = PolynomialRing(QQ, order='lex')
f=2*x^2+y
g=y
h=2*f+g
I=ideal(f,g,h)
M = I.syzygy_module();M
[ -2 -1 1]
[ -y 2*x^2 + y 0]
But this does not work with modulo `I`:
R.<x,y> = PolynomialRing(QQ, order='lex')
S.<a,b>=R.quo(x^2+y^2)
I=ideal(a^2,b^2);I
M = I.syzygy_module();M
Ideal (-b^2, b^2) of Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x^2 + y^2)
Error in lines 4-4
Traceback (most recent call last):
Is there a way to do that?KittyLTue, 18 Apr 2017 04:34:27 -0500http://ask.sagemath.org/question/37320/inverse of a polynomial modulo another polynomialhttp://ask.sagemath.org/question/8756/inverse-of-a-polynomial-modulo-another-polynomial/Hi, I'm trying to implement the Baby Step Giant Step algorithm in the group of units of prime fields. I would like to generate the field provided one generator polynomial. But I need to calculate p^(-1) (where p is a polynomial), but can't find a function to do so. This is what I'm doing,
F.<a> = GF(2)[];
R.<b> = PolynomialRing(F)
S.<x> = R.quotient(b^4+b+1)
m = sqrt(S.modulus().degree());
gamma = S.modulus();
alpha = x^3+1;
now i need to calculate (alpha)^(-1) modulo gamma
Any help? Better ways to do the same thing?
Thanks!
inertialFrostTue, 28 Feb 2012 04:47:08 -0600http://ask.sagemath.org/question/8756/How do I compute modular polynomials?http://ask.sagemath.org/question/7832/how-do-i-compute-modular-polynomials/How do I compute modular polynomials in SAGE?
More precisely $\phi_{\ell}(X,Y) \pmod{p}$ where $p$ is a prime.cqureshiTue, 24 Jan 2012 06:56:58 -0600http://ask.sagemath.org/question/7832/Convolution Polynomial Ringhttp://ask.sagemath.org/question/10465/convolution-polynomial-ring/How to define polynomial ring like Z[x]/(x^10-1) & Z_5[x]/(x^10-1) in Sage?
Following does not give gcd. I want to implement NTRU public key cryptosystem
in Sage. Hence I need this.
N=7
p=3
R2.<b> = PolynomialRing(GF(p))
S.<x> = R2.quotient(b^N - 1)
f=x^6-x^4+x^3+x^2-1
g=x^6+x^4-x^2-x
print gcd(f,g),xgcd(f,g)
Traceback (click to the left of this block for traceback)
...
TypeError: unable to find gcd*emphasized text*SarkarFri, 23 Aug 2013 05:46:15 -0500http://ask.sagemath.org/question/10465/Polynomial division mod nhttp://ask.sagemath.org/question/10175/polynomial-division-mod-n/Hi everyone,
Let's suppose that we are working with polynomials modulo n a composite number, for which we know the factorization (n=p*q).
If we know that f(x) can be divided by e.g. g(x), what is the most efficient way to calculate f(x)/g(x) in Z_n with Sage?
Thanks for your timecp_sageSun, 02 Jun 2013 14:37:25 -0500http://ask.sagemath.org/question/10175/Trying to display the roots of a polynomial over a finite fieldhttp://ask.sagemath.org/question/9451/trying-to-display-the-roots-of-a-polynomial-over-a-finite-field/So I'm trying to use the .roots() command on a polynomial over the quotient ring F_2[x]/x^5 + x^2 + 1, which is a field isomorphic to F_32. But it keeps giving me the following error:
NotImplementedError: root finding with multiplicities for this polynomial not implemented (try the multiplicities=False option)
Is there a way to get this to work?
ThanksZaubertrankSat, 20 Oct 2012 17:20:48 -0500http://ask.sagemath.org/question/9451/modular polynomialshttp://ask.sagemath.org/question/8667/modular-polynomials/How do I compute modular polynomials?cqureshiTue, 24 Jan 2012 06:52:48 -0600http://ask.sagemath.org/question/8667/