ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 26 May 2015 17:43:21 +0200Plotting an element in a polynomial idealhttps://ask.sagemath.org/question/26931/plotting-an-element-in-a-polynomial-ideal/I have a polynomial ring in three variables:
P.<x,y,z> = PolynomialRing(QQ)
and I've eliminated the variable `t` in an ideal generated by several polynomials to obtain an implicit function in just `x` and `y`. I'd like to plot this function. But the `plot` method, applied to an ideal in just two variables, produces the error:
ValueError: Variable 't' not found
So either I need somehow to introduce this variable into the plot, or pull the function out of the polynomial ring so that it can be plotted as a function of real variables with `implicit_plot`. But I'm not sure how to do either...any advice would be most helpful!Mon, 25 May 2015 03:57:20 +0200https://ask.sagemath.org/question/26931/plotting-an-element-in-a-polynomial-ideal/Answer by FrédéricC for <p>I have a polynomial ring in three variables:</p>
<pre><code>P.<x,y,z> = PolynomialRing(QQ)
</code></pre>
<p>and I've eliminated the variable <code>t</code> in an ideal generated by several polynomials to obtain an implicit function in just <code>x</code> and <code>y</code>. I'd like to plot this function. But the <code>plot</code> method, applied to an ideal in just two variables, produces the error: </p>
<pre><code>ValueError: Variable 't' not found
</code></pre>
<p>So either I need somehow to introduce this variable into the plot, or pull the function out of the polynomial ring so that it can be plotted as a function of real variables with <code>implicit_plot</code>. But I'm not sure how to do either...any advice would be most helpful!</p>
https://ask.sagemath.org/question/26931/plotting-an-element-in-a-polynomial-ideal/?answer=26932#post-id-26932Something like that
sage: P.<x,y,z> = PolynomialRing(QQ)
sage: I=P.ideal(x*x+y*y-1)
sage: implicit_plot(QQ['x,y'](I.gens()[0]),(x,-2,2),(y,-2,2))
maybe ?
Mon, 25 May 2015 08:34:11 +0200https://ask.sagemath.org/question/26931/plotting-an-element-in-a-polynomial-ideal/?answer=26932#post-id-26932Comment by FrédéricC for <p>Something like that</p>
<pre><code>sage: P.<x,y,z> = PolynomialRing(QQ)
sage: I=P.ideal(x*x+y*y-1)
sage: implicit_plot(QQ['x,y'](I.gens()[0]),(x,-2,2),(y,-2,2))
</code></pre>
<p>maybe ?</p>
https://ask.sagemath.org/question/26931/plotting-an-element-in-a-polynomial-ideal/?comment=26942#post-id-26942That's just a shortcut for PolynomialRing(QQ,['x','y']).Tue, 26 May 2015 17:43:21 +0200https://ask.sagemath.org/question/26931/plotting-an-element-in-a-polynomial-ideal/?comment=26942#post-id-26942Comment by Alasdair for <p>Something like that</p>
<pre><code>sage: P.<x,y,z> = PolynomialRing(QQ)
sage: I=P.ideal(x*x+y*y-1)
sage: implicit_plot(QQ['x,y'](I.gens()[0]),(x,-2,2),(y,-2,2))
</code></pre>
<p>maybe ?</p>
https://ask.sagemath.org/question/26931/plotting-an-element-in-a-polynomial-ideal/?comment=26939#post-id-26939That works! Many thanks. I don't think I've ever needed the `QQ[...]` syntax before, even though it's described in the documentation about univariate polynomial rings .Tue, 26 May 2015 11:00:35 +0200https://ask.sagemath.org/question/26931/plotting-an-element-in-a-polynomial-ideal/?comment=26939#post-id-26939