### Question:
TrigeorgisLatticeSpecification implements LatticeSpecification { @Override public DoubleArray getParametersTrinomial(double volatility, double interestRate, double dt) { double volSq = volatility * volatility; double mu = interestRate - 0.5 * volSq; double mudt = mu * dt; double mudtSq = mudt * mudt; double dx = volatility * Math.sqrt(3d * dt); double upFactor = Math.exp(dx); double downFactor = Math.exp(-dx); double part = (volSq * dt + mudtSq) / dx / dx; double upProbability = 0.5 * (part + mudt / dx); double middleProbability = 1d - part; double downProbability = 0.5 * (part - mudt / dx); return DoubleArray.of(upFactor, 1d, downFactor, upProbability, middleProbability, downProbability); }  @Override DoubleArray getParametersTrinomial(double volatility, double interestRate, double dt);  }### Answer:
@Test public void test_formula() { TrigeorgisLatticeSpecification test = new TrigeorgisLatticeSpecification(); DoubleArray computed = test.getParametersTrinomial(VOL, RATE, DT); double dx = VOL * Math.sqrt(3d * DT); double nu = RATE - 0.5 * VOL * VOL; double u = Math.exp(dx); double d = Math.exp(-dx); double up = 0.5 * ((VOL * VOL * DT + nu * nu * DT * DT) / (dx * dx) + nu * DT / dx); double dm = 1d - (VOL * VOL * DT + nu * nu * DT * DT) / (dx * dx); double dp = 0.5 * ((VOL * VOL * DT + nu * nu * DT * DT) / (dx * dx) - nu * DT / dx); DoubleArray expected = DoubleArray.of(u, 1d, d, up, dm, dp); assertThat(DoubleArrayMath.fuzzyEquals(computed.toArray(), expected.toArray(), 1.0e-14)).isTrue(); }