def rs_cot(p, x, prec):
 if rs_is_puiseux(p, x):
  r = rs_puiseux(rs_cot, p, x, prec)
  return r
 (i, m) = _check_series_var(p, x, 'cot')
 prec1 = (prec + (2 * m))
 (c, s) = rs_cos_sin(p, x, prec1)
 s = mul_xin(s, i, (- m))
 s = rs_series_inversion(s, x, prec1)
 res = rs_mul(c, s, x, prec1)
 res = mul_xin(res, i, (- m))
 res = rs_trunc(res, x, prec)
 return res

def rs_cot ( p , x , prec ) : if rs_is_puiseux ( p , x ) : r = rs_puiseux ( rs_cot , p , x , prec ) return r ( i , m ) = _check_series_var ( p , x , 'cot' ) prec1 = ( prec + ( 2 * m ) ) ( c , s ) = rs_cos_sin ( p , x , prec1 ) s = mul_xin ( s , i , ( - m ) ) s = rs_series_inversion ( s , x , prec1 ) res = rs_mul ( c , s , x , prec1 ) res = mul_xin ( res , i , ( - m ) ) res = rs_trunc ( res , x , prec ) return res
cotangent of a series return the series expansion of the cot of p .