本文整理汇总了Java中org.apache.commons.math3.analysis.function.Log类的典型用法代码示例。如果您正苦于以下问题:Java Log类的具体用法?Java Log怎么用?Java Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Log类属于org.apache.commons.math3.analysis.function包,在下文中一共展示了Log类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testComposeDifferentiable
import org.apache.commons.math3.analysis.function.Log; //导入依赖的package包/类
@Test
public void testComposeDifferentiable() {
UnivariateDifferentiableFunction id = new Identity();
Assert.assertEquals(1, FunctionUtils.compose(id, id, id).value(new DerivativeStructure(1, 1, 0, 3)).getPartialDerivative(1), EPS);
UnivariateDifferentiableFunction c = new Constant(4);
Assert.assertEquals(0, FunctionUtils.compose(id, c).value(new DerivativeStructure(1, 1, 0, 3)).getPartialDerivative(1), EPS);
Assert.assertEquals(0, FunctionUtils.compose(c, id).value(new DerivativeStructure(1, 1, 0, 3)).getPartialDerivative(1), EPS);
UnivariateDifferentiableFunction m = new Minus();
Assert.assertEquals(-1, FunctionUtils.compose(m).value(new DerivativeStructure(1, 1, 0, 3)).getPartialDerivative(1), EPS);
Assert.assertEquals(1, FunctionUtils.compose(m, m).value(new DerivativeStructure(1, 1, 0, 3)).getPartialDerivative(1), EPS);
UnivariateDifferentiableFunction inv = new Inverse();
Assert.assertEquals(0.25, FunctionUtils.compose(inv, m, id).value(new DerivativeStructure(1, 1, 0, 2)).getPartialDerivative(1), EPS);
UnivariateDifferentiableFunction pow = new Power(2);
Assert.assertEquals(108, FunctionUtils.compose(pow, pow).value(new DerivativeStructure(1, 1, 0, 3)).getPartialDerivative(1), EPS);
UnivariateDifferentiableFunction log = new Log();
double a = 9876.54321;
Assert.assertEquals(pow.value(new DerivativeStructure(1, 1, 0, a)).getPartialDerivative(1) / pow.value(a),
FunctionUtils.compose(log, pow).value(new DerivativeStructure(1, 1, 0, a)).getPartialDerivative(1), EPS);
}
示例2: log
import org.apache.commons.math3.analysis.function.Log; //导入依赖的package包/类
public Variable log(Transform transform, Variable numericVariable, Map<String, TransformOption> options) throws Exception {
double[] rawData = numericVariable.getData();// check of <= 0
if (numericVariable.calculateUnivariateStats().get(UnivariateStat.getStats().get("min")).get(0)[0] <= 0) {
Transform scaleTransform = new Transform("scale", null, numericVariable, getStatLib());
numericVariable = scaleTransform.transform();
VariableDAO.getInstance().createVariableRow(numericVariable);
}
UnivariateDifferentiableFunction function = new Log();
double[] logData = new double[rawData.length];
for (int i = 0; i < rawData.length; i++) {
logData[i] = function.value(rawData[i]);
}
Instances weka = new Util().createWekaData(logData, transform.toString());
return new Variable(numericVariable, transform, transform.toString(), numericVariable.getLab(), logData, weka, numericVariable.getDateFormat(), VariableType.NUMERIC);
}
示例3: testInverse
import org.apache.commons.math3.analysis.function.Log; //导入依赖的package包/类
@Test
public void testInverse() {
final UnivariateFunction inv = new Inverse();
final UnivariateFunction log = new Log();
final double lo = 12.34;
final double hi = 456.78;
final GaussIntegrator integrator = factory.legendre(60, lo, hi);
final double s = integrator.integrate(inv);
final double expected = log.value(hi) - log.value(lo);
// System.out.println("s=" + s + " e=" + expected);
Assert.assertEquals(expected, s, 1e-14);
}
示例4: testInverse
import org.apache.commons.math3.analysis.function.Log; //导入依赖的package包/类
@Test
public void testInverse() {
final UnivariateFunction inv = new Inverse();
final UnivariateFunction log = new Log();
final double lo = 12.34;
final double hi = 456.78;
final GaussIntegrator integrator = factory.legendreHighPrecision(60, lo, hi);
final double s = integrator.integrate(inv);
final double expected = log.value(hi) - log.value(lo);
// System.out.println("s=" + s + " e=" + expected);
Assert.assertEquals(expected, s, 1e-15);
}
示例5: createFunctions
import org.apache.commons.math3.analysis.function.Log; //导入依赖的package包/类
protected UnivariateFunction[] createFunctions() {
return new UnivariateFunction[] {
new Power(2.0), new Exp(), new Expm1(), new Log(), new Log10(),
new Log1p(), new Cosh(), new Sinh(), new Tanh(), new Cos(),
new Sin(), new Tan(), new Acos(), new Asin(), new Atan(),
new Inverse(), new Abs(), new Sqrt(), new Cbrt(), new Ceil(),
new Floor(), new Rint(), new Signum(), new Ulp()
};
}
示例6: createFunctions
import org.apache.commons.math3.analysis.function.Log; //导入依赖的package包/类
private UnivariateFunction[] createFunctions() {
return new UnivariateFunction[] {
new Power(2.0), new Exp(), new Expm1(), new Log(), new Log10(),
new Log1p(), new Cosh(), new Sinh(), new Tanh(), new Cos(),
new Sin(), new Tan(), new Acos(), new Asin(), new Atan(),
new Inverse(), new Abs(), new Sqrt(), new Cbrt(), new Ceil(),
new Floor(), new Rint(), new Signum(), new Ulp()
};
}
示例7: getTestStatistic
import org.apache.commons.math3.analysis.function.Log; //导入依赖的package包/类
/**
* Get the Fisher test statistic X^2
* @return The test statistic
*/
public double getTestStatistic() {
Log log = new Log();
double rtrn = 0;
for(Double pval : individualPvals) {
rtrn += log.value(pval.doubleValue());
}
return -2 * rtrn;
}
示例8: calculateC
import org.apache.commons.math3.analysis.function.Log; //导入依赖的package包/类
/**
* Calculates c_n
* @param n
* @param epsilon
* @param beta
* @return
*/
private double calculateC(int n, double epsilon, double beta) {
double gamma = calculateGamma(epsilon, beta);
return (new Exp()).value(-1.0d * n * (gamma * (new Log()).value(gamma / beta) - (gamma - beta)));
}