Added "derivative".
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1185184 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5aaf1adc15
commit
9227754177
|
@ -18,6 +18,7 @@
|
|||
package org.apache.commons.math.analysis.function;
|
||||
|
||||
import org.apache.commons.math.analysis.UnivariateRealFunction;
|
||||
import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;
|
||||
import org.apache.commons.math.util.FastMath;
|
||||
|
||||
/**
|
||||
|
@ -26,9 +27,22 @@ import org.apache.commons.math.util.FastMath;
|
|||
* @version $Id$
|
||||
* @since 3.0
|
||||
*/
|
||||
public class Log10 implements UnivariateRealFunction {
|
||||
public class Log10 implements DifferentiableUnivariateRealFunction {
|
||||
/** ln(10) = {@value}.*/
|
||||
private static final double LN_10 = FastMath.log(10);
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public double value(double x) {
|
||||
return FastMath.log10(x);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public UnivariateRealFunction derivative() {
|
||||
return new UnivariateRealFunction() {
|
||||
/** {@inheritDoc} */
|
||||
public double value(double x) {
|
||||
return 1 / (x * LN_10);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue