Hi Santanu,

On 16 Mai, 16:27, Santanu Sarkar <[email protected]> wrote:
> I have three polynomials
> f=x^2 + y^2 + z^2 - 1
> g= x^2+2*y*z
> h= (y+z+2*x)^2+2*x^2 -1.
>
> I want to find the common roots in  real.
> What should be approach in complex?

I was hoping that more competent people would answer first (I don't
usually compute solutions in RR or CC), but since your question almost
disappeared from the first screen, I'll try to give you at least two
partial answers.

If you have a system of polynomial equations then it makes sense to
compute a Gröbner basis with respect to a lexicographic term order
(the theory can be found in books on commutative algebra). Hence:
sage: P.<x,y,z> = PolynomialRing(QQ, order='lex')
sage: I = P*[x^2 + y^2 + z^2 - 1, x^2+2*y*z, (y+z+2*x)^2+2*x^2 -1]
sage: G = I.groebner_basis()
sage: G
[x - 108/13*z^5 + 150/13*z^3 - 42/13*z, y^2 + 144/13*z^6 - 252/13*z^4
+ 121/13*z^2 - 1, y*z + 72/13*z^6 - 126/13*z^4 + 54/13*z^2, z^7 -
5/3*z^5 + 25/36*z^3 - 1/36*z]

As you can see, you can solve the last polynomial for z, insert any
solution into the last but one polynomial and solve for y (for each
solution that you got for z), and so on.

And now comes the point were I am not sure if there are better ways to
tackle the problem. There is the `solve` command, and I would feed it
with the Gröbner basis. You also need to tell with respect to what
variables it shall be solved:

sage: solve(G,var('x y z'))
[[x == 0, y == 0, z == 1], [x == 0, y == 0, z == -1], [x ==
-1/3*sqrt(3), y == 1/6*sqrt(3) + 1/2, z == 1/6*sqrt(3) - 1/2], [x ==
1/3*sqrt(3), y == -1/6*sqrt(3) + 1/2, z == -1/6*sqrt(3) - 1/2], [x ==
-1/3*sqrt(3), y == 1/6*sqrt(3) - 1/2, z == 1/6*sqrt(3) + 1/2], [x ==
1/3*sqrt(3), y == -1/6*sqrt(3) - 1/2, z == -1/6*sqrt(3) + 1/2], [x ==
0, y == 1, z == 0], [x == 0, y == -1, z == 0]]

The same operation can be tried with your original list of
polynomials:
sage: solve(I.gens(),var('x y z'))
[[x == 0, y == -1, z == 0], [x == 1/3*sqrt(3), y == -1/6*sqrt(3) -
1/2, z == (1/(sqrt(3) + 3))], [x == -1/3*sqrt(3), y == 1/6*sqrt(3) -
1/2, z == -1/(sqrt(3) - 3)], [x == 0, y == 0, z == -1], [x == 0, y ==
0, z == 1], [x == 0, y == 1, z == 0], [x == 1/3*sqrt(3), y ==
-1/6*sqrt(3) + 1/2, z == (1/(sqrt(3) - 3))], [x == -1/3*sqrt(3), y ==
1/6*sqrt(3) + 1/2, z == -1/(sqrt(3) + 3)]]

Looks almost the same to me. Actually it could be that the Gröbner
basis computation is done internally.

Apparently, the solutions are given symbolically. But of course they
can be interpreted in CC or RR, depending on what complex or real
value you choose for sqrt(3).

Second answer:

By searching the reference manual for "numerical solution", I found
that the answer may be in the method `variety(...)` of ideals. See
http://www.sagemath.org/doc/reference/sage/rings/polynomial/multi_polynomial_ideal.html?highlight=numerical%20solution#sage.rings.polynomial.multi_polynomial_ideal.MPolynomialIdeal_singular_repr.variety

So:
sage: I.variety(RR)
[{y: 0.000000000000000, z: -1.00000000000000, x: 0.000000000000000},
{y: 0.211324865405187, z: -0.788675134594813, x: 0.577350269189626},
{y: 0.788675134594813, z: -0.211324865405187, x: -0.577350269189626},
{y: -1.00000000000000, z: 0.000000000000000, x: 0.000000000000000},
{y: 1.00000000000000, z: 0.000000000000000, x: 0.000000000000000}, {y:
-0.788675134594813, z: 0.211324865405187, x: 0.577350269189626}, {y:
-0.211324865405187, z: 0.788675134594813, x: -0.577350269189626}, {y:
0.000000000000000, z: 1.00000000000000, x: 0.000000000000000}]
sage: I.variety(CC)
[{y: 0, z: -1.00000000000000, x: 0}, {y: 0.211324865405187, z:
-0.788675134594813, x: 0.577350269189626}, {y: 0.788675134594813, z:
-0.211324865405187, x: -0.577350269189626}, {y: -1.00000000000000, z:
0, x: 0}, {y: 1.00000000000000, z: 0, x: 0}, {y: -0.788675134594813,
z: 0.211324865405187, x: 0.577350269189626}, {y: -0.211324865405187,
z: 0.788675134594813, x: -0.577350269189626}, {y: 0, z:
1.00000000000000, x: 0}]
sage: I.variety(QQ)
[{y: 0, z: -1, x: 0}, {y: -1, z: 0, x: 0}, {y: 1, z: 0, x: 0}, {y: 0,
z: 1, x: 0}]

All solutions seem are real. Well, that's the best I can do.

Cheers,
Simon

-- 
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
URL: http://www.sagemath.org

Reply via email to