List of usage examples for java.lang Math exp
@HotSpotIntrinsicCandidate public static double exp(double a)
From source file:org.wallerlab.yoink.density.service.density.AtomDensityCalculator.java
/** * calculate the density of a point from an atom * /*from ww w. j a v a 2s . co m*/ * @param atom * -{@link org.wallerlab.yoink.api.model.molecular.Atom} * @param currentCoord * -{@link org.wallerlab.yoink.api.model.molecular.Coord} * @return the density of a point from an atom */ public Double calculate(Coord currentCoord, Atom atom) { double distance = distanceCalculator.calculate(currentCoord, atom); Element atomType = atom.getElementType(); double exp1 = Math.exp(-distance / atomType.z1()); double exp2 = Math.exp(-distance / atomType.z2()); double exp3 = Math.exp(-distance / atomType.z3()); double density = atomType.c1() * exp1 + atomType.c2() * exp2 + atomType.c3() * exp3; return density; }
From source file:emlab.util.GeometricTrendRegression.java
public double predict(double x) { return Math.exp(super.predict(x)); }
From source file:com.opengamma.analytics.financial.equity.future.pricing.EquityFutureDividendYield.java
/** * @param future EquityFuture derivative * @param dataBundle Contains funding curve, spot value and continuous dividend yield * @return Present value of the derivative *///from w w w . jav a 2s .com @Override public double presentValue(final EquityFuture future, final EquityFutureDataBundle dataBundle) { Validate.notNull(future, "Future"); Validate.notNull(dataBundle); Validate.notNull(dataBundle.getFundingCurve()); Validate.notNull(dataBundle.getSpotValue()); Validate.notNull(dataBundle.getDividendYield()); double timeToExpiry = future.getTimeToSettlement(); double discountRate = dataBundle.getFundingCurve().getInterestRate(timeToExpiry); double costOfCarry = Math.exp(timeToExpiry * (discountRate - dataBundle.getDividendYield())); double fwdPrice = dataBundle.getSpotValue() * costOfCarry; return (fwdPrice - future.getStrike()) * future.getUnitAmount(); }
From source file:de.biomedical_imaging.ij.steger.Convol.java
private double phi1(double x, double sigma) { double t;//ww w.j av a 2s.c o m t = x / sigma; return SQRT_2_PI_INV / sigma * Math.exp(-0.5 * t * t); }
From source file:com.github.tomakehurst.wiremock.http.LogNormal.java
@Override public long sampleMillis() { return Math.round(Math.exp(ThreadLocalRandom.current().nextGaussian() * sigma) * median); }
From source file:com.opengamma.analytics.financial.model.option.pricing.analytic.LogOptionModel.java
@Override public Function1D<StandardOptionDataBundle, Double> getPricingFunction(final LogOptionDefinition definition) { Validate.notNull(definition);/* w w w. ja v a 2s . c o m*/ final Function1D<StandardOptionDataBundle, Double> pricingFunction = new Function1D<StandardOptionDataBundle, Double>() { @SuppressWarnings("synthetic-access") @Override public Double evaluate(final StandardOptionDataBundle data) { Validate.notNull(data); final double s = data.getSpot(); final double k = definition.getStrike(); final double t = definition.getTimeToExpiry(data.getDate()); final double b = data.getCostOfCarry(); final double r = data.getInterestRate(t); final double sigma = data.getVolatility(t, k); final double df = Math.exp(-r * t); final double sigmaT = sigma * Math.sqrt(t); final double x = (Math.log(s / k) + t * (b - sigma * sigma * 0.5)) / sigmaT; return df * sigmaT * (_normalProbabilityDistribution.getPDF(x) + x * _normalProbabilityDistribution.getCDF(x)); } }; return pricingFunction; }
From source file:es.udc.gii.common.eaf.benchmark.multiobjective.fon.Fon_Objective_1.java
@Override public double evaluate(double[] values) { double[] x = new double[values.length]; double sum = 0; double k = 1 / Math.sqrt(values.length); for (int i = 0; i < values.length; i++) { x[i] = 4 * values[i];/*from ww w. j av a 2 s . c om*/ sum += (x[i] - k) * (x[i] - k); } return 1 - Math.exp(-sum); }
From source file:com.opengamma.analytics.financial.model.stochastic.BlackScholesGeometricBrownianMotionProcess.java
@Override public Double getFinalValue(final Double x) { return Math.exp(x); }
From source file:com.joliciel.talismane.machineLearning.GeometricMeanScoringStrategy.java
@Override public double calculateScore(ClassificationSolution<T> solution) { double score = 0; if (solution != null && solution.getDecisions().size() > 0) { for (Decision<?> decision : solution.getDecisions()) score += decision.getProbabilityLog(); score = score / solution.getDecisions().size(); }// w ww . j a v a 2 s . c o m score = Math.exp(score); if (LOG.isTraceEnabled()) { LOG.trace("Score for solution: " + solution.getClass().getSimpleName()); LOG.trace(solution.toString()); StringBuilder sb = new StringBuilder(); for (Decision<?> decision : solution.getDecisions()) { sb.append(" * "); sb.append(decision.getProbability()); } sb.append(" root "); sb.append(solution.getDecisions().size()); sb.append(" = "); sb.append(score); LOG.trace(sb.toString()); } for (Solution underlyingSolution : solution.getUnderlyingSolutions()) { if (!underlyingSolution.getScoringStrategy().isAdditive()) score = score * underlyingSolution.getScore(); } if (LOG.isTraceEnabled()) { for (Solution underlyingSolution : solution.getUnderlyingSolutions()) { if (!underlyingSolution.getScoringStrategy().isAdditive()) LOG.trace(" * " + underlyingSolution.getScore() + " (" + underlyingSolution.getClass().getSimpleName() + ")"); } LOG.trace(" = " + score); } return score; }
From source file:bots.mctsbot.ai.bots.util.Gaussian.java
public final static double smallPhi(double x) { return 1.0 / Math.sqrt(2 * Math.PI) * Math.exp(-x * x / 2.0); }