Compute the poisson distribution PDF with an offset of + 1
<p>
pdf(x_plus_1 - 1, lambda)

@param x_plus_1 x+1
@param lambda Lambda
@return pdf
518482
public static double poissonPDFm1(double x_plus_1, double lambda) {
    if(Double.isInfinite(lambda)) {
      return 0.;
    }
    if(x_plus_1 > 1) {
      return rawProbability(x_plus_1 - 1, lambda);
    }
    if(lambda > Math.abs(x_plus_1 - 1) * MathUtil.LOG2 * Double.MAX_EXPONENT / 1e-14) {
      return FastMath.exp(-lambda - GammaDistribution.logGamma(x_plus_1));
    }
    else {
      return rawProbability(x_plus_1, lambda) * (x_plus_1 / lambda);
    }
  }
726500
public SDVariable randomExponential(double lambda, SDVariable shape) {
        return new RandomExponential(sameDiff(), shape, lambda).outputVariable();
    }
853294
public double calculateDistance2(DoubleSolution individual, double[] lambda) {

    double distance;
    double distanceSum = 0.0;

    double[] vecInd = new double[problem.getNumberOfObjectives()];
    double[] normalizedObj = new double[problem.getNumberOfObjectives()];

    for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
      distanceSum += individual.getObjective(i);
    }
    for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
      normalizedObj[i] = individual.getObjective(i) / distanceSum;
    }
    for (int i = 0; i < problem.getNumberOfObjectives(); i++) {
      vecInd[i] = normalizedObj[i] - lambda[i];
    }

    distance = norm_vector(vecInd);

    return distance;
  }
1043887
public double Function1D(double x) {
        double frequency = initFrequency;
        double amplitude = initAmplitude;
        double sum = 0;

        // octaves
        for (int i = 0; i < octaves; i++) {
            sum += SmoothedNoise(x * frequency) * amplitude;

            frequency *= 2;
            amplitude *= persistence;
        }
        return sum;
    }
147411
@Override
    public double getValue(IntDoubleVector params) {
        double sum = params.dot(params);
        sum *= 1./2. * lambda;
        return - sum;
    }
779069
protected double P(DataPoint x)
    {
        /**
         *              F(x)
         *             e
         * p(x) = ---------------
         *         F(x)    - F(x)
         *        e     + e
         */
        double fx = F(x);
        double efx = Math.exp(fx);
        double enfx = Math.exp(-fx);
        if(Double.isInfinite(efx) && efx > 0 && enfx < 1e-15)//Well classified point could return a Infinity which turns into NaN
            return 1.0;
        return efx/(efx + enfx);
    }
375271
public static DoubleBinding log1p(final ObservableDoubleValue x) {
        return createDoubleBinding(() -> Math.log1p(x.get()), x);
    }
897467
@Override
  public double getDensity(double[] p) {
    if(trans != null) {
      p = trans.applyInverse(p);
    }

    double density = densitycorrection;
    for(int i = 0; i < dim; i++) {
      density *= axes.get(i).pdf(p[i]);
    }
    return density;
  }
477909
public static double pdf(double x, double k, double theta) {
    if(x < 0) {
      return 0.;
    }
    if(x == 0) {
      return (k == 1.) ? theta : 0;
    }
    if(k == 1.) {
      return FastMath.exp(-x * theta) * theta;
    }
    final double xt = x * theta;
    return (xt == Double.POSITIVE_INFINITY) ? 0. : //
        FastMath.exp((k - 1.0) * FastMath.log(xt) - xt - logGamma(k)) * theta;
  }
1216618
@Pure
	public static Point2d WSG84_L2(double lambda, double phi) {
		final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
		return NTFLambdaPhi_NTFLambert(
				ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
				LAMBERT_2_N,
				LAMBERT_2_C,
				LAMBERT_2_XS,
				LAMBERT_2_YS);
	}
635035
public static double pdf(double x, double k, double theta, double shift) {
    x = (x - shift);
    return x <= 0. ? 0. : FastMath.pow(theta, k) / GammaDistribution.gamma(k) * FastMath.pow(1 + x, -(theta + 1.)) * FastMath.pow(FastMath.log1p(x), k - 1.);
  }
809467
public static <E> Distribution<E> laplaceSmoothedDistribution(Counter<E> counter, int numberOfKeys, double lambda) {
    Distribution<E> norm = new Distribution<E>();
    norm.counter = new ClassicCounter<E>();
    double total = counter.totalCount();
    double newTotal = total + (lambda * numberOfKeys);
    double reservedMass = ((double) numberOfKeys - counter.size()) * lambda / newTotal;
    if (verbose) {
      System.err.println(((double) numberOfKeys - counter.size()) + " * " + lambda + " / (" + total + " + ( " + lambda + " * " + (double) numberOfKeys + ") )");
    }
    norm.numberOfKeys = numberOfKeys;
    norm.reservedMass = reservedMass;
    if (verbose) {
      System.err.println("reserved mass=" + reservedMass);
    }
    for (E key : counter.keySet()) {
      double count = counter.getCount(key);
      norm.counter.setCount(key, (count + lambda) / newTotal);
    }
    if (verbose) {
      System.err.println("unseenKeys=" + (norm.numberOfKeys - norm.counter.size()) + " seenKeys=" + norm.counter.size() + " reservedMass=" + norm.reservedMass);
      System.err.println("0 count prob: " + lambda / newTotal);
      System.err.println("1 count prob: " + (1.0 + lambda) / newTotal);
      System.err.println("2 count prob: " + (2.0 + lambda) / newTotal);
      System.err.println("3 count prob: " + (3.0 + lambda) / newTotal);
    }
    return norm;
  }
1150709
public static double pdf(double x, double k, double theta, double shift) {
    if(x == Double.POSITIVE_INFINITY || x == Double.NEGATIVE_INFINITY) {
      return 0.;
    }
    if(x != x) {
      return Double.NaN;
    }
    x = (x - shift) * theta;
    final double ex = FastMath.exp(x);
    return ex < Double.POSITIVE_INFINITY ? FastMath.exp(k * x - ex - GammaDistribution.logGamma(k)) * theta : 0.;
  }
637025
def poisson_ll_2(p1, p2):
    
    p1_1 = p1 + eps
    p2_1 = p2 + eps
    return np.sum(-p2_1 + p1_1*np.log(p2_1))
383796
public double inverseCumulativeDistribution(double x) {
		double p = Math.exp(-lambda);
		double dp = p;
		int k = 0;
		while(x > p) {
			k++;
			dp *= lambda / k;
			p += dp;
		}
		return k;
	}
1220831
public static double pdf(double x, double mu, double beta) {
    final double z = (x - mu) / beta;
    if(x == Double.NEGATIVE_INFINITY) {
      return 0.;
    }
    return FastMath.exp(-z - FastMath.exp(-z)) / beta;
  }
1347903
public static double Function1D(double x, double mean, double amplitude, double position, double width, double phase, double frequency) {
        double envelope = mean + amplitude * Math.exp(-Math.pow((x - position), 2) / Math.pow((2 * width), 2));
        double carry = Math.cos(2 * Math.PI * frequency * (x - position) + phase);
        return envelope * carry;
    }