Thanks, Volker. I must say I find the K.<x> syntax makes me feel a bit
uneasy. Is there a way to do

    sage: x = polygen(QQ)
    sage: K.<x> = NumberField(x^2 + x - 1/2, embedding=0.366)

 in straight Python?


On 28 July 2013 04:13, Volker Braun <vbraun.n...@gmail.com> wrote:

> The K.<> = ... syntax injects a names=(...) keyword argument on the right
> hand side:
>
> sage: preparse('K.<k> = f()')
> "K = f(names=('k',)); (k,) = K._first_ngens(1)"
>
> So what you probably want is:
>
> sage: x = polygen(QQ)
> sage: sage_eval("NumberField(x^2 + x - 1/2, embedding=0.366,
> names=('x',))", locals={'x':x})
> Number Field in x with defining polynomial x^2 + x - 1/2
>
>
>
> On Saturday, July 27, 2013 5:53:52 PM UTC-4, Emil wrote:
>>
>> Hi, I'd like to be able to save number fields with embeddings as text
>> strings, so that they can be instantiated at a later date, as well as being
>> human readable. So, I'm trying to store the command used to create such a
>> field, and use sage_eval on it.
>>
>>     sage: x = polygen(QQ)
>>     sage: K.<x> = NumberField(x^2 + x - 1/2, embedding=0.366)
>>
>> The above works, but the following gives an error:
>>
>>     sage: K.<x> = sage_eval('NumberField(x^2 + x - 1/2,
>> embedding=0.366)', locals={'x': x})
>> ------------------------------**------------------------------**
>> ---------------
>> TypeError                                 Traceback (most recent call
>> last)
>>
>> /Users/ev/Projects/flagmatic/<**ipython console> in <module>()
>>
>> TypeError: sage_eval() got an unexpected keyword argument 'names'
>>
>>
>> Does anyone know how to fix this? Thanks!
>>
>  --
> 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/groups/opt_out.
>
>
>

-- 
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/groups/opt_out.


Reply via email to