root = nrf.findRoot(func, -5, 5, 0.0001f);
TestUtil.assertClose(func.map(new float[]{root}), 0, 0.001f);
func = new IdentityFunction(1, 0);
root = nrf.findRoot(func, -5, 5, 0.0001f);
TestUtil.assertClose(func.map(new float[]{root}), 0, 0.001f);
func = new PiecewiseConstantFunction(new float[]{-1,1}, new float[]{2,0,-2});
try {
root = nrf.findRoot(func, -5, 15, 0.0001f);
} catch (RuntimeException e) { // failure after too many attempts