Equation of a normal to a Circle from a given point | Function to calculate the slope ; Store the coordinates the center of the circle ; If slope becomes infinity ; Stores the slope ; If slope is zero ; Return the result ; Function to find the equation of the normal to a circle from a given point ; Stores the slope of the normal ; If slope becomes infinity ; If slope is zero ; Otherwise , print the equation of the normal ; Given Input ; Function Call
def normal_slope ( a , b , x1 , y1 ) : NEW_LINE INDENT g = a / 2 NEW_LINE f = b / 2 NEW_LINE if ( g - x1 == 0 ) : NEW_LINE INDENT return ( - 1 ) NEW_LINE DEDENT slope = ( f - y1 ) / ( g - x1 ) NEW_LINE if ( slope == 0 ) : NEW_LINE INDENT return ( - 2 ) NEW_LINE DEDENT return slope NEW_LINE DEDENT def normal_equation ( a , b , x1 , y1 ) : NEW_LINE INDENT slope = normal_slope ( a , b , x1 , y1 ) NEW_LINE if ( slope == - 1 ) : NEW_LINE INDENT print ( " x ▁ = ▁ " , x1 ) NEW_LINE DEDENT if ( slope == - 2 ) : NEW_LINE INDENT print ( " y ▁ = ▁ " , y1 ) NEW_LINE DEDENT if ( slope != - 1 and slope != - 2 ) : NEW_LINE INDENT x1 *= - slope NEW_LINE x1 += y1 NEW_LINE if ( x1 > 0 ) : NEW_LINE INDENT print ( " y ▁ = ▁ " , slope , " x ▁ + ▁ " , x1 ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " y ▁ = ▁ " , slope , " x ▁ " , x1 ) NEW_LINE DEDENT DEDENT DEDENT a = 4 NEW_LINE b = 6 NEW_LINE c = 5 NEW_LINE x1 = 12 NEW_LINE y1 = 14 NEW_LINE normal_equation ( a , b , x1 , y1 ) NEW_LINE