ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 21 Sep 2017 11:36:45 -0500how to plot a circle (without circle())http://ask.sagemath.org/question/38889/how-to-plot-a-circle-without-circle/ Hello,
I know you can plot a circle with circle(x,y,radius), but how do you do it with plot()?Wed, 20 Sep 2017 15:43:54 -0500http://ask.sagemath.org/question/38889/how-to-plot-a-circle-without-circle/Answer by slelievre for <p>Hello,
I know you can plot a circle with circle(x,y,radius), but how do you do it with plot()?</p>
http://ask.sagemath.org/question/38889/how-to-plot-a-circle-without-circle/?answer=38920#post-id-38920There are several ways you can use `plot` or similar functions.
- use `plot` with the circle as the graphics object you already discovered:
sage: plot(circle((0, 0), 2))
- express y as a function of x for two half-circles (this will miss part of the circle):
sage: p = plot(sqrt(4 - x^2), (-3, 3))
sage: q = plot(-sqrt(4 - x^2), (-3, 3))
sage: (p + q).show(aspect_ratio=1)
- use an implicit plot starting from an equation for the circle:
sage: x, y = SR.var("x y")
sage: implicit_plot(x^2 + y^2 - 4, (x, -3, 3), (y, -3, 3))
- use a parametric plot for the circle; here is one (there are many others):
sage: t = var('t')
sage: parametric_plot((2*cos(t), 2*sin(t)), (t, 0, 2*pi))
In this case I would recommend the parametric plot rather than the functions or the implicit plot.Thu, 21 Sep 2017 11:36:45 -0500http://ask.sagemath.org/question/38889/how-to-plot-a-circle-without-circle/?answer=38920#post-id-38920