ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 30 Oct 2019 10:50:29 -0500Plotting polynomials defined over a number fieldhttp://ask.sagemath.org/question/48557/plotting-polynomials-defined-over-a-number-field/I have an element of a polynomial ring over a number field K. It's a pretty benign number field -- I have just adjoined a square root of 3, called 't'.
I want to be able to plot the polynomial (specifically, it's a polynomial of two variables, and I want an implicit plot of where it vanishes). How do I get Sage to coerce 't' to a real number and draw the plot? Of course this should involve fixing an embedding of my number field into RR, but it's just a square root, so this shouldn't be hard.
For a minimal example:
var('w')
K.<t> = NumberField(w^2-3)
R = PolynomialRing(K,2,'x,y')
R.inject_variables()
f = y - t*x
implicit_plot(f,(x,-3,3),(y,-3,3))
It (quite understandably) chokes with "TypeError: Unable to coerce -t to a rational". I would like to coerce t to be the positive real square root of 3 and draw the plot.ConfusedMarkWed, 30 Oct 2019 10:50:29 -0500http://ask.sagemath.org/question/48557/Coerce an algebraic into a number field that contains ithttp://ask.sagemath.org/question/40020/coerce-an-algebraic-into-a-number-field-that-contains-it/ Consider the following code
r = QQbar.polynomial_root(x^5-x-1,CIF(RIF(0.1, 0.2), RIF(1.0, 1.1))
F,_,_ = number_field_elements_from_algebraics(r)
F(r)
Even though r can be coerced into an element of F, this coercion doesn't happen. What is the right thing for me to do? I'm interested in computing an algebraic number field that will contain a bunch of eigenvalues and want to express all the eigenvalues as elements of the number field. I've done the obvious workaround but the limitation expressed in the sample above isn't great.watson_laddFri, 08 Dec 2017 13:51:20 -0600http://ask.sagemath.org/question/40020/