def rad_rationalize(num, den):
 if (not den.is_Add):
  return (num, den)
 (g, a, b) = split_surds(den)
 a = (a * sqrt(g))
 num = _mexpand(((a - b) * num))
 den = _mexpand(((a ** 2) - (b ** 2)))
 return rad_rationalize(num, den)

def rad_rationalize ( num , den ) : if ( not den . is_Add ) : return ( num , den ) ( g , a , b ) = split_surds ( den ) a = ( a * sqrt ( g ) ) num = _mexpand ( ( ( a - b ) * num ) ) den = _mexpand ( ( ( a ** 2 ) - ( b ** 2 ) ) ) return rad_rationalize ( num , den )
rationalize num/den by removing square roots in the denominator; num and den are sum of terms whose squares are rationals examples .