package ec.app.regression.testcases;

/**
 * @author Tomasz Pawlak
 */
public class Pagie01Factory extends FunctionFactory {

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

    @Override
    protected double function(Double... x) {
        //return 1.0 / (1.0 + Math.pow(x[0], -4)) + 1.0 / (1.0 + Math.pow(x[1], -4));
        double x0Inv = 1.0 / x[0];
        double x1Inv = 1.0 / x[1];
        return 1.0 / (1.0 + x0Inv * x0Inv * x0Inv * x0Inv) + 1.0 / (1.0 + x1Inv * x1Inv * x1Inv * x1Inv);
    }

    @Override
    public String getSymbolicRepresentation() {
        return "1.0 / (1.0 + x0^-4) + 1.0 / (1.0 + x1^-4)";
    }

}
