ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 14 Jul 2011 16:39:10 -0500System of nonlinear equationshttps://ask.sagemath.org/question/8224/system-of-nonlinear-equations/Hello,
Is it possible to solve the following using Sage?
http://www.wolframalpha.com/input/?i=solve%28%5Bx1%2Bx2%2Bx3-6%3D%3D0%2Cx1*x2*x3-6%3D%3D0%2Cx1%5E2%2Bx2%5E2%2Bx3%5E2-14%3D%3D0%5D%2Cx1%29
Thanks in advance.Wed, 13 Jul 2011 16:40:44 -0500https://ask.sagemath.org/question/8224/system-of-nonlinear-equations/Answer by benjaminfjones for <p>Hello,</p>
<p>Is it possible to solve the following using Sage?</p>
<p><a href="http://www.wolframalpha.com/input/?i=solve([x1+x2+x3-6==0,x1">http://www.wolframalpha.com/input/?i=...</a><em>x2</em>x3-6%3D%3D0%2Cx1%5E2%2Bx2%5E2%2Bx3%5E2-14%3D%3D0%5D%2Cx1%29</p>
<p>Thanks in advance.</p>
https://ask.sagemath.org/question/8224/system-of-nonlinear-equations/?answer=12519#post-id-12519Yes, but not using `solve`.
Your system of equations defines a 0-dimensional subvariety of $\mathbb{C}^3$. Sage can tell you which points are in the zero set of the polynomials in your system like this:
sage: R.<x1,x2,x3> = PolynomialRing(QQ)
sage: R
Multivariate Polynomial Ring in x1, x2, x3 over Rational Field
sage: I=R.ideal([x1+x2+x3-6,x1*x2*x3-6,x1^2+x2^2+x3^2-14])
sage: I.dimension()
0
sage: I.variety()
[{x2: 2, x1: 3, x3: 1}, {x2: 3, x1: 2, x3: 1}, {x2: 1, x1: 3, x3: 2}, {x2: 3, x1: 1, x3: 2}, {x2: 1, x1: 2, x3: 3}, {x2: 2, x1: 1, x3: 3}]
The last line is a list of dictionaries. Each dictionary contains the coordinates of a point in the zero set of your system of polynomials.Wed, 13 Jul 2011 19:53:09 -0500https://ask.sagemath.org/question/8224/system-of-nonlinear-equations/?answer=12519#post-id-12519Comment by Eviatar Bach for <p>Yes, but not using <code>solve</code>. </p>
<p>Your system of equations defines a 0-dimensional subvariety of $\mathbb{C}^3$. Sage can tell you which points are in the zero set of the polynomials in your system like this:</p>
<pre><code>sage: R.<x1,x2,x3> = PolynomialRing(QQ)
sage: R
Multivariate Polynomial Ring in x1, x2, x3 over Rational Field
sage: I=R.ideal([x1+x2+x3-6,x1*x2*x3-6,x1^2+x2^2+x3^2-14])
sage: I.dimension()
0
sage: I.variety()
[{x2: 2, x1: 3, x3: 1}, {x2: 3, x1: 2, x3: 1}, {x2: 1, x1: 3, x3: 2}, {x2: 3, x1: 1, x3: 2}, {x2: 1, x1: 2, x3: 3}, {x2: 2, x1: 1, x3: 3}]
</code></pre>
<p>The last line is a list of dictionaries. Each dictionary contains the coordinates of a point in the zero set of your system of polynomials.</p>
https://ask.sagemath.org/question/8224/system-of-nonlinear-equations/?comment=21470#post-id-21470Thanks! This is very helpful.Thu, 14 Jul 2011 16:39:10 -0500https://ask.sagemath.org/question/8224/system-of-nonlinear-equations/?comment=21470#post-id-21470