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.Sun, 04 Jul 2021 14:06:28 +0200Implicit_plot with degenerate conicshttps://ask.sagemath.org/question/57860/implicit_plot-with-degenerate-conics/I'm plotting some (possibly degenerate) conics via implicit_plot.
y = var('y')
implicit_plot((y*sqrt(sqrt(2) + 2) - x*sqrt(-sqrt(2) + 2))^2 == 0, (x,-2,2),(y,-2,2))
yields a blank plot for me. Yet this should be equivalent to
implicit_plot((y*sqrt(sqrt(2) + 2) - x*sqrt(-sqrt(2) + 2)) == 0, (x,-2,2),(y,-2,2))
which yields a line, as it should. On the other hand,
implicit_plot(x^2 == 0, (x,-2,2),(y,-2,2))
does give a vertical line. Why is this different? Is this a bug?
I'm running this on the cloud, using a free account on cocalc.com. Perhaps this has something to do with the problem?Sun, 04 Jul 2021 03:13:36 +0200https://ask.sagemath.org/question/57860/implicit_plot-with-degenerate-conics/Answer by slelievre for <p>I'm plotting some (possibly degenerate) conics via implicit_plot.</p>
<pre><code>y = var('y')
implicit_plot((y*sqrt(sqrt(2) + 2) - x*sqrt(-sqrt(2) + 2))^2 == 0, (x,-2,2),(y,-2,2))
</code></pre>
<p>yields a blank plot for me. Yet this should be equivalent to </p>
<pre><code>implicit_plot((y*sqrt(sqrt(2) + 2) - x*sqrt(-sqrt(2) + 2)) == 0, (x,-2,2),(y,-2,2))
</code></pre>
<p>which yields a line, as it should. On the other hand,</p>
<pre><code>implicit_plot(x^2 == 0, (x,-2,2),(y,-2,2))
</code></pre>
<p>does give a vertical line. Why is this different? Is this a bug?</p>
<p>I'm running this on the cloud, using a free account on http://cocalc.com. Perhaps this has something to do with the problem?</p>
https://ask.sagemath.org/question/57860/implicit_plot-with-degenerate-conics/?answer=57862#post-id-57862This has to do with how `implicit_plot` works.
In order to decide where the desired expression is zero,
it samples values of the expression on the desired rectangle,
and when there is a sign change, decides that it must be
zero in between.
That is why `implicit_plot` does not work when you take
the square of the expression, as the zero locus no longer
corresponds to a sign change.Sun, 04 Jul 2021 14:06:28 +0200https://ask.sagemath.org/question/57860/implicit_plot-with-degenerate-conics/?answer=57862#post-id-57862