Ask Your Question

Revision history [back]

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