It works. Thanks a lot.

Sihuang

在 2015年1月3日星期六UTC+1下午7时55分52秒,vdelecroix写道:
>
> Hi Sihuang, 
>
> I see. I do not have magma, so my solution is certainly not optimal 
> but you can do a three steps conversion 
>
> magma polynomial -> 
> string in $.1, $.2, $.3 and $.4 -> 
> string in e, f, g, h -> 
> polynomial 
>
> To create the polynomial from a string it works out of the box 
>
> sage: R.<e,x,y,z> = PolynomialRing(ZZ, 4) 
> sage: string = '3 * e^2 + 2 * x * y + 13 * x' 
> sage: R(string) 
> 3*e^2 + 2*x*y + 13*x 
>
> I hope that somebody with magma on his/her computer will come with a 
> better solution. 
>
> Vincent 
>
> 2015-01-03 16:17 UTC+01:00, Sihuang Hu <husi...@gmail.com <javascript:>>: 
> > Hi, Vincent. 
> > 
> > What I want to do is to get a polynomial which is in the polynomial ring 
> > R.<e,x,y,z> = PolynomialRing(ZZ, 4). 
> > 
> > Do you know how to do this? 
> > 
> > Thanks, 
> > Sihuang 
> > 
> > 在 2015年1月3日星期六UTC+1下午4时05分08秒,vdelecroix写道: 
> >> 
> >> Hello, 
> >> 
> >> If it is just a matter of display you can use the method .replace() of 
> >> strings 
> >> 
> >> sage: sage: initial_string = "$.1 + 3 $.2" 
> >> sage: sage: initial_string.replace("$.1", "e").replace("$.2", "f") 
> >> 'e + 3 f' 
> >> 
> >> You can also have a look at 
> >> 
> http://stackoverflow.com/questions/6116978/python-replace-multiple-strings 
> >> 
> >> for multiple replacement. 
> >> 
> >> To convert your magma polynomial p into a string just do str(p). 
> >> 
> >> Vincent 
> >> 
> >> 2015-01-03 15:40 UTC+01:00, Sihuang Hu <husi...@gmail.com 
> <javascript:>>: 
> >> 
> >> > Hi, 
> >> > 
> >> > I found that Sage is not able to compute the Complete Weight 
> Enumerator 
> >> > 
> >> of 
> >> > Linear Codes. 
> >> > So I load magma to compute it: 
> >> > 
> >> > sage: k.<a> = GF(2**2) 
> >> > sage: MS = MatrixSpace(k,4,7) 
> >> > sage: G  = MS([[1,1,1,0,0,0,0], [1,0,0,1,1,0,0], [0,1,0,1,0,1,0], 
> >> > [1,1,0,1,0,0,1]]) 
> >> > sage: C = LinearCode(G) 
> >> > sage: magma.CompleteWeightEnumerator(C) 
> >> > $.1^7 + 7*$.1^4*$.2^3 + 7*$.1^4*$.3^3 + 7*$.1^4*$.4^3 + 7*$.1^3*$.2^4 
> + 
> >> > 
> >> > 7*$.1^3*$.3^4 + 7*$.1^3*$.4^4 + 42*$.1^2*$.2^2*$.3^2*$.4 + 
> >> > 42*$.1^2*$.2^2*$.3*$.4^2 + 42*$.1^2*$.2*$.3^2*$.4^2 + 
> >> > 42*$.1*$.2^2*$.3^2*$.4^2 + $.2^7 + 7*$.2^4*$.3^3 + 7*$.2^4*$.4^3 + 
> >> > 7*$.2^3*$.3^4 + 7*$.2^3*$.4^4 + $.3^7 + 7*$.3^4*$.4^3 + 7*$.3^3*$.4^4 
> + 
> >> > 
> >> > $.4^7 
> >> > 
> >> > Do anyone know how I can get the output of 
> >> > 'magma.CompleteWeightEnumerator(C)' 
> >> > as the following form 
> >> > e^7 + 7*e^4*x^3 + 7*e^4*y^3 + 7*e^4*z^3 + ... 
> >> > In other words, display $.1 -> e, $.2 -> x, $.3 -> y, $.4 -> z. 
> >> > 
> >> > Thanks, 
> >> > Sihuang 
> >> > 
> >> > -- 
> >> > 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 <javascript:>. 
> >> > To post to this group, send email to sage-s...@googlegroups.com 
> >> <javascript:>. 
> >> > Visit this group at http://groups.google.com/group/sage-support. 
> >> > For more options, visit https://groups.google.com/d/optout. 
> >> > 
> >> 
> > 
> > -- 
> > 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 <javascript:>. 
> > To post to this group, send email to sage-s...@googlegroups.com 
> <javascript:>. 
> > Visit this group at http://groups.google.com/group/sage-support. 
> > For more options, visit https://groups.google.com/d/optout. 
> > 
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to