org.jscience.chemistry.quantum.math.util
Class MathUtils

java.lang.Object
  extended by org.jscience.chemistry.quantum.math.util.MathUtils

public final class MathUtils
extends java.lang.Object

A collection of few misc. utility math functions. All methods are static and the class cannot be instantiated.


Method Summary
static long factorial(int n)
          compute N!
static long factorial2(int n)
          compute double N!
static double factorialRatioSquared(int a, int b)
          Does ( a!
static double findAngle(Point3D v1, Point3D v2, Point3D v3)
          Method to find the angle in radians defined by three points v1-v2-v3.
static double findDihedral(Point3D v1, Point3D v2, Point3D v3, Point3D v4)
          Method to find the dihedral angle defined by planes v1-v2-v3 and v2-v3-v4.
static double signOf(double value)
          Return the sign of (1.0, 0.0, -1.0) of the given value.
static double toDegrees(double radians)
          Method to convert radians to degrees
static double toRadians(double degrees)
          Method to convert degrees to radians
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toDegrees

public static double toDegrees(double radians)
Method to convert radians to degrees

Parameters:
radians - - the value
Returns:
the equivalent in degrees

toRadians

public static double toRadians(double degrees)
Method to convert degrees to radians

Parameters:
degrees - - the value
Returns:
the equivalent in radians

signOf

public static double signOf(double value)
Return the sign of (1.0, 0.0, -1.0) of the given value.

Parameters:
value - the value of which whose sign we are interested
Returns:
(1.0,0.0, -1.0) for value ( > , ==, <) zero respectively

findAngle

public static double findAngle(Point3D v1,
                               Point3D v2,
                               Point3D v3)
Method to find the angle in radians defined by three points v1-v2-v3.

Parameters:
v1, - v2, v3 - the instances of Point3D class
Returns:
the angle defined

findDihedral

public static double findDihedral(Point3D v1,
                                  Point3D v2,
                                  Point3D v3,
                                  Point3D v4)
Method to find the dihedral angle defined by planes v1-v2-v3 and v2-v3-v4.

Parameters:
v1, - v2, v3, v4 - the instances of Point3D class
Returns:
the dihedral angle defined

factorial

public static long factorial(int n)
compute N!

Parameters:
n - the n, whose factorial is to be found
Returns:
the factorial

factorial2

public static long factorial2(int n)
compute double N! ... (1*3*5*...*n)

Parameters:
n - the n, whose factorial is to be found
Returns:
the factorial

factorialRatioSquared

public static double factorialRatioSquared(int a,
                                           int b)
Does ( a! / b! / (a-2*b)! )

Parameters:
a - the first term
b - the second term
Returns:
(a! / b! / (a-2*b)! )