Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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)