package aima.math; /** * Math functions. * * Simple math functions to augment those in java.lang.Math. * * @author Daishi Harada (daishi@cs.berkelely.edu) */ public class Function { /** * Computes the max of an array of doubles. * * @param x An array of doubles. x = {x_1, x_2, ... x_n}. * @return max_i(x) */ public static double max(double[] x) { int n = x.length; int i; double max; if (n == 0) { max = Double.NaN; } else { max = x[0]; for (i=1;i