On Mar 25, 2:18 am, continuum121 <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I have a problem. Here is its formulation. I work in some polynomial
> ring - lets say
> R,(x,y) = PolynomialRing(QQ, 2, 'xy', order='lex').objgens()
> and consider ideal in R
> I = ideal(x+y^3-2,y+x^3-2)
> then I calculate grobner basis for ideal I
> B = I.groebner_basis(); B
> B[0] is univariate polynomial. Here the real problem begins. I would
> like to get real roots of polynomial B[0]. I can do B[0].factor() but
> it gives only part of information us factorization is over Q[x,y].
> More intuitive way for me is to treat it symbolicly. I want to write
> solve(B[0] == 0, x) but it doesn't work us function solve() needs
> symbolic object and gets boolean expression.
>
> The question is: how to find real roots for polynomial object either
> symbolicly (more desired) or numericly?

Root-finding is implemented for univariate polynomials.  Here is one
way to get your polynomial in a univariate ring:

sage: U = QQ['y']
sage: U(B[0])
y^9 - 6*y^6 + 12*y^3 - y - 6

You can then use the .roots() method to find the roots.  In
particular, .roots(ring=AA) will find all the real roots exactly.  (It
finds them numerically first, but maintains enough information to
recover the exact root later.)

sage: rts = U(B[0]).roots(ring=AA); rts
[([0.99999999999999988 .. 1.0000000000000003], 1)]

We see that this polynomial has one real root (of multiplicity one).
Given this approximation, it seems very likely that the root is
actually equal to 1; we can prove this by testing:

sage: rt = rts[0][0]; rt == 1
True

If you want the entire real variety of a zero-dimensional ideal, you
can just compute it directly:

sage: I.variety(ring=AA)
[{x: [1.0000000000000000 .. 1.0000000000000000], y:
[1.0000000000000000 .. 1.0000000000000000]}]

(This functionality is new in Sage 2.10.3.)

All of these techniques work great for fairly small examples, but get
very very slow for larger examples.  If you're actually interested in
larger examples, you may be better off with Marshall Hampton's
suggestion of phcpack.

Carl
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to