def rs_cos_sin(p, x, prec):
 if rs_is_puiseux(p, x):
  return rs_puiseux(rs_cos_sin, p, x, prec)
 t = rs_tan((p / 2), x, prec)
 t2 = rs_square(t, x, prec)
 p1 = rs_series_inversion((1 + t2), x, prec)
 return (rs_mul(p1, (1 - t2), x, prec), rs_mul(p1, (2 * t), x, prec))

def rs_cos_sin ( p , x , prec ) : if rs_is_puiseux ( p , x ) : return rs_puiseux ( rs_cos_sin , p , x , prec ) t = rs_tan ( ( p / 2 ) , x , prec ) t2 = rs_square ( t , x , prec ) p1 = rs_series_inversion ( ( 1 + t2 ) , x , prec ) return ( rs_mul ( p1 , ( 1 - t2 ) , x , prec ) , rs_mul ( p1 , ( 2 * t ) , x , prec ) )
return the tuple (rs_cos .