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 <husihu...@gmail.com>: > 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+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. > -- 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.