public double patience(int k,F f,int N){
  double pf=p(f);
  BinomialDistribution dist=new BinomialDistribution(null,N,pf);
  double p0=Math.pow(1 - pf,N);
  return 1 - (dist.cumulativeProbability(k - 1) - p0) / (1 - p0);
}

public double patience ( int k , F f , int N ) { double pf = p ( f ) ; BinomialDistribution dist = new BinomialDistribution ( null , N , pf ) ; double p0 = Math . pow ( 1 - pf , N ) ; return 1 - ( dist . cumulativeProbability ( k - 1 ) - p0 ) / ( 1 - p0 ) ; }
return the patience , i . e . , the penalization of having a number of items with the same feature in a recommendation list of a given size .
