DoublesCurveNelsonSiegel extends DoublesCurve { @Override public Double getYValue(final Double x) { final double x1 = x / _parameters[3]; final double x2 = epsilon(-x1); return _parameters[0] + _parameters[1] * x2 + _parameters[2] * (x2 - Math.exp(-x1)); } 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 yValue() { final int nbPoint = 10; final double timeMax = 9.0; final double valueComputed0 = CURVE_NS.getYValue(0.0); final double valueExpected0 = BETA0 + BETA1; assertEquals("DoublesCurveNelsonSiegel: value", valueExpected0, valueComputed0, TOLERANCE_YIELD); for (int loopt = 1; loopt <= nbPoint; loopt++) { final double t = loopt * timeMax / nbPoint; final double valueComputed = CURVE_NS.getYValue(t); final double tl = t / LAMBDA; final double exptl = Math.exp(-tl); final double valueExpected = BETA0 + BETA1 * (1 - exptl) / tl + BETA2 * ((1 - exptl) / tl - exptl); assertEquals("DoublesCurveNelsonSiegel: value", valueExpected, valueComputed, TOLERANCE_YIELD); } }
@Test(enabled = false) public void analysis() { final int nbPoint = 50; final double timeMax = 20.0; final double[] value = new double[nbPoint + 1]; final double[] t = new double[nbPoint + 1]; for (int loopt = 0; loopt <= nbPoint; loopt++) { t[loopt] = loopt * timeMax / nbPoint; value[loopt] = CURVE_NS.getYValue(t[loopt]); } }