Find the vertex, focus, and directrix of a parabola in python

Share on facebook
Share on twitter
Share on pinterest

In this python program, we will have a look at how to find the vertex, focus and directrix of a parabola in the Python programming language.

Python Program To Find the vertex, focus, and directrix of a parabola

 
def parabola(x, y, z):
    print ("Vertex: (" , (-y / (2 * x)) , ", "
        ,(((4 * x * z) - (y * y)) / (4 * x)) , ")" )
          
    print ("Focus: (" , (-y / (2 * x)) , ", "
        , (((4 * x * z) - (y * y) + 1) / (4 * x)) , ")" )
      
    print ("Directrix: y="
            , (int)(z - ((y * y) + 1) * 4 * x )) 
x = 6
y = 4
z = 3

parabola(x, y, z) 

Output:

Vertex: ( -0.3333333333333333 ,  2.3333333333333335 )
Focus: ( -0.3333333333333333 ,  2.375 )
Directrix: y= -405

Subscribe to our Newsletter

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Share this post with your friends

Share on facebook
Share on google
Share on twitter
Share on linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *