From 6f81d04ef7a359fccfa7592037d2ee8fb940a799 Mon Sep 17 00:00:00 2001 From: Gilles Sadowski Date: Sun, 16 Oct 2011 21:49:02 +0000 Subject: [PATCH] Added "derivative". git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1184941 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/math/analysis/function/Minus.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/apache/commons/math/analysis/function/Minus.java b/src/main/java/org/apache/commons/math/analysis/function/Minus.java index bb485b415..465ff195b 100644 --- a/src/main/java/org/apache/commons/math/analysis/function/Minus.java +++ b/src/main/java/org/apache/commons/math/analysis/function/Minus.java @@ -17,7 +17,7 @@ package org.apache.commons.math.analysis.function; -import org.apache.commons.math.analysis.UnivariateRealFunction; +import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction; /** * Minus function. @@ -25,9 +25,14 @@ import org.apache.commons.math.analysis.UnivariateRealFunction; * @version $Id$ * @since 3.0 */ -public class Minus implements UnivariateRealFunction { +public class Minus implements DifferentiableUnivariateRealFunction { /** {@inheritDoc} */ public double value(double x) { return -x; } + + /** {@inheritDoc} */ + public DifferentiableUnivariateRealFunction derivative() { + return new Constant(-1); + } }