def TR15(rv, max=4, pow=False):
 def f(rv):
  if (not (isinstance(rv, Pow) and (rv.base.func is sin))):
   return rv
  ia = (1 / rv)
  a = _TR56(ia, sin, cot, (lambda x: (1 + x)), max=max, pow=pow)
  if (a != ia):
   rv = a
  return rv
 return bottom_up(rv, f)

def TR15 ( rv , max = 4 , pow = False ) : def f ( rv ) : if ( not ( isinstance ( rv , Pow ) and ( rv . base . func is sin ) ) ) : return rv ia = ( 1 / rv ) a = _TR56 ( ia , sin , cot , ( lambda x : ( 1 + x ) ) , max = max , pow = pow ) if ( a != ia ) : rv = a return rv return bottom_up ( rv , f )
convert sin(x)*-2 to 1 + cot(x)**2 .