Program to find the length of Latus Rectum of a Parabola | Function to calculate distance between two points ; Calculating distance ; Function to calculate length of the latus rectum of a parabola ; Stores the co - ordinates of the vertex of the parabola ; Stores the co - ordinates of the focus of parabola ; Print the distance between focus and vertex ; Given a , b & c ; Function call
function distance ( x1 , y1 , x2 , y2 ) { return Math . sqrt ( ( x2 - x1 ) * ( x2 - x1 ) + ( y2 - y1 ) * ( y2 - y1 ) ) ; } function lengthOfLatusRectum ( a , b , c ) { let vertex = [ ( - b / ( 2 * a ) ) , ( ( ( 4 * a * c ) - ( b * b ) ) / ( 4 * a ) ) ] ; let focus = [ ( - b / ( 2 * a ) ) , ( ( ( 4 * a * c ) - ( b * b ) + 1 ) / ( 4 * a ) ) ] ; document . write ( ( 4 * distance ( focus [ 0 ] , focus [ 1 ] , vertex [ 0 ] , vertex [ 1 ] ) ) . toFixed ( 6 ) ) ; } let a = 3 , b = 5 , c = 1 ; lengthOfLatusRectum ( a , b , c ) ;