Added "derivative".
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1184941 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9092e81cae
commit
6f81d04ef7
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
package org.apache.commons.math.analysis.function;
|
package org.apache.commons.math.analysis.function;
|
||||||
|
|
||||||
import org.apache.commons.math.analysis.UnivariateRealFunction;
|
import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Minus function.
|
* Minus function.
|
||||||
|
@ -25,9 +25,14 @@ import org.apache.commons.math.analysis.UnivariateRealFunction;
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public class Minus implements UnivariateRealFunction {
|
public class Minus implements DifferentiableUnivariateRealFunction {
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public double value(double x) {
|
public double value(double x) {
|
||||||
return -x;
|
return -x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
|
public DifferentiableUnivariateRealFunction derivative() {
|
||||||
|
return new Constant(-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue