package umontreal.iro.lecuyer.functions;
/**
* Represents the identity function f (x) = x.
*
*/
public class IdentityMathFunction implements MathFunction
,
MathFunctionWithFirstDerivative, MathFunctionWithDerivative,
MathFunctionWithIntegral {
public double evaluate (double x) {
return x;
}
public double derivative (double x) {
return 1;
}
public double derivative (double x, int n) {
return n > 1 ? 0 : 1;
}
public double integral (double a, double b) {
return (b*b - a*a) / 2;
}
}
Ads help maintain this website.