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>:
> 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:>>:
>> > email to
sage-support...@googlegroups.com <javascript:>.
>> <javascript:>.