DoublesCurveNelsonSiegel extends DoublesCurve { @Override public double getDyDx(final double x) { final double x1 = x / _parameters[3]; final double eP = epsilonP(-x1); return -(_parameters[1] * eP + _parameters[2] * (eP - Math.exp(-x1))) / _parameters[3]; } protected  DoublesCurveNelsonSiegel();  DoublesCurveNelsonSiegel(final String name, final double beta0, final double beta1, final double beta2, final double lambda);  DoublesCurveNelsonSiegel(final String name, final double[] parameters); @Override Double[] getXData(); @Override Double[] getYData(); @Override int size(); @Override Double getYValue(final Double x); @Override double getDyDx(final double x); @Override Double[] getYValueParameterSensitivity(final Double x); @Override boolean equals(final Object obj); @Override int hashCode(); static DoublesCurveNelsonSiegel.Meta meta(); @Override DoublesCurveNelsonSiegel.Meta metaBean(); final Property<double[]> parameters(); @Override DoublesCurveNelsonSiegel clone(); @Override String toString();  }
@Test public void testDerivative() { final Function1D<Double, Double> func = CURVE_NS.toFunction1D(); final ScalarFirstOrderDifferentiator diff = new ScalarFirstOrderDifferentiator(); final Function1D<Double, Double> grad = diff.differentiate(func); for (int i = 0; i < 50; i++) { final double t = 0 + 10.0 * i / 99.; final double fd = grad.evaluate(t); final double anal = CURVE_NS.getDyDx(t); assertEquals("t=" + t, fd, anal, 1e-12); } }