com.croftsoft.core.math
Class MathLib

java.lang.Object
  extended by com.croftsoft.core.math.MathLib

public final class MathLib
extends Object

A collection of static methods to supplement java.lang.Math.

Since:
1998-12-27
Version:
$Id: MathLib.java,v 1.5 2008/08/09 02:10:33 croft Exp $
Author:
David Wallace Croft

Method Summary
static double clip(double value, double minimum, double maximum)
           
static double cumulative(double x)
          return cumulative ( x, 1 );
static double cumulative(double x, double lambda)
          Cumulative Distribution Function (CDF).
static List<Integer> factor(int n)
           
static int greatestCommonFactor(int n0, int n1)
           
static double log(double a, double base)
          Calculates the logarithm in the given base.
static void main(String[] args)
           
static double sigmoid(double a)
          Also known as the "logistic function".
static double sigmoidDerivative(double a)
          The derivative with respect to the argument.
static byte signum(long l)
          Returns +1 if positive, -1 if negative, otherwise 0.
static double tanh(double a)
          hyperbolic tangent = 2 * sigmoid ( 2 * a ) - 1
static boolean test()
           
static Point2D toRectangular(double radius, double angle)
          Converts from polar to rectangular coordinates.
static void toRectangular(double radius, double angle, Point2D point2D)
          Converts from polar to rectangular coordinates.
static double wrap(double value, double minimum, double range)
          Wraps the value to [minimum, minimum + range).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(String[] args)

test

public static boolean test()

clip

public static double clip(double value,
                          double minimum,
                          double maximum)

cumulative

public static double cumulative(double x,
                                double lambda)
Cumulative Distribution Function (CDF).

See Also:
#Cumulative_distribution_function

cumulative

public static double cumulative(double x)
return cumulative ( x, 1 );


factor

public static List<Integer> factor(int n)

greatestCommonFactor

public static int greatestCommonFactor(int n0,
                                       int n1)

log

public static double log(double a,
                         double base)
Calculates the logarithm in the given base.
return Math.log ( a ) / Math.log ( base );


sigmoid

public static double sigmoid(double a)
Also known as the "logistic function".


sigmoidDerivative

public static double sigmoidDerivative(double a)
The derivative with respect to the argument.


signum

public static byte signum(long l)
Returns +1 if positive, -1 if negative, otherwise 0.


tanh

public static double tanh(double a)
hyperbolic tangent = 2 * sigmoid ( 2 * a ) - 1


toRectangular

public static void toRectangular(double radius,
                                 double angle,
                                 Point2D point2D)
Converts from polar to rectangular coordinates.


toRectangular

public static Point2D toRectangular(double radius,
                                    double angle)
Converts from polar to rectangular coordinates.


wrap

public static double wrap(double value,
                          double minimum,
                          double range)
Wraps the value to [minimum, minimum + range). Example: wrap ( -190, -180, 360 ) ==> 170 Example: wrap ( 190, -180, 360 ) ==> -10 Example: wrap ( 360, -180, 360 ) ==> -180


CroftSoft Javadoc

CroftSoft Core Javadoc (2008-09-28 20:58:02)