You may work on the univariate polynamial ring in your variable of interest over a suitable ring. A simple example :
sage: var("x, y, z") (x, y, z) sage: foo=x^3-x*sin(y+z)+1 sage: foo.polynomial(ring=PolynomialRing(SR,"x")).parent() Univariate Polynomial Ring in x over Symbolic Ring sage: foo.polynomial(ring=PolynomialRing(SR,"x")).roots() [(-1/6*(-I*sqrt(3) + 1)*sin(y + z)/(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3) - 1/2*(I*sqrt(3) + 1)*(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3), 1), (-1/6*(I*sqrt(3) + 1)*sin(y + z)/(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3) - 1/2*(-I*sqrt(3) + 1)*(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3), 1), (1/3*sin(y + z)/(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3) + (1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3), 1)] It might be interesting to create a more specific base ring, but only if your expression is indeed a polynomial (e. g. no function calls as in my oversimplified example…). It turns out that, in this precise case, it is not necessary to explicitly create a polynomial ; but doing so gives a two orders of magnitude speed gain (not exactly small potatoes) : sage: %time foo.roots() CPU times: user 3.83 s, sys: 40.1 ms, total: 3.87 s Wall time: 2.9 s [(-1/6*(-I*sqrt(3) + 1)*sin(y + z)/(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3) - 1/2*(I*sqrt(3) + 1)*(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3), 1), (-1/6*(I*sqrt(3) + 1)*sin(y + z)/(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3) - 1/2*(-I*sqrt(3) + 1)*(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3), 1), (1/3*sin(y + z)/(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3) + (1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3), 1)] sage: %time foo.polynomial(ring=PolynomialRing(SR,"x")).roots() CPU times: user 41.2 ms, sys: 17 µs, total: 41.2 ms Wall time: 41.1 ms [(-1/6*(-I*sqrt(3) + 1)*sin(y + z)/(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3) - 1/2*(I*sqrt(3) + 1)*(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3), 1), (-1/6*(I*sqrt(3) + 1)*sin(y + z)/(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3) - 1/2*(-I*sqrt(3) + 1)*(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3), 1), (1/3*sin(y + z)/(1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3) + (1/6*sqrt(-4/3*sin(y + z)^3 + 9) - 1/2)^(1/3), 1)] HTH, Le lundi 5 juillet 2021 à 22:01:10 UTC+2, axio...@yahoo.de a écrit : > I am trying to fix #32133, which is about translating FriCAS expressions > containing symbolic roots of polynomials, given by their minimal > polynomials. > > This is easy enough if the polynomials are univariate, so the roots are > algebraic numbers and I can use the wonderful machinery of QQbar. > > However, I don't see what I can do with polynomials containing extra > variables. > > Any hints appreciated! > > Martin > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/a9f8b8d9-4eae-43ef-9050-d4c044db8292n%40googlegroups.com.