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.Thu, 29 Aug 2013 20:32:34 +0200Plot a circle, by utilizing an equation solved for xhttps://ask.sagemath.org/question/10483/plot-a-circle-by-utilizing-an-equation-solved-for-x/The following code is an example of plotting the equation: x = y^2-3*x-5*y+7, i.e. an equation solved for x:
var('y')
f = y^2-3*x-5*y+7
Yax = x
Xax = y
p1= implicit_plot(f, (x,-4, 4), (y,-2, 6))
p3= implicit_plot(Yax, (x,-4, 4), (y,-2, 6),color='black')
p4= implicit_plot(Xax, (x,-4, 4), (y,-2, 6),color='black')
p0= p1+p3+p4
show(p0)
According to the author, he solved the following equation in terms of x: x^2+y^2 = 25
He got the following: x = sqrt(25 - y^25) and x = -sqrt(25-y^2), i.e. ± sqrt(25 - y^25).
According to him, he plotted the 2 separate results to obtain a circle plot/graph.
How can I generate such an output on Sage 5.9?
The following was my best attempt, but I received no output for the plot of: sqrt(25-y^2):
var('y')
f = sqrt(25-y^2)
Yax = x
Xax = y
p1= implicit_plot(f, (x,-50, 50), (y,-50, 50))
p3= implicit_plot(Yax, (x,-50, 50), (y,-50, 50), color='black')
p4= implicit_plot(Xax, (x,-50, 50), (y,-50, 50), color='black')
p0= p1+p3+p4
show(p0)Thu, 29 Aug 2013 00:40:07 +0200https://ask.sagemath.org/question/10483/plot-a-circle-by-utilizing-an-equation-solved-for-x/Answer by Luca for <p>The following code is an example of plotting the equation: x = y^2-3<em>x-5</em>y+7, i.e. an equation solved for x:</p>
<pre><code>var('y')
f = y^2-3*x-5*y+7
Yax = x
Xax = y
p1= implicit_plot(f, (x,-4, 4), (y,-2, 6))
p3= implicit_plot(Yax, (x,-4, 4), (y,-2, 6),color='black')
p4= implicit_plot(Xax, (x,-4, 4), (y,-2, 6),color='black')
p0= p1+p3+p4
show(p0)
</code></pre>
<p>According to the author, he solved the following equation in terms of x: x^2+y^2 = 25
He got the following: x = sqrt(25 - y^25) and x = -sqrt(25-y^2), i.e. ± sqrt(25 - y^25).</p>
<p>According to him, he plotted the 2 separate results to obtain a circle plot/graph.</p>
<p>How can I generate such an output on Sage 5.9?</p>
<p>The following was my best attempt, but I received no output for the plot of: sqrt(25-y^2):</p>
<pre><code>var('y')
f = sqrt(25-y^2)
Yax = x
Xax = y
p1= implicit_plot(f, (x,-50, 50), (y,-50, 50))
p3= implicit_plot(Yax, (x,-50, 50), (y,-50, 50), color='black')
p4= implicit_plot(Xax, (x,-50, 50), (y,-50, 50), color='black')
p0= p1+p3+p4
show(p0)
</code></pre>
https://ask.sagemath.org/question/10483/plot-a-circle-by-utilizing-an-equation-solved-for-x/?answer=15390#post-id-15390I do not fully understand your question, but if it is the circle of equation $x^2 + y^2 = 25$ that you want to plot, then just replace the second line with
f = 25 - y^2 -x^2
Thu, 29 Aug 2013 05:58:10 +0200https://ask.sagemath.org/question/10483/plot-a-circle-by-utilizing-an-equation-solved-for-x/?answer=15390#post-id-15390Answer by calc314 for <p>The following code is an example of plotting the equation: x = y^2-3<em>x-5</em>y+7, i.e. an equation solved for x:</p>
<pre><code>var('y')
f = y^2-3*x-5*y+7
Yax = x
Xax = y
p1= implicit_plot(f, (x,-4, 4), (y,-2, 6))
p3= implicit_plot(Yax, (x,-4, 4), (y,-2, 6),color='black')
p4= implicit_plot(Xax, (x,-4, 4), (y,-2, 6),color='black')
p0= p1+p3+p4
show(p0)
</code></pre>
<p>According to the author, he solved the following equation in terms of x: x^2+y^2 = 25
He got the following: x = sqrt(25 - y^25) and x = -sqrt(25-y^2), i.e. ± sqrt(25 - y^25).</p>
<p>According to him, he plotted the 2 separate results to obtain a circle plot/graph.</p>
<p>How can I generate such an output on Sage 5.9?</p>
<p>The following was my best attempt, but I received no output for the plot of: sqrt(25-y^2):</p>
<pre><code>var('y')
f = sqrt(25-y^2)
Yax = x
Xax = y
p1= implicit_plot(f, (x,-50, 50), (y,-50, 50))
p3= implicit_plot(Yax, (x,-50, 50), (y,-50, 50), color='black')
p4= implicit_plot(Xax, (x,-50, 50), (y,-50, 50), color='black')
p0= p1+p3+p4
show(p0)
</code></pre>
https://ask.sagemath.org/question/10483/plot-a-circle-by-utilizing-an-equation-solved-for-x/?answer=15392#post-id-15392The following seems to be what you are describing.
var('y')
f=sqrt(25-y^2)
g=-sqrt(25-y^2)
plot([f,g],(y,-5,5),aspect_ratio=1)
Note that for numerical reasons, this will often not display well at $y=\pm 5$.
Thu, 29 Aug 2013 10:36:08 +0200https://ask.sagemath.org/question/10483/plot-a-circle-by-utilizing-an-equation-solved-for-x/?answer=15392#post-id-15392Comment by bxdin for <p>The following seems to be what you are describing.</p>
<pre><code>var('y')
f=sqrt(25-y^2)
g=-sqrt(25-y^2)
plot([f,g],(y,-5,5),aspect_ratio=1)
</code></pre>
<p>Note that for numerical reasons, this will often not display well at $y=\pm 5$.</p>
https://ask.sagemath.org/question/10483/plot-a-circle-by-utilizing-an-equation-solved-for-x/?comment=17103#post-id-17103Awesome, thanks.Thu, 29 Aug 2013 20:32:34 +0200https://ask.sagemath.org/question/10483/plot-a-circle-by-utilizing-an-equation-solved-for-x/?comment=17103#post-id-17103