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:com.ushahidi.android.app.BackgroundService.java

private void showNotification(String tickerText) {

    // This is what should be launched if the user selects our notification.
    Intent baseIntent = new Intent(this, IncidentTab.class);
    baseIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, baseIntent, 0);

    // choose the ticker text
    newUshahidiReportNotification = new Notification(R.drawable.notification_icon, tickerText,
            System.currentTimeMillis());
    newUshahidiReportNotification.contentIntent = contentIntent;
    newUshahidiReportNotification.flags = Notification.FLAG_AUTO_CANCEL;
    newUshahidiReportNotification.defaults = Notification.DEFAULT_ALL;
    newUshahidiReportNotification.setLatestEventInfo(this, TAG, tickerText, contentIntent);

    if (Preferences.ringtone) {
        // set the ringer
        Uri ringURI = Uri.fromFile(new File("/system/media/audio/ringtones/ringer.mp3"));
        newUshahidiReportNotification.sound = ringURI;
    }/*from  w  w  w . ja va  2 s  . c  o  m*/

    if (Preferences.vibrate) {
        double vibrateLength = 100 * Math.exp(0.53 * 20);
        long[] vibrate = new long[] { 100, 100, (long) vibrateLength };
        newUshahidiReportNotification.vibrate = vibrate;

        if (Preferences.flashLed) {
            int color = Color.BLUE;
            newUshahidiReportNotification.ledARGB = color;
        }

        newUshahidiReportNotification.ledOffMS = (int) vibrateLength;
        newUshahidiReportNotification.ledOnMS = (int) vibrateLength;
        newUshahidiReportNotification.flags = newUshahidiReportNotification.flags
                | Notification.FLAG_SHOW_LIGHTS;
    }

    mNotificationManager.notify(Preferences.NOTIFICATION_ID, newUshahidiReportNotification);
}

From source file:com.wwidesigner.util.PhysicalParameters.java

/** Set the physical parameters of the air in the instrument,
 * from specified properties./*from w  ww . j a  va  2s  . co m*/
 * @param temperature - air temperature, in Celsius
 * @param pressure - air pressure, in kPa
 * @param relHumidity - relative humidity, in percent of saturation humidity
 * @param xCO2 - molar fraction of CO2, in mol/mol
 */
public void setProperties(double temperature, double pressure, double relHumidity, double xCO2) {
    mTemperature = temperature;
    mPressure = pressure;
    mHumidity = relHumidity;
    m_xCO2 = xCO2;
    double kelvin = 273.15 + mTemperature;
    double pascal = 1000.0 * pressure;

    // Enhancement factor, from CIPM 2007.
    double enhancement = 1.00062 + 3.14e-5 * pressure + 5.6e-7 * mTemperature * mTemperature;
    // Saturated vapour pressure, in kPa, from CIPM-2007.
    double Psv = 0.001 * Math
            .exp(1.2378847e-5 * kelvin * kelvin - 1.9121316e-2 * kelvin + 33.93711047 - 6.3431645e3 / kelvin);
    // Molar fraction of water vapour, n_v/n_total, in mol/mol, using CIPM-2007.
    m_xv = 0.01 * relHumidity * enhancement * Psv / pressure;
    // Compressibility factor, from CIPM-2007,
    double compressibility = (1.0
            - pascal / kelvin
                    * (1.58123e-6 - 2.9331e-8 * mTemperature + 1.1043e-10 * mTemperature * mTemperature
                            + (5.707e-6 - 2.051e-8 * mTemperature) * m_xv
                            + (1.9898e-4 - 2.376e-6 * mTemperature) * m_xv * m_xv)
            + (pascal / kelvin) * (pascal / kelvin) * (1.83e-11 - 0.765e-8 * m_xv * m_xv));
    // Standard molar mass of dry air, in kg/kmol.
    double Ma = Ma0 + (Mco2 - Mo2) * xCO2;
    // Standard molar mass of moist air, in kg/kmol.
    double M = (1.0 - m_xv) * Ma + m_xv * Mv;
    // Specific gas constant of humid air, in J/(kg*K).
    double Ra = R / (0.001 * M);
    // Specific humidity, or mass fraction of water vapour, in kg(water)/kg(total).
    double qv = m_xv * Mv / M;
    // Mass fraction of CO2, in kg(CO2)/kg(total).
    double qco2 = xCO2 * Mco2 / M;

    mRho = pressure * 1e3 / (compressibility * Ra * kelvin);

    // Dynamic viscosity, in kg/(m.s) or Pa.s.

    // Dynamic viscosity of dry air, using Sutherland's formula,
    // from McQuillan, et al., 1984 (Reid, 1966).
    double etaAir = 1.4592e-6 * Math.pow(kelvin, 1.5) / (kelvin + 109.10);
    // Dynamic viscosity of water vapour in air,
    // linear regression line from Tsilingiris, 2007, corrected for magnitude.
    double etaVapour = 8.058131868e-6 + mTemperature * 4.000549451e-8;
    double etaRatio = Math.sqrt(etaAir / etaVapour);
    double humidityRatio = m_xv / (1.0 - m_xv);
    double phiAV = 0.5 * Math.pow(1.0 + etaRatio * Math.pow(Mv / Ma, 0.25), 2.0)
            / Math.sqrt(2.0 * (1.0 + (Ma / Mv)));
    double phiVA = 0.5 * Math.pow(1.0 + Math.pow(Ma / Mv, 0.25) / etaRatio, 2.0)
            / Math.sqrt(2.0 * (1.0 + (Mv / Ma)));
    mEta = etaAir / (1.0 + phiAV * humidityRatio) + humidityRatio * etaVapour / (humidityRatio + phiVA);

    // Isobaric specific heat, cp, in J/(kg.K).

    // Isobaric specific heat of air and water vapour, from Tsilingiris, 2007,
    // with specific heat of air reduced by 2 J/kg.K to get gamma correct.
    double cpAir = 1032.0
            + kelvin * (-0.284887 + kelvin * (0.7816818e-3 + kelvin * (-0.4970786e-6 + kelvin * 0.1077024e-9)));
    double cpVapour = 1869.10989 + mTemperature * (-0.2578421578 + mTemperature * 1.941058941e-2);
    // Isobaric specific heat of CO2, curve fit on available data.
    double cpCO2 = 817.02 + mTemperature * (1.0562 - mTemperature * 6.67e-4);
    mSpecificHeat = cpAir * (1 - qv - qco2) + cpVapour * qv + cpCO2 * qco2;
    // Ratio of specific heats cp/cv.
    mGamma = mSpecificHeat / (mSpecificHeat - Ra);

    // Thermal conductivity, in W/(m.K).

    // Thermal conductivity of dry air, using Sutherland's formula, from McQuillan, et al., 1984.
    double kappaAir = 2.3340e-3 * Math.pow(kelvin, 1.5) / (kelvin + 164.54);
    // Thermal conductivity of water vapour, from Tsirilingis, 2007.
    double kappaVapour = 0.01761758242 + mTemperature * (5.558941059e-5 + mTemperature * 1.663336663e-7);
    mKappa = kappaAir / (1.0 + phiAV * humidityRatio) + humidityRatio * kappaVapour / (humidityRatio + phiVA);

    // Prandtl number
    mPrandtl = mEta * mSpecificHeat / mKappa;

    mSpeedOfSound = Math.sqrt(mGamma * compressibility * Ra * kelvin);

    mEpsilonConstant = 1.0 / (2.0 * Math.sqrt(Math.PI)) * Math.sqrt(mEta / mRho)
            * (1.0 + (mGamma - 1.0) / Math.sqrt(mPrandtl));
    mAlphaConstant = Math.sqrt(mEta / (2.0 * mRho * mSpeedOfSound))
            * (1.0 + (mGamma - 1.0) / Math.sqrt(mPrandtl));

    mWaveNumber1 = 2.0 * Math.PI / mSpeedOfSound;
}

From source file:jsat.distributions.empirical.KernelDensityEstimatorButla.java

public KernelDensityEstimatorButla(Vec dataPoints, KDEFormelVariant formelVariant, double bandwidth,
        double minSearchStep, double minSearchAccuracy) {

    // TODO check

    this.dataPoints = dataPoints.sortedCopy();
    this.X = dataPoints.arrayCopy();
    this.minSearchStep = minSearchStep;
    this.minSearchAccuracy = minSearchAccuracy;
    this.kdeFormelVariant = formelVariant;

    if (Precision.equals(bandwidth, 0)) {
        bandwidth = MyKernelDensityEstimator.BandwithGuassEstimate(dataPoints);
        this.minSearchStep = bandwidth / 4.0;
    }//from ww w  .  j a va  2 s . c o m

    if (this.minSearchStep < 0.0001) {
        this.minSearchStep = 0.25d;
    }

    if (formelVariant == KDEFormelVariant.OriginalKDE) {

        final MyKernelDensityEstimator kernelDensity = new MyKernelDensityEstimator(dataPoints,
                GaussKF.getInstance(), bandwidth);
        kernelPdfFunction = ContinuousDistribution.getFunctionPDF(kernelDensity);
        kernelDerivationFunction = ContinuousDistribution.getFunctionPDF(
                new MyKernelDensityEstimator(dataPoints, GaussKFDerivation.getInstance(), bandwidth));

        startX = kernelDensity.min() + bandwidth;
        endX = kernelDensity.max() - bandwidth;

    } else if (formelVariant == KDEFormelVariant.OriginalButlaVariableBandwidth) {

        kernelPdfFunction = new Function() {

            private static final long serialVersionUID = 337703545623146489L;

            @Override
            public double f(Vec x) {
                return f(new double[] { x.get(0) });
            }

            @Override
            public double f(double... x) {

                final double t = x[0];
                double sum = 0.0d;

                final double maxH = Math.pow(X[X.length - 1] * 0.05, 2);
                int from = Arrays.binarySearch(X, t - maxH * 13);
                int to = Arrays.binarySearch(X, t + maxH * 13);
                from = from < 0 ? -from - 1 : from;
                to = to < 0 ? -to - 1 : to;

                for (int i = Math.max(0, from); i < Math.min(X.length, to + 1); i++) {
                    final double ti = dataPoints.get(i);
                    if (!Precision.equals(ti, 0)) {
                        sum += Math.exp(-Math.pow(t - ti, 2) / (2 * 0.05 * ti))
                                / (Math.sqrt(2.0 * Math.PI) * 0.05 * ti);
                    }
                }

                return sum / dataPoints.length();
            }
        };

        kernelDerivationFunction = new Function() {
            private static final long serialVersionUID = 1896912471233540595L;

            @Override
            public double f(Vec x) {
                return f(new double[] { x.get(0) });
            }

            @Override
            public double f(double... x) {

                final double t = x[0];
                double sum = 0.0d;

                final double maxH = Math.pow(X[X.length - 1] * 0.05, 2);
                int from = Arrays.binarySearch(X, t - maxH * 13);
                int to = Arrays.binarySearch(X, t + maxH * 13);
                from = from < 0 ? -from - 1 : from;
                to = to < 0 ? -to - 1 : to;

                for (int i = Math.max(0, from); i < Math.min(X.length, to + 1); i++) {
                    final double ti = dataPoints.get(i);
                    if (!Precision.equals(ti, 0)) {
                        sum += (-79.7885 * Math.exp(-10 * Math.pow(t - ti, 2) / ti)
                                * (Math.pow(ti, 2) + 0.1 * ti - Math.pow(t, 2))) / Math.pow(ti, 3);
                    }
                }

                return sum / dataPoints.length();
            }
        };

        startX = Math.max(dataPoints.get(0), 1.0);
        endX = dataPoints.get(dataPoints.length() - 1);

    } else if (formelVariant == KDEFormelVariant.ButlaBandwidthNotSquared) {

        kernelPdfFunction = new Function() {
            private static final long serialVersionUID = -8200289641116502672L;

            @Override
            public double f(Vec x) {
                return f(new double[] { x.get(0) });
            }

            @Override
            public double f(double... x) {

                final double t = x[0];
                double sum = 0.0d;

                final double maxH = Math.pow(X[X.length - 1] * 0.05, 2);
                int from = Arrays.binarySearch(X, t - maxH * 13);
                int to = Arrays.binarySearch(X, t + maxH * 13);
                from = from < 0 ? -from - 1 : from;
                to = to < 0 ? -to - 1 : to;

                for (int i = Math.max(0, from); i < Math.min(X.length, to + 1); i++) {
                    final double ti = X[i];
                    if (!Precision.equals(ti, 0)) {
                        sum += Math.exp(-Math.pow(t - ti, 2) / (2 * Math.pow(0.05 * ti, 2)))
                                / (Math.sqrt(2.0 * Math.PI) * 0.05 * ti);
                    }
                }

                return sum / dataPoints.length();
            }
        };

        kernelDerivationFunction = new Function() {
            private static final long serialVersionUID = -2561020473687438986L;

            @Override
            public double f(Vec x) {
                return f(new double[] { x.get(0) });
            }

            @Override
            public double f(double... x) {

                final double t = x[0];
                double sum = 0.0d;

                final double maxH = Math.pow(X[X.length - 1] * 0.05, 2);
                int from = Arrays.binarySearch(X, t - maxH * 13);
                int to = Arrays.binarySearch(X, t + maxH * 13);
                from = from < 0 ? -from - 1 : from;
                to = to < 0 ? -to - 1 : to;

                for (int i = Math.max(0, from); i < Math.min(X.length, to + 1); i++) {
                    final double ti = dataPoints.get(i);
                    if (!Precision.equals(ti, 0)) {
                        sum += ((-7.97885 * Math.pow(ti, 2) - 3191.54 * ti * t + 3191.54 * Math.pow(t, 2))
                                * Math.exp(-200 * Math.pow(t - ti, 2) / Math.pow(ti, 2))) / Math.pow(ti, 4);
                    }
                }

                return sum / dataPoints.length();
            }
        };

        startX = Math.max(dataPoints.get(0), 1.0);
        endX = dataPoints.get(dataPoints.length() - 1);

    } else if (formelVariant == KDEFormelVariant.ButlaBandwidthSquared) {

        kernelPdfFunction = new Function() {
            private static final long serialVersionUID = 6749547413109881687L;

            @Override
            public double f(Vec x) {
                return f(new double[] { x.get(0) });
            }

            @Override
            public double f(double... x) {

                final double t = x[0];
                double sum = 0.0d;

                final double maxH = X[X.length - 1] * 0.05;
                int from = Arrays.binarySearch(X, t - maxH * 13);
                int to = Arrays.binarySearch(X, t + maxH * 13);
                from = from < 0 ? -from - 1 : from;
                to = to < 0 ? -to - 1 : to;

                for (int i = Math.max(0, from); i < Math.min(X.length, to + 1); i++) {
                    final double ti = dataPoints.get(i);
                    if (!Precision.equals(ti, 0)) {
                        sum += Math.exp(-Math.pow(t - ti, 2) / (2 * 0.05 * ti))
                                / (Math.sqrt(2.0 * Math.PI * 0.05 * ti));
                    }
                }

                return sum / dataPoints.length();
            }
        };

        kernelDerivationFunction = new Function() {
            private static final long serialVersionUID = 3612595828189571262L;

            @Override
            public double f(Vec x) {
                return f(new double[] { x.get(0) });
            }

            @Override
            public double f(double... x) {

                final double t = x[0];
                double sum = 0.0d;

                final double maxH = X[X.length - 1] * 0.05;
                int from = Arrays.binarySearch(X, t - maxH * 13);
                int to = Arrays.binarySearch(X, t + maxH * 13);
                from = from < 0 ? -from - 1 : from;
                to = to < 0 ? -to - 1 : to;

                for (int i = Math.max(0, from); i < Math.min(X.length, to + 1); i++) {
                    final double ti = dataPoints.get(i);
                    if (!Precision.equals(ti, 0)) {
                        sum += (Math.exp(-10 * Math.pow(t - ti, 2) / ti)
                                * (-17.8412 * Math.pow(ti, 2) - 0.892062 * ti + 17.8412 * Math.pow(t, 2)))
                                / Math.sqrt(Math.pow(ti, 5));
                    }
                }

                return sum / dataPoints.length();
            }
        };

        startX = Math.max(dataPoints.get(0), 1.0);
        endX = dataPoints.get(dataPoints.length() - 1);
    }
}

From source file:Randoms.java

public synchronized double oldNextGamma(int ia) {
    int j;/*from ww w  .j ava 2  s  . c  om*/
    double am, e, s, v1, v2, x, y;

    assert (ia >= 1);
    if (ia < 6) {
        x = 1.0;
        for (j = 1; j <= ia; j++)
            x *= nextUniform();
        x = -Math.log(x);
    } else {
        do {
            do {
                do {
                    v1 = 2.0 * nextUniform() - 1.0;
                    v2 = 2.0 * nextUniform() - 1.0;
                } while (v1 * v1 + v2 * v2 > 1.0);
                y = v2 / v1;
                am = ia - 1;
                s = Math.sqrt(2.0 * am + 1.0);
                x = s * y + am;
            } while (x <= 0.0);
            e = (1.0 + y * y) * Math.exp(am * Math.log(x / am) - s * y);
        } while (nextUniform() > e);
    }
    return x;
}

From source file:com.opengamma.analytics.financial.model.option.pricing.tree.BinomialOptionModel.java

@Override
public Function1D<T, RecombiningBinomialTree<DoublesPair>> getTreeGeneratingFunction(
        final OptionDefinition definition) {
    return new Function1D<T, RecombiningBinomialTree<DoublesPair>>() {

        @SuppressWarnings({ "synthetic-access" })
        @Override/* w  ww .j  a v  a2  s. c  o  m*/
        public RecombiningBinomialTree<DoublesPair> evaluate(final T data) {
            final DoublesPair[] tempResults = new DoublesPair[_j];
            final DoublesPair[][] spotAndOptionPrices = new DoublesPair[_maxDepthToSave + 1][_maxWidthToSave];
            final OptionPayoffFunction<T> payoffFunction = definition.getPayoffFunction();
            final OptionExerciseFunction<T> exerciseFunction = definition.getExerciseFunction();
            final double u = _model.getUpFactor(definition, data, _n, _j);
            final double d = _model.getDownFactor(definition, data, _n, _j);
            final RecombiningBinomialTree<Double> pTree = _model.getUpProbabilityTree(definition, data, _n, _j);
            final double spot = data.getSpot();
            final double t = definition.getTimeToExpiry(data.getDate());
            final double r = data.getInterestRate(t);
            double newSpot = spot * Math.pow(d, _n);
            for (int i = 0; i < _j; i++) {
                tempResults[i] = DoublesPair.of(newSpot,
                        payoffFunction.getPayoff((T) data.withSpot(newSpot), 0.));
                if (_n == _maxDepthToSave) {
                    spotAndOptionPrices[_n][i] = tempResults[i];
                }
                newSpot *= u / d;
            }
            final double df = Math.exp(-r * t / _n);
            double optionValue, spotValue;
            T newData;
            double p;
            for (int i = _n - 1; i >= 0; i--) {
                for (int j = 0; j < RecombiningBinomialTree.NODES.evaluate(i); j++) {
                    p = pTree.getNode(i, j);
                    optionValue = df * ((1 - p) * tempResults[j].second + p * tempResults[j + 1].second);
                    spotValue = tempResults[j].first / d;
                    newData = (T) data.withSpot(spotValue);
                    tempResults[j] = DoublesPair.of(spotValue,
                            exerciseFunction.shouldExercise(newData, optionValue)
                                    ? payoffFunction.getPayoff(newData, optionValue)
                                    : optionValue);
                    if (i <= _maxDepthToSave) {
                        spotAndOptionPrices[i][j] = tempResults[j];
                    }
                }
            }
            return new RecombiningBinomialTree<>(spotAndOptionPrices);
        }
    };
}

From source file:com.datumbox.framework.core.statistics.distributions.ContinuousDistributions.java

/**
 * Calculates the probability from 0 to X under Exponential Distribution
 * //  w  w w  .  ja  v a  2s .com
 * @param x
 * @param lamda
 * @return
 */
public static double exponentialCdf(double x, double lamda) {
    if (x < 0 || lamda <= 0) {
        throw new IllegalArgumentException("All the parameters must be positive.");
    }

    double probability = 1.0 - Math.exp(-lamda * x);

    return probability;
}

From source file:com.ushahidi.android.app.UshahidiService.java

private void showNotification(String tickerText) {

    // This is what should be launched if the user selects our notification.
    Intent baseIntent = new Intent(this, IncidentsTab.class);
    baseIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, baseIntent, 0);

    // choose the ticker text
    newUshahidiReportNotification = new Notification(R.drawable.favicon, tickerText,
            System.currentTimeMillis());
    newUshahidiReportNotification.contentIntent = contentIntent;
    newUshahidiReportNotification.flags = Notification.FLAG_AUTO_CANCEL;
    newUshahidiReportNotification.defaults = Notification.DEFAULT_ALL;
    newUshahidiReportNotification.setLatestEventInfo(this, TAG, tickerText, contentIntent);

    if (UshahidiPref.ringtone) {
        // set the ringer
        Uri ringURI = Uri.fromFile(new File("/system/media/audio/ringtones/ringer.mp3"));
        newUshahidiReportNotification.sound = ringURI;
    }/*ww  w  .j  a va2 s  . co  m*/

    if (UshahidiPref.vibrate) {
        double vibrateLength = 100 * Math.exp(0.53 * 20);
        long[] vibrate = new long[] { 100, 100, (long) vibrateLength };
        newUshahidiReportNotification.vibrate = vibrate;

        if (UshahidiPref.flashLed) {
            int color = Color.BLUE;
            newUshahidiReportNotification.ledARGB = color;
        }

        newUshahidiReportNotification.ledOffMS = (int) vibrateLength;
        newUshahidiReportNotification.ledOnMS = (int) vibrateLength;
        newUshahidiReportNotification.flags = newUshahidiReportNotification.flags
                | Notification.FLAG_SHOW_LIGHTS;
    }

    mNotificationManager.notify(UshahidiPref.NOTIFICATION_ID, newUshahidiReportNotification);
}

From source file:lanchester.AthenaArena.java

public double getY(double t, double c11, double c22, double rAA, double rBB) {
    double res = -1.;
    res *= c11 * rBB * Math.exp(t * rAA * rBB) - c22 * rBB * Math.exp(-1 * t * rAA * rBB);
    return res;//from   w  ww .  j a v  a  2 s.c  o m
}

From source file:com.opengamma.analytics.financial.model.option.pricing.analytic.JuZhongModel.java

protected double getDerivative(final double k, final double r, final double b, final double t,
        final double sigma, final double phi, final double sEstimate) {
    final double df = Math.exp(t * (r - b));
    final double d1 = getD1(sEstimate, k, t, sigma, b);
    final double d2 = getD2(d1, sigma, t);
    return sEstimate * NORMAL.getPDF(d1) * sigma * df / (2 * r * Math.sqrt(t))
            - phi * b * sEstimate * NORMAL.getCDF(phi * d1) * df / r + phi * k * NORMAL.getCDF(phi * d2);
}

From source file:com.opengamma.analytics.financial.model.option.pricing.tree.LogNormalBinomialTreeBuilderTest.java

@Test
public void testPriceFlat() {
    final RecombiningBinomialTree<BinomialTreeNode<Double>> assetPriceTree = BUILDER.buildAssetTree(T, DATA,
            200);/*from  w  w  w .ja  va2  s . co m*/
    RecombiningBinomialTree<BinomialTreeNode<Double>> optionPriceTree = BUILDER.buildOptionPriceTree(OPTION,
            DATA, assetPriceTree);

    EuropeanVanillaOption o = new EuropeanVanillaOption(FORWARD, T, true);
    final BlackFunctionData data = new BlackFunctionData(FORWARD, YIELD_CURVE.getDiscountFactor(T), 0);
    double impVol = BLACK_IMPLIED_VOL.getImpliedVolatility(data, o, optionPriceTree.getNode(0, 0).getValue());

    //double impVol = BlackImpliedVolFormula.impliedVol(optionPriceTree.getNode(0, 0).getValue(), FORWARD, FORWARD, YIELD_CURVE.getDiscountFactor(T), T, true);
    assertEquals(ATM_VOL, impVol, 1e-3);
    for (int i = 0; i < 10; i++) {
        final double m = -1.5 + 3.0 * i / 10.0;
        final double strike = FORWARD * Math.exp(ATM_VOL * Math.sqrt(T) * m);
        final OptionDefinition option = new EuropeanVanillaOptionDefinition(strike, OPTION.getExpiry(),
                OPTION.isCall());
        optionPriceTree = BUILDER.buildOptionPriceTree(option, DATA, assetPriceTree);
        o = new EuropeanVanillaOption(strike, T, OPTION.isCall());
        optionPriceTree = BUILDER.buildOptionPriceTree(option, DATA, assetPriceTree);
        impVol = BLACK_IMPLIED_VOL.getImpliedVolatility(data, o, optionPriceTree.getNode(0, 0).getValue());
        //      impVol = BlackImpliedVolFormula.impliedVol(optionPriceTree.getNode(0, 0).getValue(), FORWARD, strike, YIELD_CURVE.getDiscountFactor(T), T, true);
        // System.out.println(strike+"\t"+impVol);
        assertEquals(ATM_VOL, impVol, 1e-3);
    }
}