@Test public void testP() { System.out.println("p"); LogNormalDistribution instance = new LogNormalDistribution(1.0, 1.0); instance.rand(); assertEquals(6.006101e-06, instance.p(0.01), 1E-12); assertEquals(0.01707931, instance.p(0.1), 1E-7); assertEquals(0.2419707, instance.p(1.0), 1E-7); assertEquals(0.1902978, instance.p(2.0), 1E-7); assertEquals(0.06626564, instance.p(5.0), 1E-7); assertEquals(0.01707931, instance.p(10.0), 1E-7); }
@Override public double p(double x) { if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } if (x == 0.0) { return 0.0; } double t = (Math.log(x) - mu) / sigma; return (0.398942280401432678 / (sigma * x)) * Math.exp(-0.5 * t * t); }
LogNormalDistribution extends AbstractDistribution { @Override public double p(double x) { if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } if (x == 0.0) { return 0.0; } double t = (Math.log(x) - mu) / sigma; return (0.398942280401432678 / (sigma * x)) * Math.exp(-0.5 * t * t); } }
LogNormalDistribution extends AbstractDistribution { @Override public double p(double x) { if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } if (x == 0.0) { return 0.0; } double t = (Math.log(x) - mu) / sigma; return (0.398942280401432678 / (sigma * x)) * Math.exp(-0.5 * t * t); } LogNormalDistribution(double mu, double sigma); }
LogNormalDistribution extends AbstractDistribution { @Override public double p(double x) { if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } if (x == 0.0) { return 0.0; } double t = (Math.log(x) - mu) / sigma; return (0.398942280401432678 / (sigma * x)) * Math.exp(-0.5 * t * t); } LogNormalDistribution(double mu, double sigma); static LogNormalDistribution fit(double[] data); @Override int length(); @Override double mean(); @Override double variance(); @Override double entropy(); @Override String toString(); @Override double rand(); @Override double p(double x); @Override double logp(double x); @Override double cdf(double x); @Override double quantile(double p); }
LogNormalDistribution extends AbstractDistribution { @Override public double p(double x) { if (x < 0.0) { throw new IllegalArgumentException("Invalid x: " + x); } if (x == 0.0) { return 0.0; } double t = (Math.log(x) - mu) / sigma; return (0.398942280401432678 / (sigma * x)) * Math.exp(-0.5 * t * t); } LogNormalDistribution(double mu, double sigma); static LogNormalDistribution fit(double[] data); @Override int length(); @Override double mean(); @Override double variance(); @Override double entropy(); @Override String toString(); @Override double rand(); @Override double p(double x); @Override double logp(double x); @Override double cdf(double x); @Override double quantile(double p); final double mu; final double sigma; }