# Plot a circle, by utilizing an equation solved for x

The following code is an example of plotting the equation: x = y^2-3x-5y+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)

edit retag close merge delete

Sort by » oldest newest most voted

The 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$.

more

I 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

more