net.sf.magnitude.core
Class Math

java.lang.Object
  extended by net.sf.magnitude.core.Math

public final class Math
extends java.lang.Object

Mathematical operations with Magnitude objects.

Author:
Philippe Pinard

Field Summary
static Magnitude PI
          Pi.
 
Method Summary
static Magnitude abs(Magnitude m)
          Returns the absolute value of this Magnitude.
static Magnitude acos(Magnitude m)
          Returns the arc cosine of a value.
static Magnitude asin(Magnitude m)
          Returns the arc sine of a value.
static Magnitude atan(Magnitude m)
          Returns the arc tangent of a value.
static Magnitude atan2(Magnitude y, Magnitude x)
          Returns the arc tangent of a value.
static Magnitude cbrt(Magnitude m)
          Returns the cubic root of a value.
static Magnitude ceil(Magnitude m)
          Returns the smallest (closest to negative infinity) value of this Magnitude.
static Magnitude cos(Magnitude m)
          Returns the trigonometric cosine of an angle.
static Magnitude floor(Magnitude m)
          Returns the largest (closest to positive infinity) value of this Magnitude.
static Magnitude max(Magnitude... ms)
          Returns the maximum Magnitude from a list of Magnitude's.
static Magnitude min(Magnitude... ms)
          Returns the minimum Magnitude from a list of Magnitude's.
static Magnitude sin(Magnitude m)
          Returns the trigonometric sine of an angle.
static Magnitude sqrt(Magnitude m)
          Returns the square root of a value.
static Magnitude tan(Magnitude m)
          Returns the trigonometric tangent of an angle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PI

public static final Magnitude PI
Pi.

Method Detail

abs

@CheckReturnValue
public static Magnitude abs(Magnitude m)
Returns the absolute value of this Magnitude.

Parameters:
m - a magnitude
Returns:
absolute Magnitude
See Also:
Math.abs(double)

acos

@CheckReturnValue
public static Magnitude acos(Magnitude m)
Returns the arc cosine of a value.

Parameters:
m - a magnitude
Returns:
a new Magnitude with the arc cosine of the specified Magnitude
Throws:
java.lang.IllegalArgumentException - if the magnitude is not dimensionless
See Also:
Math.atan(double)

asin

@CheckReturnValue
public static Magnitude asin(Magnitude m)
Returns the arc sine of a value.

Parameters:
m - a magnitude
Returns:
a new Magnitude with the arc sine of the specified Magnitude
Throws:
java.lang.IllegalArgumentException - if the magnitude is not dimensionless
See Also:
Math.atan(double)

atan

@CheckReturnValue
public static Magnitude atan(Magnitude m)
Returns the arc tangent of a value.

Parameters:
m - a magnitude
Returns:
a new Magnitude with the arc tangent of the specified Magnitude
Throws:
java.lang.IllegalArgumentException - if the magnitude is not dimensionless
See Also:
Math.atan(double)

atan2

@CheckReturnValue
public static Magnitude atan2(Magnitude y,
                                               Magnitude x)
Returns the arc tangent of a value.

Parameters:
y - the ordinate coordinate
x - the abscissa coordinate
Returns:
a new Magnitude with the arc tangent of the specified Magnitude
Throws:
java.lang.IllegalArgumentException - if the ordinate and abscissa do not have the same units
See Also:
Math.atan2(double, double)

ceil

@CheckReturnValue
public static Magnitude ceil(Magnitude m)
Returns the smallest (closest to negative infinity) value of this Magnitude.

Parameters:
m - magnitude
Returns:
smallest (closest to negative infinity) value
See Also:
Math.ceil(double)

cos

@CheckReturnValue
public static Magnitude cos(Magnitude m)
Returns the trigonometric cosine of an angle.

Parameters:
m - a magnitude
Returns:
a new Magnitude with the cosine of the specified Magnitude
Throws:
java.lang.IllegalArgumentException - if the units of the magnitude cannot be expressed as radians
See Also:
Math.cos(double)

cbrt

@CheckReturnValue
public static Magnitude cbrt(Magnitude m)
Returns the cubic root of a value.

Parameters:
m - a magnitude
Returns:
a new Magnitude
See Also:
Math.cbrt(double)

floor

@CheckReturnValue
public static Magnitude floor(Magnitude m)
Returns the largest (closest to positive infinity) value of this Magnitude.

Parameters:
m - a magnitude
Returns:
smallest (closest to negative infinity) value

max

@CheckReturnValue
public static Magnitude max(Magnitude... ms)
Returns the maximum Magnitude from a list of Magnitude's.

Parameters:
ms - list of Magnitude's
Returns:
Magnitude with the maximal value

min

@CheckReturnValue
public static Magnitude min(Magnitude... ms)
Returns the minimum Magnitude from a list of Magnitude's.

Parameters:
ms - list of Magnitude's
Returns:
Magnitude with the minimal value

sin

@CheckReturnValue
public static Magnitude sin(Magnitude m)
Returns the trigonometric sine of an angle.

Parameters:
m - a magnitude
Returns:
a new Magnitude with the sine of the specified Magnitude
Throws:
java.lang.IllegalArgumentException - if the units of the magnitude cannot be expressed as radians
See Also:
Math.sin(double)

sqrt

@CheckReturnValue
public static Magnitude sqrt(Magnitude m)
Returns the square root of a value.

Parameters:
m - a magnitude
Returns:
a new Magnitude
See Also:
Math.sqrt(double)

tan

@CheckReturnValue
public static Magnitude tan(Magnitude m)
Returns the trigonometric tangent of an angle.

Parameters:
m - a magnitude
Returns:
a new Magnitude with the tangent of the specified Magnitude
Throws:
java.lang.IllegalArgumentException - if the units of the magnitude cannot be expressed as radians
See Also:
Math.tan(double)