def rs_trunc(p1, x, prec):
 R = p1.ring
 p = R.zero
 i = R.gens.index(x)
 for exp1 in p1:
  if (exp1[i] >= prec):
   continue
  p[exp1] = p1[exp1]
 return p

def rs_trunc ( p1 , x , prec ) : R = p1 . ring p = R . zero i = R . gens . index ( x ) for exp1 in p1 : if ( exp1 [ i ] >= prec ) : continue p [ exp1 ] = p1 [ exp1 ] return p
truncate the series in the x variable with precision prec .