@Test
public void testQuinticMax() {
// The quintic function has zeros at 0, +-0.5 and +-1.
// The function has a local maximum at 0.27195613.
UnivariateFunction f = new QuinticFunction();
UnivariateOptimizer optimizer = new BrentOptimizer(1e-12, 1e-14);
Assert.assertEquals(0.27195613, optimizer.optimize(100, f, GoalType.MAXIMIZE, 0.2, 0.3).getPoint(), 1e-8);
try {
optimizer.optimize(5, f, GoalType.MAXIMIZE, 0.2, 0.3);
Assert.fail("an exception should have been thrown");