Example usage for java.lang Math exp

List of usage examples for java.lang Math exp

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public static double exp(double a) 

Source Link

Document

Returns Euler's number e raised to the power of a double value.

Usage

From source file:Main.java

public static double[] planckTaperWindow(int length, double e) {
    if (length < 1 || e <= 0 || e >= 0.5f) {
        return null;
    }// www. java2s .  com
    double[] planckTaperWindow = new double[length];
    Arrays.fill(planckTaperWindow, 1);
    planckTaperWindow[0] = 0;
    planckTaperWindow[length - 1] = 0;
    for (int i = 1; i < e * (length - 1); i++) {
        double za = e * (length - 1) * (1.0f / i + 1.0f / (i - e * (length - 1)));
        planckTaperWindow[i] = 1.0f / (Math.exp(za) + 1);
    }
    for (int i = (int) (1 - e) * (length - 1); i < length - 1; i++) {
        double zb = e * (length - 1) * (1.0f / (length - 1 + i) + 1.0f / ((1 - e) * (length - 1) * (i)));
        planckTaperWindow[i] = 1.0f / (Math.exp(zb) + 1);
    }
    return planckTaperWindow;
}

From source file:Util.java

public static double sigmod(double beta) {
    return (double) 1.0 / (1.0 + Math.exp(-beta));
}

From source file:Main.java

public static float exp(float a) {
    return (float) Math.exp(a);
}

From source file:Main.java

private static void findConstants(double[] n_p, double[] n_m, double[] d_p, double[] d_m, double[] bd_p,
        double[] bd_m, double std_dev) {
    double div = Math.sqrt(2 * 3.141593) * std_dev;
    double x0 = -1.783 / std_dev;
    double x1 = -1.723 / std_dev;
    double x2 = 0.6318 / std_dev;
    double x3 = 1.997 / std_dev;
    double x4 = 1.6803 / div;
    double x5 = 3.735 / div;
    double x6 = -0.6803 / div;
    double x7 = -0.2598 / div;
    int i;/*from ww w  .  j a va2s .co  m*/

    n_p[0] = x4 + x6;
    n_p[1] = (Math.exp(x1) * (x7 * Math.sin(x3) - (x6 + 2 * x4) * Math.cos(x3))
            + Math.exp(x0) * (x5 * Math.sin(x2) - (2 * x6 + x4) * Math.cos(x2)));
    n_p[2] = (2 * Math.exp(x0 + x1) * ((x4 + x6) * Math.cos(x3) * Math.cos(x2)
            - x5 * Math.cos(x3) * Math.sin(x2) - x7 * Math.cos(x2) * Math.sin(x3)) + x6 * Math.exp(2 * x0)
            + x4 * Math.exp(2 * x1));
    n_p[3] = (Math.exp(x1 + 2 * x0) * (x7 * Math.sin(x3) - x6 * Math.cos(x3))
            + Math.exp(x0 + 2 * x1) * (x5 * Math.sin(x2) - x4 * Math.cos(x2)));
    n_p[4] = 0.0;

    d_p[0] = 0.0;
    d_p[1] = -2 * Math.exp(x1) * Math.cos(x3) - 2 * Math.exp(x0) * Math.cos(x2);
    d_p[2] = 4 * Math.cos(x3) * Math.cos(x2) * Math.exp(x0 + x1) + Math.exp(2 * x1) + Math.exp(2 * x0);
    d_p[3] = -2 * Math.cos(x2) * Math.exp(x0 + 2 * x1) - 2 * Math.cos(x3) * Math.exp(x1 + 2 * x0);
    d_p[4] = Math.exp(2 * x0 + 2 * x1);

    for (i = 0; i <= 4; i++) {
        d_m[i] = d_p[i];
    }

    n_m[0] = 0.0;
    for (i = 1; i <= 4; i++) {
        n_m[i] = n_p[i] - d_p[i] * n_p[0];
    }

    double sum_n_p, sum_n_m, sum_d;
    double a, b;

    sum_n_p = 0.0;
    sum_n_m = 0.0;
    sum_d = 0.0;

    for (i = 0; i <= 4; i++) {
        sum_n_p += n_p[i];
        sum_n_m += n_m[i];
        sum_d += d_p[i];
    }

    a = sum_n_p / (1.0 + sum_d);
    b = sum_n_m / (1.0 + sum_d);

    for (i = 0; i <= 4; i++) {
        bd_p[i] = d_p[i] * a;
        bd_m[i] = d_m[i] * b;
    }
}

From source file:Util.java

public static double factorial(int n) {
    return Math.exp(logGamma(n + 1));
}

From source file:Util.java

public static double gamma(double x) {
    return Math.exp(logGamma(x));
}

From source file:Util.java

public static double beta(double a, double b) {
    return Math.exp(logBeta(a, b));
}

From source file:Main.java

static public final float exp(float a) {
    return (float) Math.exp(a);
}

From source file:Main.java

static public float getVaporPressure(float tempCelsius) {
    // Vapor pressure is in mb or hPa
    return (float) (6.1094 * Math.exp((17.625 * tempCelsius) / (tempCelsius + 243.04)));
}

From source file:Main.java

public static double cosh(double t) {
    return (Math.exp(t) + Math.exp(-t)) / 2;
}