### Question:
MexicanHatFunction extends AbstractRBF { @Override public double evaluate(final double[] x) { double norm = 0; for (int i = 0; i < getDimensions(); i++) { final double center = this.getCenter(i); norm += Math.pow(x[i] - center, 2); } return (1 - norm) * Math.exp(-norm / 2); } MexicanHatFunction(final int theDimensions, final double[] theParams, final int theIndex); @Override double evaluate(final double[] x);  }### Answer:
@Test public void testEvaluate() { final double[] params = {5, 0, 0, 0}; final MexicanHatFunction funct = new MexicanHatFunction(3, params, 0); final double[] x = {-1, 0, 1}; final double y = funct.evaluate(x); assertEquals(-0.36787944117144233, y, AIFH.DEFAULT_PRECISION); }
@Test public void testToString() { final double[] params = {5, 0, 0, 0}; final MexicanHatFunction funct = new MexicanHatFunction(3, params, 0); final double[] x = {-1, 0, 1}; funct.evaluate(x); assertEquals("[MexicanHatFunction:width=5.00,center=0.00,0.00,0.00]", funct.toString()); }