Holger's
Java API

com.antelmann.util
Class MyMath

java.lang.Object
  extended by com.antelmann.util.MyMath

public final class MyMath
extends Object

some math related static functions including some useful statistics functions

Author:
Holger Antelmann

Field Summary
 double FIB
          the neares quotient of Fibonacci numbers as double
 
Method Summary
static double average(double... population)
          returns mean(population)
static double centimeterToInch(double centimeter)
          just for convenient reference
static double inchToCentimeter(double inch)
          just for convenient reference
static double max(double... value)
          returns the greatest element out of the given array
static long max(long... value)
          returns the greatest element out of the given array
static double maxIndex(double... value)
          returns the index of the greatest element from the given array
static double mean(double... population)
          returns the mean of the population
static double median(double... population)
          returns the median of the given population
static double min(double... value)
          returns the smallest element out of the given array
static double minIndex(double... value)
          returns the index of the smallest element from the given array
static double range(double... population)
          returns the difference between the max and the min element
static double sigmoid(double x)
          produces a double between 0 and 1 with (sigmoid(0.5) == 0) being true
static double sigmoid(double x, double flatteningFactor)
          sigmoid(double x) is the same as sigmoid(double x, 1), large flatteningFactor flattens the curve
static double softmax(int index, double... x)
          produces a double between 0 and 1 based on the given array x and the index that must be between (0 and x.length) For further information see also: http://www-ccs.ucsd.edu/matlab/toolbox/nnet/softmax.html
static double standardDeviation(double... population)
          returns the standard deviation of the given population based on variance()
static double stdDev(double... sample)
          returns the standard deviation of the given sample based on var()
static double sum(double... population)
          returns the sum of the given population
static int sumOfDigits(long number)
          returns the sum of all individual digits.
static double var(double... sample)
          returns the variance of the given sample of a population
static double variance(double... population)
          returns the variance of the given population
static double YardToMeter(double yard)
          just for convenient reference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIB

public final double FIB
the neares quotient of Fibonacci numbers as double

See Also:
Constant Field Values
Method Detail

sumOfDigits

public static int sumOfDigits(long number)
returns the sum of all individual digits. Example: sumOfDigits(123045) returns 15 (1+2+3+4+0+5).


average

public static double average(double... population)
returns mean(population)

See Also:
mean(double[])

mean

public static double mean(double... population)
returns the mean of the population


sum

public static double sum(double... population)
returns the sum of the given population


range

public static double range(double... population)
returns the difference between the max and the min element


median

public static double median(double... population)
returns the median of the given population


variance

public static double variance(double... population)
returns the variance of the given population


var

public static double var(double... sample)
returns the variance of the given sample of a population


standardDeviation

public static double standardDeviation(double... population)
returns the standard deviation of the given population based on variance()

See Also:
variance(double[] population)

stdDev

public static double stdDev(double... sample)
returns the standard deviation of the given sample based on var()

See Also:
var(double[])

max

public static double max(double... value)
returns the greatest element out of the given array


max

public static long max(long... value)
returns the greatest element out of the given array


maxIndex

public static double maxIndex(double... value)
returns the index of the greatest element from the given array


min

public static double min(double... value)
returns the smallest element out of the given array


minIndex

public static double minIndex(double... value)
returns the index of the smallest element from the given array


sigmoid

public static double sigmoid(double x)
produces a double between 0 and 1 with (sigmoid(0.5) == 0) being true


sigmoid

public static double sigmoid(double x,
                             double flatteningFactor)
sigmoid(double x) is the same as sigmoid(double x, 1), large flatteningFactor flattens the curve


softmax

public static double softmax(int index,
                             double... x)
produces a double between 0 and 1 based on the given array x and the index that must be between (0 and x.length) For further information see also: http://www-ccs.ucsd.edu/matlab/toolbox/nnet/softmax.html


centimeterToInch

public static double centimeterToInch(double centimeter)
just for convenient reference


inchToCentimeter

public static double inchToCentimeter(double inch)
just for convenient reference


YardToMeter

public static double YardToMeter(double yard)
just for convenient reference



(c) 2001-2006 Holger Antelmann - all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads