Example usage for java.lang Math log

List of usage examples for java.lang Math log

Introduction

In this page you can find the example usage for java.lang Math log.

Prototype

@HotSpotIntrinsicCandidate
public static double log(double a) 

Source Link

Document

Returns the natural logarithm (base e) of a double value.

Usage

From source file:com.opengamma.analytics.financial.model.stochastic.BlackScholesGeometricBrownianMotionProcess.java

@Override
public Double getInitialValue(final T t, final U u) {
    return Math.log(u.getSpot());
}

From source file:com.uber.hoodie.common.BloomFilter.java

/**
 * Create a new Bloom filter with the given configurations.
 *//*from  w  w w. j a  v  a2 s .c o  m*/
public BloomFilter(int numEntries, double errorRate, int hashType) {
    // Bit size
    int bitSize = (int) Math.ceil(numEntries * (-Math.log(errorRate) / LOG2_SQUARED));
    // Number of the hash functions
    int numHashs = (int) Math.ceil(Math.log(2) * bitSize / numEntries);
    // The filter
    this.filter = new org.apache.hadoop.util.bloom.BloomFilter(bitSize, numHashs, hashType);
}

From source file:es.udc.gii.common.eaf.benchmark.constrained_real_param.g14.G14ObjectiveFunction.java

@Override
public double evaluate(double[] values) {

    double sum, fitness = 0.0;
    double[] norm_values;
    double[] c = { -6.089, -17.164, -34.054, -5.914, -24.721, -14.986, -24.1, -10.708, -26.662, -22.179 };

    norm_values = G14Function.normalize(values);
    sum = StatUtils.sum(norm_values);//  ww w  . j a v  a  2  s.c  o m
    for (int i = 0; i < 10; i++) {
        fitness += norm_values[i] * (c[i] + Math.log(norm_values[i] / sum));
    }
    return fitness;

}

From source file:org.wallerlab.yoink.density.service.densityProperties.SingleExponentialDecayDetectorComputer.java

/**
 * calculate SEDD of a denstiy point//from   w  ww . j  a  v  a  2 s  . c  o  m
 * 
 * @param densityPoint
 *            -{@link org.wallerlab.yoink.api.model.density.DensityPoint}
 * @param seddValue
 *            pre-calculated
 * @return seddValue final-calculated
 */
protected double getSilvaValue(DensityPoint densityPoint, double seddValue) {
    double density = densityPoint.getDensity();
    seddValue *= (4.0 / Math.pow(density, 8));
    seddValue = Math.log((1.0 + seddValue));
    return seddValue;
}

From source file:bide.prior.PriorBeta.java

public static double pdf(double x, double alpha, double beta) {
    double z = recomputeZ(alpha, beta);

    double logX = Math.log(x);
    double log1mX = Math.log1p(-x);
    return Math.exp((alpha - 1) * logX + (beta - 1) * log1mX - z);

}

From source file:com.opengamma.analytics.math.interpolation.ExponentialInterpolator1D.java

@Override
public double firstDerivative(final Interpolator1DDataBundle data, final Double value) {
    Validate.notNull(value, "value");
    Validate.notNull(data, "data bundle");
    final Double x1 = data.getLowerBoundKey(value);
    final Double y1 = data.get(x1);
    if (data.getLowerBoundIndex(value) == data.size() - 1) {
        return 0.;
    }//from   ww  w  .j  av a2s  .com
    final Double x2 = data.higherKey(x1);
    final Double y2 = data.get(x2);
    final double xDiff = x2 - x1;
    return Math.pow(y1, value * (x2 - value) / xDiff / x1) * Math.pow(y2, value * (value - x1) / xDiff / x2)
            * (Math.log(y1) * (x2 - 2. * value) / x1 + Math.log(y2) * (2. * value - x1) / x2) / xDiff;
}

From source file:gr.eap.LSHDB.HammingKey.java

@Override
public int optimizeL() {
    L = (int) Math.ceil(Math.log(delta) / Math.log(1 - Math.pow((1.0 - (t * 1.0 / this.size)), k)));
    return L;/*from w ww  .  jav a 2  s  .  co m*/
}

From source file:com.cloudera.oryx.rdf.common.information.Information.java

/**
 * @param counts counts of distinct categories in a sample
 * @return entropy, in nats, of those counts
 *///from  www. j a  v  a 2 s. com
public static double entropy(int[] counts) {
    // Entropy is really, over all counts:
    //  sum (-p_i * ln p_i)
    // where p_i = count_i / total
    // terms where count is 0 or 1 are 0, so can go away
    // Here we actually compute total as we go and account for it later, which avoids
    // a second loop and avoids some divisions.
    // This means we divide by total at the end to account for the missing denominator in the first p_i term,
    // and end up adding (subtracting negative) ln total at the end to account for ln p_i.
    double entropy = 0.0;
    int total = 0;
    for (int count : counts) {
        // if count = 0 or count = 1 then count*ln(count) = 0
        if (count > 1) {
            // This is in nats to match differential entropy -- base e, not 2
            entropy -= count * Math.log(count);
        }
        total += count;
    }
    return entropy / total + Math.log(total);
}

From source file:Methods.CalculusSecant.java

public static void secant2(double xold1, double xold2, double decPoint) {//method used calculate root point acording the paramethers that enter the method and store the data in a global Stack

    double xnew, fxold1, fxold2, fxnew, diff;
    int iteration = 0;
    S = new BidimensionalArrayStack();//Declaring a new Stack beeing sure is clear before using it
    Xold1 = new BidimensionalArrayStack();
    Xold2 = new BidimensionalArrayStack();

    do {//  w w w  . j a va 2 s .  c o m
        iteration += 1;
        // determine f(xold1) and f(xold2)
        fxold1 = (Math.log(xold1 + 1.0)) + 1.0;
        fxold2 = (Math.log(xold2 + 1.0)) + 1.0;
        Xold1.push(xold1, fxold1);//Inserting data in the Stack
        Xold2.push(xold2, fxold2);
        xnew = xold1 - (fxold1 * (xold1 - xold2)) / (fxold1 - fxold2);
        System.out.println("Approx for iteration{}" + iteration + " is " + xnew);
        diff = Math.abs(xnew - xold1);
        xold2 = xold1;
        xold1 = xnew;
        fxnew = (Math.log(xnew + 1.0)) + 1.0;
        S.push(xnew, fxnew);
    } while (diff > decPoint);
    System.out.println("root to six decimal places is " + xnew);

}

From source file:ch.unil.genescore.vegas.DistributionMethods.java

public static double normalCumulativeProbabilityUpperTailApprox(double q) {

    q = Math.abs(q);/*w  w w. ja v  a  2s  .c  o m*/
    double aa = -(q * q) / 2 - Math.log(q) - 0.5 * Math.log(2 * Math.PI);
    return (Math.exp(aa));
}