/** * Raise a double to an int power. * * @param d Number to raise. * @param e Exponent. * @return d<sup>e</sup> * @since 3.1 */ public static double pow(double d, int e) { return pow(d, (long) e); }
/** {@inheritDoc} */ public double value(double x, double y) { return FastMath.pow(x, y); } }
/** {@inheritDoc} */ public double value(double x) { return FastMath.pow(x, p); }
/** * <p> * Returns a <code>double</code> whose value is * <tt>(this<sup>exponent</sup>)</tt>, returning the result in reduced form. * </p> * * @param exponent * exponent to which this <code>BigFraction</code> is to be raised. * @return <tt>this<sup>exponent</sup></tt>. */ public double pow(final double exponent) { return FastMath.pow(numerator.doubleValue(), exponent) / FastMath.pow(denominator.doubleValue(), exponent); }
/** {@inheritDoc} */ public double probability(int x) { double ret; if (x < 0) { ret = 0.0; } else { ret = CombinatoricsUtils.binomialCoefficientDouble(x + numberOfSuccesses - 1, numberOfSuccesses - 1) * FastMath.pow(probabilityOfSuccess, numberOfSuccesses) * FastMath.pow(1.0 - probabilityOfSuccess, x); } return ret; }
public static double pow(double base, double exponent) { double result = 1; if (exponent == 0) { return result; } if (exponent < 0) { return 1 / pow(base, exponent * -1); } return FastMath.pow(base, exponent); }
/** {@inheritDoc} */ @Override public double sample() { final double n = random.nextDouble(); return scale / FastMath.pow(n, 1 / shape); } }
/** {@inheritDoc} * @since 3.2 */ public Decimal64 pow(final Decimal64 e) { return new Decimal64(FastMath.pow(value, e.value)); }
/** {@inheritDoc} */ public double cumulativeProbability(double x) { double ret; if (x <= 0.0) { ret = 0.0; } else { ret = 1.0 - FastMath.exp(-FastMath.pow(x / scale, shape)); } return ret; }
/** {@inheritDoc} * @since 3.2 */ public Decimal64 pow(final double p) { return new Decimal64(FastMath.pow(value, p)); }
/** {@inheritDoc} * @since 3.2 */ public Decimal64 pow(final int n) { return new Decimal64(FastMath.pow(value, n)); }
/** {@inheritDoc} */ public double probability(final int x) { if (x <= 0 || x > numberOfElements) { return 0.0; } return (1.0 / FastMath.pow(x, exponent)) / generalizedHarmonic(numberOfElements, exponent); }
/** {@inheritDoc} */ public double density(double x) { if (x < 0) { return 0; } final double xscale = x / scale; final double xscalepow = FastMath.pow(xscale, shape - 1); /* * FastMath.pow(x / scale, shape) = * FastMath.pow(xscale, shape) = * FastMath.pow(xscale, shape - 1) * xscale */ final double xscalepowshape = xscalepow * xscale; return (shape / scale) * xscalepow * FastMath.exp(-xscalepowshape); }
/** {@inheritDoc} */ public double density(final double[] vals) throws DimensionMismatchException { final int dim = getDimension(); if (vals.length != dim) { throw new DimensionMismatchException(vals.length, dim); } return FastMath.pow(2 * FastMath.PI, -0.5 * dim) * FastMath.pow(covarianceMatrixDeterminant, -0.5) * getExponentTerm(vals); }
/** Compute step grow/shrink factor according to normalized error. * @param error normalized error of the current step * @return grow/shrink factor for next step */ protected double computeStepGrowShrinkFactor(final double error) { return FastMath.min(maxGrowth, FastMath.max(minReduction, safety * FastMath.pow(error, exp))); }
/** {@inheritDoc} */ public SparseGradient pow(final int n) { if (n == 0) { return getField().getOne(); } else { final double valueNm1 = FastMath.pow(value, n - 1); return new SparseGradient(value * valueNm1, n * valueNm1, derivatives); } }