ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 26 May 2012 08:39:43 +0200Defining Polynomial Basis and Generic Polynomialshttps://ask.sagemath.org/question/8885/defining-polynomial-basis-and-generic-polynomials/Given a Extension Field , say GF(2**4) with modulus polynomial f(x), I would like to a) Define a polynomial basis [1,x,x^2,x^3] for its elements. b) Define a general polynomial as a0 + a1*x + a2*x^2 +a^3. Currently for part (a) I am defining the basis as a tuple, but I have an inkling that it is the worst possible fix. Kindly suggest a better alternative and a solution for part (b).Fri, 20 Apr 2012 08:17:30 +0200https://ask.sagemath.org/question/8885/defining-polynomial-basis-and-generic-polynomials/Answer by Volker Braun for <p>Given a Extension Field , say GF(2<em>*4) with modulus polynomial f(x), I would like to a) Define a polynomial basis [1,x,x^2,x^3] for its elements. b) Define a general polynomial as a0 + a1</em>x + a2*x^2 +a^3. Currently for part (a) I am defining the basis as a tuple, but I have an inkling that it is the worst possible fix. Kindly suggest a better alternative and a solution for part (b).</p>
https://ask.sagemath.org/question/8885/defining-polynomial-basis-and-generic-polynomials/?answer=13484#post-id-13484Its kind of boring to do it in a univariate polynomial ring. This is what you want:
sage: R.<x,y,z> = PolynomialRing(GF(2*4, 'a'))
sage: I = R.ideal(x^2+y^2+z^2-4, x^2+2*y^2-5, x*z-1)
sage: I.vector_space_dimension()
4
sage: I.normal_basis()
[y*z, z, y, 1]
Fri, 20 Apr 2012 09:55:39 +0200https://ask.sagemath.org/question/8885/defining-polynomial-basis-and-generic-polynomials/?answer=13484#post-id-13484Comment by Prateek_123 for <p>Its kind of boring to do it in a univariate polynomial ring. This is what you want:</p>
<pre><code>sage: R.<x,y,z> = PolynomialRing(GF(2*4, 'a'))
sage: I = R.ideal(x^2+y^2+z^2-4, x^2+2*y^2-5, x*z-1)
sage: I.vector_space_dimension()
4
sage: I.normal_basis()
[y*z, z, y, 1]
</code></pre>
https://ask.sagemath.org/question/8885/defining-polynomial-basis-and-generic-polynomials/?comment=19738#post-id-19738This gives an excellent pointer to go about part (a) of the problem. Regarding the second part, if I use the predefined function var to instantiate variables as : var(varname, domain = Fieldname) and then try something like varname * field_generator, sage returns the following error : Unsupported operand parent(s) for '*': 'Symbolic Ring' and
'Multiivariate Quotient Polynomial Ring. Any pointers as to how to proceed with defining a polynomial would be helpful. Thanks.Sat, 26 May 2012 08:39:43 +0200https://ask.sagemath.org/question/8885/defining-polynomial-basis-and-generic-polynomials/?comment=19738#post-id-19738