Ask Your Question
0

Plot a circle, by utilizing an equation solved for x

asked 2013-08-29 00:40:07 +0100

bxdin gravatar image

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 flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
1

answered 2013-08-29 10:36:08 +0100

calc314 gravatar image

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

edit flag offensive delete link more

Comments

Awesome, thanks.

bxdin gravatar imagebxdin ( 2013-08-29 20:32:34 +0100 )edit
0

answered 2013-08-29 05:58:10 +0100

Luca gravatar image

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
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-08-29 00:40:07 +0100

Seen: 411 times

Last updated: Aug 29 '13