Hi David,

I think "list" function is enough for me if I extend the ring in two
steps: first with free variables and then I extend it algebraically.
Your solution is working for me in this way:

sage: k = GF(2);
sage: WRBasePolyRing = MPolynomialRing(k, 8, x); x =
WRBasePolyRing.gens()
sage: S = WRBasePolyRing['w']; w = S.gen()
sage: WRPolyRing = S.quotient(w^4 + w^3 + w^2 + w + 1, 't'); t =
WRPolyRing.gen()
sage: X = x[0]*t + x[1]*t^2 + x[2]*t^4 + x[3]* t^8;
sage: Y = x[4]*t + x[5]*t^2 + x[6]*t^4 + x[7]* t^8;
sage: MyCurve = Y^2+X*Y+X^3+1
sage: print MyCurve.list()

[x0^2*x1 + x0*x1^2 + x0*x2^2 + x1*x2^2 + x0^2*x3 + x2*x3^2 + x3^3 +
x2*x4 + x3*x4 + x1*x5 + x3*x5 + x5^2 + x0*x6 + x0*x7 + x1*x7 + 1,
x0^2*x1 + x1^3 + x0^2*x2 + x0*x2^2 + x2^2*x3 + x3^3 + x3*x4 + x1*x5 +
x2*x5 + x5^2 + x1*x6 + x0*x7 + x3*x7 + x7^2, x0^2*x1 + x0*x2^2 + x2^3
+ x1^2*x3 + x0*x3^2 + x3^3 + x0*x4 + x3*x4 + x4^2 + x1*x5 + x5^2 +
x3*x6 + x0*x7 + x2*x7, x0^3 + x0^2*x1 + x1^2*x2 + x0*x2^2 + x1*x3^2 +
x3^3 + x1*x4 + x3*x4 + x0*x5 + x1*x5 + x5^2 + x2*x6 + x6^2 + x0*x7]

And after that as you mentioned, I can multiply the list by the basis
change matrix.

Thank you again (More question is on the way ... :">)

Bests,
Ahmad

On Dec 1, 3:27 am, Ahmad <[EMAIL PROTECTED]> wrote:
> Hi David,
>
> Thank you very much for your solution. I think it is enough for me as
> finally I want to see the result in normal basis. However, I changed
> the code a little to suite my purpose but it failed. Could you please
> tell me what should I use instead of "list" property in multivariate
> case (maybe we need some ordering like grobner basis):
>
> sage: k = GF(7)   # any coefficient ring here is okay
> sage: R = MPolynomialRing(k,2,x)     # create polynomial ring over k
> in variable x
> sage: x = R.gens()
> sage: g = x[0]^3 + 2*x[1] + 5    # create some polynomial
> sage: print g.list()             # list of coefficients of polynomial
> sage: [2*u for u in g.list()]   # multiplies every elements of
> g.list() by 2 (mod 7), returns result as a list
> Traceback (most recent call last):
> ...
> AttributeError: 'sage.rings.polynomial.multi_polynomial_libsingular'
> object has no attribute 'list'
>
> I hope that you don't get the feeling that I just naging and
> challenging you for nothing. It is almost exactly the computation I
> need for my thesis as I'm working on GHS attack. I should look at a
> curve when its parameters and variables is represented in base field
> (so one equation become many equations) and then I should pass some
> hyper-plane through it in its base field.
>
> Thanx again.
> Ahmad
>
> On Nov 30, 8:20 am, David Harvey <[EMAIL PROTECTED]> wrote:
>
> > On Nov 30, 2007, at 2:45 AM, Ahmad wrote:
>
> > > Dear Sage Supporters,
>
> > > As nobody continued to pay attention to the question I asked in sept 3
> > > about how I want to change the field basis "permanently", I am using
> > > john Cremona's idea to ask my question in another way, in hope to
> > > attract more attention:
>
> > > Suppose k is a field. Let define ring k[x]. I extend this ring by
> > > adding variable 't' and taking quotient by polynomial 't^4 + t^3 + t^2
> > > + t + 1'. So, I have the ring k[x][t]/(t^4 + t^3 + t^2 + t + 1) which
> > > is a free module over k[x]. But again sage use default basis (1, t,
> > > t^2, t^3) to represent this ring over k[x]:
>
> > > sage: k = GF(2);
> > > sage: R = k['x']; x = R.gen()
> > > sage: S = R['t']; t = S.gen()
> > > sage: SBar = S.quotient(t^4 + t^3 + t^2 + t + 1, 'a'); a = SBar.gen()
> > > sage: print x*a^4
> > > x*a^3 + x*a^2 + x*a + x
>
> > > How can I change this basis to normal basis, so I get:
>
> > > sage: print x*a^4
> > > x*a^4
>
> > Hi Ahmad,
>
> > I looked over the september thread, and the problem is that William's
> > solution won't work in this more general case, since you can't create
> > a polynomial ring with coefficients in a vector space, it just
> > doesn't make sense.
>
> > But if all you need is a list of the coordinates, then maybe we can
> > make this work. All you need to be able to do is apply a function to
> > each coefficient of a polynomial. Here's how you do that:
>
> > sage: k = GF(7)   # any coefficient ring here is okay
> > sage: R.<x> = PolynomialRing(k)     # create polynomial ring over k
> > in variable x
> > sage: g = x^3 + 2*x + 5    # create some polynomial
> > sage: g.list()             # list of coefficients of polynomial
> > [5, 2, 0, 1]
> > sage: [2*u for u in g.list()]   # multiplies every elements of g.list
> > () by 2 (mod 7), returns result as a list
> > [3, 4, 0, 2]
>
> > So you just need to replace "2*u" with whatever function William gave
> > you to change basis representation.
>
> > Of course, what you *really* want is to be able to create a field
> > that prints elements of itself with respect to a different basis, but
> > I don't think this is implemented in sage (yet). That sounds like it
> > could be a useful thing to have.
>
> > david
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to