All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.finmath.functions.PoissonDistribution Maven / Gradle / Ivy

Go to download

finmath lib is a Mathematical Finance Library in Java. It provides algorithms and methodologies related to mathematical finance.

There is a newer version: 6.0.19
Show newest version
/*
 * (c) Copyright Christian P. Fries, Germany. Contact: [email protected].
 *
 * Created on 29.06.2014
 */

package net.finmath.functions;

/**
 * @author Christian Fries
 * @version 1.0
 */
public class PoissonDistribution {
	private final double lambda;

	public PoissonDistribution(final double lambda) {
		super();
		this.lambda = lambda;
	}

	/**
	 * Return the inverse cumulative distribution function at x.
	 *
	 * @param x Argument
	 * @return Inverse cumulative distribution function at x.
	 */
	public double inverseCumulativeDistribution(final double x) {
		double p = Math.exp(-lambda);
		double dp = p;
		int k = 0;
		while(x > p) {
			k++;
			dp *= lambda / k;
			p += dp;
		}
		return k;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy