This example obtains the Exponential probability density, gradient and Hessian values at a point.
import com.imsl.stat.distributions.ExponentialPD; public class ExponentialPDEx1 { public static void main(String[] args) { double x = 2.0 / (5.0 + 1.0); double scale = 3.0; ExponentialPD epd = new ExponentialPD(); double pdf = epd.pdf(x, scale); double[] gradient = epd.getPDFGradient(x, scale); double[][] hessian = epd.getPDFHessian(x, scale); System.out.printf("Probability density at %.3f with scale value of 3.0" + " = %.3f\n\n", x, pdf); System.out.printf("Probability density gradient at %.3f with scale" + " value of 3.0 = {%.3f}\n\n", x, gradient[0]); System.out.printf("Probability density Hessian at %.3f with scale" + " value of 3.0 = {{%.3f}}\n\n", x, hessian[0][0]); } }
Probability density at 0.333 with scale value of 3.0 = 1.104 Probability density gradient at 0.333 with scale value of 3.0 = {0.000} Probability density Hessian at 0.333 with scale value of 3.0 = {{-0.123}}Link to Java source.