Example usage for java.lang Math E

List of usage examples for java.lang Math E

Introduction

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

Prototype

double E

To view the source code for java.lang Math E.

Click Source Link

Document

The double value that is closer than any other to e, the base of the natural logarithms.

Usage

From source file:Main.java

public static void main(String[] argv) {

    System.out.println(Math.E);

}

From source file:MainClass.java

public static void main(String args[]) {
    System.out.println("E = " + Math.E);
}

From source file:MainClass.java

public static void main(String args[]) {
    System.out.printf("Math.abs( 23.7 ) = %f\n", Math.abs(23.7));
    System.out.printf("Math.abs( 0.0 ) = %f\n", Math.abs(0.0));
    System.out.printf("Math.abs( -23.7 ) = %f\n", Math.abs(-23.7));
    System.out.printf("Math.ceil( 9.2 ) = %f\n", Math.ceil(9.2));
    System.out.printf("Math.ceil( -9.8 ) = %f\n", Math.ceil(-9.8));
    System.out.printf("Math.cos( 0.0 ) = %f\n", Math.cos(0.0));
    System.out.printf("Math.exp( 1.0 ) = %f\n", Math.exp(1.0));
    System.out.printf("Math.exp( 2.0 ) = %f\n", Math.exp(2.0));
    System.out.printf("Math.floor( 9.2 ) = %f\n", Math.floor(9.2));
    System.out.printf("Math.floor( -9.8 ) = %f\n", Math.floor(-9.8));
    System.out.printf("Math.log( Math.E ) = %f\n", Math.log(Math.E));
    System.out.printf("Math.log( Math.E * Math.E ) = %f\n", Math.log(Math.E * Math.E));
    System.out.printf("Math.max( 2.3, 12.7 ) = %f\n", Math.max(2.3, 12.7));
    System.out.printf("Math.max( -2.3, -12.7 ) = %f\n", Math.max(-2.3, -12.7));
    System.out.printf("Math.min( 2.3, 12.7 ) = %f\n", Math.min(2.3, 12.7));
    System.out.printf("Math.min( -2.3, -12.7 ) = %f\n", Math.min(-2.3, -12.7));
    System.out.printf("Math.pow( 2.0, 7.0 ) = %f\n", Math.pow(2.0, 7.0));
    System.out.printf("Math.pow( 9.0, 0.5 ) = %f\n", Math.pow(9.0, 0.5));
    System.out.printf("Math.sin( 0.0 ) = %f\n", Math.sin(0.0));
    System.out.printf("Math.sqrt( 900.0 ) = %f\n", Math.sqrt(900.0));
    System.out.printf("Math.sqrt( 9.0 ) = %f\n", Math.sqrt(9.0));
    System.out.printf("Math.tan( 0.0 ) = %f\n", Math.tan(0.0));
}

From source file:ExponentialDemo.java

public static void main(String[] args) {
    double x = 11.635;
    double y = 2.76;

    System.out.printf("The value of e is %.4f%n", Math.E);
    System.out.printf("exp(%.3f) is %.3f%n", x, Math.exp(x));
    System.out.printf("log(%.3f) is %.3f%n", x, Math.log(x));
    System.out.printf("pow(%.3f, %.3f) is %.3f%n", x, y, Math.pow(x, y));
    System.out.printf("sqrt(%.3f) is %.3f%n", x, Math.sqrt(x));
}

From source file:ExponentialDemo.java

public static void main(String[] args) {
    double x = 11.635;
    double y = 2.76;

    System.out.println("The value of e is " + Math.E);
    System.out.println("exp(" + x + ") is " + Math.exp(x));
    System.out.println("log(" + x + ") is " + Math.log(x));
    System.out.println("pow(" + x + ", " + y + ") is " + Math.pow(x, y));
    System.out.println("sqrt(" + x + ") is " + Math.sqrt(x));
}

From source file:Main.java

/**************************************
 * Math relevant/*from   w w  w. j ava 2s  .  c  om*/
 *************************************/

public static double calculatePDFOfNormalDistribution(double mean, double std, double value) {
    double prob = Math.pow(Math.E, -Math.pow(value - mean, 2) / 2 / Math.pow(std, 2))
            / (Math.sqrt(Math.PI * 2) * std);
    if (prob > 1)
        System.out.println(mean + " " + std + " " + value);
    return prob;
}

From source file:edu.msu.cme.rdp.graph.sandbox.BloomFilterInterrogator.java

public static void printStats(BloomFilter filter, PrintStream out) {

    long n = filter.getUniqueKmers();
    long m = (long) Math.pow(2, filter.getHashSizeLog2());
    int k = filter.getHashCount();

    //(1-e^(-k*((n+.5)/(m-1))))^k
    double falsePositiveRate = Math.pow((1 - Math.pow(Math.E, -k * ((n + .5) / (m - 1)))), k);

    out.println("Bloom filter created on:       " + filter.getCreatedOn());
    out.println("Serializable id:               " + BloomFilter.serialVersionUID);
    out.println();/*w ww. j a va 2 s.  c o  m*/
    out.println("Bloom filter size log 2:       " + filter.getHashSizeLog2());
    out.println("Bloom filter size (bits) (m):  " + m);
    out.println();
    out.println("Number of bitsets:             " + filter.getNumBitsets());
    out.println("Bitset size (bits):            " + filter.getBitsetSize());
    out.println("Bitset size log2:              " + filter.getBitsetSizeLog2());
    out.println();
    out.println("Number of hashes (k):          " + filter.getHashCount());
    out.println("Hash function name:            " + filter.getHasherClassName());
    out.println();
    out.println("Bitset Mask:                   "
            + StringUtils.leftPad(Long.toBinaryString(filter.getBitsetMask()), 64, '0'));
    out.println("Hash mask:                     "
            + StringUtils.leftPad(Long.toBinaryString(filter.getHashMask()), 64, '0'));
    out.println();
    out.println("Kmer length:                   " + filter.getKmerSize());
    out.println();
    out.println("Total kmers in bloom filter:   " + filter.getTotalKmers());
    out.println("Total strings inserted:        " + filter.getTotalStrings());
    out.println("Total unique kmers:            " + filter.getUniqueKmers());
    out.println("Predicted false positive rate: " + falsePositiveRate);
}

From source file:edu.msu.cme.rdp.graph.utils.BloomFilterStats.java

public static void printStats(BloomFilter filter, PrintStream out) {

    long n = filter.getUniqueKmers();
    long m = (long) Math.pow(2, filter.getHashSizeLog2());
    int k = filter.getHashCount();

    //(1-e^(-k*((n+.5)/(m-1))))^k
    double falsePositiveRate = Math.pow((1 - Math.pow(Math.E, -k * ((n + .5) / (m - 1)))), k);

    out.println("Bloom filter created on:       " + filter.getCreatedOn());
    out.println("Serializable id:               " + BloomFilter.serialVersionUID);
    out.println();/*from  ww w  .  java  2  s.c om*/
    out.println("Bloom filter size log 2:       " + filter.getHashSizeLog2());
    out.println("Bloom filter size (bits) (m):  " + m);
    out.println();
    out.println("Number of bitsets:             " + filter.getNumBitsets());
    out.println("Bitset size (bits):            " + filter.getBitsetSize());
    out.println("Bitset size log2:              " + filter.getBitsetSizeLog2());
    out.println();
    out.println("Number of hashes (k):          " + filter.getHashCount());
    out.println("Hash function name:            " + filter.getHasherClassName());
    out.println();
    out.println("Bitset Mask:                   "
            + StringUtils.leftPad(Long.toBinaryString(filter.getBitsetMask()), 64, '0'));
    out.println("Hash mask:                     "
            + StringUtils.leftPad(Long.toBinaryString(filter.getHashMask()), 64, '0'));
    out.println();
    out.println("Kmer length:                   " + filter.getKmerSize());
    out.println();
    out.println("Total kmers in bloom filter:   " + filter.getTotalKmers());
    out.println("Total strings inserted:        " + filter.getTotalStrings());
    out.println("Total unique kmers:            " + filter.getUniqueKmers());
    if (filter.getSingltonKmers() > -1) {
        out.println("Total mercy kmers if set:      " + filter.getMercyKmers());
        out.println("Total singleton kmers:         " + filter.getSingltonKmers());
    }
    out.println("Predicted false positive rate: " + falsePositiveRate);
}

From source file:PriorityCompete.java

private void runWork() {
    Thread.yield();//from ww  w  .j a v a  2 s.c  o m

    while (noStopRequested) {
        if (yield) {
            Thread.yield();
        }

        count++;

        for (int i = 0; i < 1000; i++) {
            double x = i * Math.PI / Math.E;
        }
    }
}

From source file:org.apache.hadoop.hive.ql.udf.UDFE.java

public UDFE() {
    super();
    result.set(Math.E);
}