Descartes ' Circle Theorem with implementation | Python 3 implementation of the above formulae ; Function to find the fourth circle 's when three radius are given ; Driver code ; Radius of three circles ; Calculation of r4 using formula given above
from math import sqrt NEW_LINE def findRadius ( r1 , r2 , r3 ) : NEW_LINE INDENT r4 = ( r1 * r2 * r3 ) / ( r1 * r2 + r2 * r3 + r1 * r3 + 2.0 * sqrt ( r1 * r2 * r3 * ( r1 + r2 + r3 ) ) ) NEW_LINE return r4 NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT r1 = 1 NEW_LINE r2 = 1 NEW_LINE r3 = 1 NEW_LINE r4 = findRadius ( r1 , r2 , r3 ) NEW_LINE print ( " The ▁ radius ▁ of ▁ fourth ▁ circle : " , r4 ) NEW_LINE DEDENT