package ec.app.regression.testcases;

public class F07Factory extends FunctionFactory {

	@Override
	protected int arity() {
		return 1;
	}

	@Override
	protected double function(final Double... x) {
		// return Math.log(x + 1) + Math.log(x * x + 1);
		assert Math.abs((Math.log(x[0] + 1) + Math.log(x[0] * x[0] + 1)) - Math.log(1 + x[0] * (1 + x[0] * (1 + x[0])))) < 1E-10;
		return Math.log(1 + x[0] * (1 + x[0] * (1 + x[0]))); // faster version of above formula assuming x > -1
	}

	@Override
	public String getSymbolicRepresentation() {
		return "log(1 + x0 * (1 + x0 * (1 + x0)))";
	}
}
