本文整理汇总了Java中org.apache.commons.math3.util.FastMath.expm1方法的典型用法代码示例。如果您正苦于以下问题:Java FastMath.expm1方法的具体用法?Java FastMath.expm1怎么用?Java FastMath.expm1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.math3.util.FastMath
的用法示例。
在下文中一共展示了FastMath.expm1方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: cumulativeProbability
import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** {@inheritDoc} */
public double cumulativeProbability(int x) {
if (x < 0) {
return 0.0;
} else {
return -FastMath.expm1(log1mProbabilityOfSuccess * (x + 1));
}
}
示例2: helper2
import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
* Helper function to calculate {@code (exp(x)-1)/x}.
* <p>
* A Taylor series expansion is used, if x is close to 0.
*
* @param x free parameter
* @return {@code (exp(x)-1)/x} if x is non-zero, or 1 if x=0
*/
static double helper2(final double x) {
if (FastMath.abs(x)>1e-8) {
return FastMath.expm1(x)/x;
}
else {
return 1.+x*(1./2.)*(1.+x*(1./3.)*(1.+x*(1./4.)));
}
}
示例3: expm1
import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** Compute exp(x) - 1 of a derivative structure.
* @param operand array holding the operand
* @param operandOffset offset of the operand in its array
* @param result array where result must be stored (for
* exponential the result array <em>cannot</em> be the input
* array)
* @param resultOffset offset of the result in its array
*/
public void expm1(final double[] operand, final int operandOffset,
final double[] result, final int resultOffset) {
// create the function value and derivatives
double[] function = new double[1 + order];
function[0] = FastMath.expm1(operand[operandOffset]);
Arrays.fill(function, 1, 1 + order, FastMath.exp(operand[operandOffset]));
// apply function composition
compose(operand, operandOffset, function, result, resultOffset);
}
示例4: value
import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** {@inheritDoc} */
public double value(double x) {
return FastMath.expm1(x);
}
示例5: expm1
import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/** {@inheritDoc} */
public SparseGradient expm1() {
return new SparseGradient(FastMath.expm1(value), FastMath.exp(value), derivatives);
}
示例6: getNumericalVariance
import org.apache.commons.math3.util.FastMath; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*
* For scale {@code m} and shape {@code s}, the variance is
* {@code (exp(s^2) - 1) * exp(2 * m + s^2)}.
*/
public double getNumericalVariance() {
final double s = shape;
final double ss = s * s;
return (FastMath.expm1(ss)) * FastMath.exp(2 * scale + ss);
}