# How to plot a parabola (conic): y²=4ax

I'm learning about conics, specifically parabolas, and I'd like to plot them. I already know how to do plot(x^2)), but what about y²=4ax ? I understand that representation is a relation, not a function, so that probably eliminates plot(f(x)). But, I'm stuck on how I might plot that so-called "general form" of a parabola.

Thanks!

edit retag close merge delete

Sort by » oldest newest most voted

You could try plotting it as two functions but implicit_plot is the natural choice. The documentation is here. This simple code illustrates how it could be done, given a specific value of a:

x, y = var('x,y')
a=1.1
implicit_plot(y^2==4*a*x, (x,-2,10), (y,-8,8))


Note the double equal signs. You can run the code in any Sage Cell Server, such as here, to check the result. Plotting it as two functions:

a=1.1
A = plot(2*sqrt(a*x), (x, -2, 10))
B = plot(-2*sqrt(a*x), (x, -2, 10))
(A+B).show()


and with a little complaining Sage plots over values that avoids problems with the domain.

more