package edu.illinois.dais.ttr; import java.util.ArrayList; /** * A math utility class with static methods. * * @author Bob Carpenter * @since LingPipe1.0 */ public class Mathematics { // forbid instances private Mathematics() { /* no instances */ } /** * The value of the golden ratio. The golden ratio is defined to * be the value φ such that: * *
* φ = (φ + 1) / φ *
* * Note that this is a quadratic equation (multiply both sides by * φ) with the solution roughly 1.61803399. * *

See the following for a fascinating tour of the properties * of the golden ratio: * *

*/ public static final double GOLDEN_RATIO = (1.0 + java.lang.Math.sqrt(5))/2.0; /** * An array of the Fibonacci sequence. The array is defined * as follows: * *
     * FIBONACCI_SEQUENCE[0] = 1
     * FIBONACCI_SEQUENCE[1] = 2
     * FIBONACCI_SEQUENCE[n+2] = FIBONACCI_SEQUENCE[n+1] + FIBONACCI_SEQUENCE[n]
     * 
* * So FIBONACCI_SEQUENCE[0] represents the second * Fibonacci number in the traditional numbering. The inital entries * are: * *
* 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, * 2584, ... *
* * The length of the array is 91, and the largest value is: * *
* FIBONACCI_SEQUENCE[90] = 7540113804746346429 * *
* *

See the following references for more information on * the fascinating properties of Fibonacci numbers: * *