JSci.maths
Class MathDouble

java.lang.Object
  extended by java.lang.Number
      extended by JSci.maths.MathDouble
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, Field.Member, Ring.Member, AbelianGroup.Member, Member

public final class MathDouble
extends java.lang.Number
implements java.lang.Comparable, Field.Member

The MathDouble class encapsulates double numbers. Methods will automatically promote objects from subsets.

See Also:
RealField, Serialized Form

Constructor Summary
MathDouble(double num)
          Constructs a double number.
MathDouble(java.lang.String s)
          Constructs the double number represented by a string.
 
Method Summary
static MathDouble acos(double x)
           
static MathDouble acos(MathDouble x)
          Returns the arc cosine of a number.
static MathDouble acos(java.lang.Number x)
           
static MathDouble acosh(double x)
           
static MathDouble acosh(MathDouble x)
          Returns the arc hyperbolic cosine of a number.
static MathDouble acosh(java.lang.Number x)
           
 AbelianGroup.Member add(AbelianGroup.Member n)
          Returns the addition of this number and another.
 MathDouble add(double y)
           
 MathDouble add(MathDouble n)
          Returns the addition of this double number and another.
static MathDouble asin(double x)
           
static MathDouble asin(MathDouble x)
          Returns the arc sine of a number.
static MathDouble asin(java.lang.Number x)
           
static MathDouble asinh(double x)
           
static MathDouble asinh(MathDouble x)
          Returns the arc hyperbolic sine of a number.
static MathDouble asinh(java.lang.Number x)
           
static MathDouble atan(double x)
           
static MathDouble atan(MathDouble x)
          Returns the arc tangent of a number.
static MathDouble atan(java.lang.Number x)
           
static MathDouble atanh(double x)
           
static MathDouble atanh(MathDouble x)
          Returns the arc hyperbolic tangent of a number.
static MathDouble atanh(java.lang.Number x)
           
 int compareTo(java.lang.Object obj)
          Compares two numbers.
static MathDouble cos(double x)
           
static MathDouble cos(MathDouble x)
          Returns the trigonometric cosine of an angle.
static MathDouble cos(java.lang.Number x)
           
static MathDouble cosh(double x)
           
static MathDouble cosh(MathDouble x)
          Returns the hyperbolic cosine of a number.
static MathDouble cosh(java.lang.Number x)
           
 MathDouble divide(double y)
           
 Field.Member divide(Field.Member n)
          Returns the division of this number and another.
 MathDouble divide(MathDouble n)
          Returns the division of this double number and another.
 double doubleValue()
           
 boolean equals(java.lang.Object obj)
          Compares two numbers for equality.
 boolean equals(java.lang.Object obj, double tol)
           
static MathDouble exp(double x)
           
static MathDouble exp(MathDouble x)
          Returns the exponential number e(2.718...) raised to the power of a number.
static MathDouble exp(java.lang.Number x)
           
 float floatValue()
           
 java.lang.Object getSet()
           
 int hashCode()
           
 int intValue()
           
 Field.Member inverse()
          Returns the inverse of this number.
 boolean isInfinite()
          Returns true if this number is infinite.
 boolean isNaN()
          Returns true if this number is NaN.
static boolean isZero(double x)
          Returns true if the number is within the zero tolerance.
static MathDouble log(double x)
           
static MathDouble log(MathDouble x)
          Returns the natural logarithm (base e) of a number.
static MathDouble log(java.lang.Number x)
           
 long longValue()
           
 MathDouble multiply(double y)
           
 MathDouble multiply(MathDouble n)
          Returns the multiplication of this double number and another.
 Ring.Member multiply(Ring.Member n)
          Returns the multiplication of this number and another.
 AbelianGroup.Member negate()
          Returns the negative of this number.
static MathDouble sin(double x)
           
static MathDouble sin(MathDouble x)
          Returns the trigonometric sine of an angle.
static MathDouble sin(java.lang.Number x)
           
static MathDouble sinh(double x)
           
static MathDouble sinh(MathDouble x)
          Returns the hyperbolic sine of a number.
static MathDouble sinh(java.lang.Number x)
           
 AbelianGroup.Member subtract(AbelianGroup.Member n)
          Returns the subtraction of this number and another.
 MathDouble subtract(double y)
           
 MathDouble subtract(MathDouble n)
          Returns the subtraction of this double number and another.
static MathDouble tan(double x)
           
static MathDouble tan(MathDouble x)
          Returns the trigonometric tangent of an angle.
static MathDouble tan(java.lang.Number x)
           
static MathDouble tanh(double x)
           
static MathDouble tanh(MathDouble x)
          Returns the hyperbolic tangent of a number.
static MathDouble tanh(java.lang.Number x)
           
 java.lang.String toString()
          Returns a string representing the value of this double number.
 double value()
          Returns the double value.
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MathDouble

public MathDouble(double num)
Constructs a double number.


MathDouble

public MathDouble(java.lang.String s)
           throws java.lang.NumberFormatException
Constructs the double number represented by a string.

Parameters:
s - a string representing a double number.
Throws:
java.lang.NumberFormatException - if the string does not contain a parsable number.
Method Detail

equals

public boolean equals(java.lang.Object obj)
Compares two numbers for equality.

Overrides:
equals in class java.lang.Object
Parameters:
obj - a number.

equals

public boolean equals(java.lang.Object obj,
                      double tol)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

compareTo

public int compareTo(java.lang.Object obj)
              throws java.lang.IllegalArgumentException
Compares two numbers.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - a number.
Returns:
a negative value if this<obj, zero if this==obj, and a positive value if this>obj.
Throws:
java.lang.IllegalArgumentException

toString

public java.lang.String toString()
Returns a string representing the value of this double number.

Overrides:
toString in class java.lang.Object

value

public double value()
Returns the double value.


intValue

public int intValue()
Specified by:
intValue in class java.lang.Number

longValue

public long longValue()
Specified by:
longValue in class java.lang.Number

floatValue

public float floatValue()
Specified by:
floatValue in class java.lang.Number

doubleValue

public double doubleValue()
Specified by:
doubleValue in class java.lang.Number

isZero

public static boolean isZero(double x)
Returns true if the number is within the zero tolerance.


isNaN

public boolean isNaN()
Returns true if this number is NaN.


isInfinite

public boolean isInfinite()
Returns true if this number is infinite.


getSet

public java.lang.Object getSet()
Specified by:
getSet in interface Member

negate

public AbelianGroup.Member negate()
Returns the negative of this number.

Specified by:
negate in interface AbelianGroup.Member

inverse

public Field.Member inverse()
Returns the inverse of this number.

Specified by:
inverse in interface Field.Member

add

public AbelianGroup.Member add(AbelianGroup.Member n)
Returns the addition of this number and another.

Specified by:
add in interface AbelianGroup.Member
Parameters:
n - a group member

add

public MathDouble add(MathDouble n)
Returns the addition of this double number and another.


add

public MathDouble add(double y)

subtract

public AbelianGroup.Member subtract(AbelianGroup.Member n)
Returns the subtraction of this number and another.

Specified by:
subtract in interface AbelianGroup.Member
Parameters:
n - a group member

subtract

public MathDouble subtract(MathDouble n)
Returns the subtraction of this double number and another.


subtract

public MathDouble subtract(double y)

multiply

public Ring.Member multiply(Ring.Member n)
Returns the multiplication of this number and another.

Specified by:
multiply in interface Ring.Member
Parameters:
n - a ring member

multiply

public MathDouble multiply(MathDouble n)
Returns the multiplication of this double number and another.


multiply

public MathDouble multiply(double y)

divide

public Field.Member divide(Field.Member n)
Returns the division of this number and another.

Specified by:
divide in interface Field.Member
Parameters:
n - a field member

divide

public MathDouble divide(MathDouble n)
Returns the division of this double number and another.


divide

public MathDouble divide(double y)

exp

public static MathDouble exp(MathDouble x)
Returns the exponential number e(2.718...) raised to the power of a number.


exp

public static MathDouble exp(java.lang.Number x)

exp

public static MathDouble exp(double x)

log

public static MathDouble log(MathDouble x)
Returns the natural logarithm (base e) of a number.


log

public static MathDouble log(java.lang.Number x)

log

public static MathDouble log(double x)

sin

public static MathDouble sin(MathDouble x)
Returns the trigonometric sine of an angle.

Parameters:
x - an angle that is measured in radians

sin

public static MathDouble sin(java.lang.Number x)

sin

public static MathDouble sin(double x)

cos

public static MathDouble cos(MathDouble x)
Returns the trigonometric cosine of an angle.

Parameters:
x - an angle that is measured in radians

cos

public static MathDouble cos(java.lang.Number x)

cos

public static MathDouble cos(double x)

tan

public static MathDouble tan(MathDouble x)
Returns the trigonometric tangent of an angle.

Parameters:
x - an angle that is measured in radians

tan

public static MathDouble tan(java.lang.Number x)

tan

public static MathDouble tan(double x)

sinh

public static MathDouble sinh(MathDouble x)
Returns the hyperbolic sine of a number.


sinh

public static MathDouble sinh(java.lang.Number x)

sinh

public static MathDouble sinh(double x)

cosh

public static MathDouble cosh(MathDouble x)
Returns the hyperbolic cosine of a number.


cosh

public static MathDouble cosh(java.lang.Number x)

cosh

public static MathDouble cosh(double x)

tanh

public static MathDouble tanh(MathDouble x)
Returns the hyperbolic tangent of a number.


tanh

public static MathDouble tanh(java.lang.Number x)

tanh

public static MathDouble tanh(double x)

asin

public static MathDouble asin(MathDouble x)
Returns the arc sine of a number.


asin

public static MathDouble asin(java.lang.Number x)

asin

public static MathDouble asin(double x)

acos

public static MathDouble acos(MathDouble x)
Returns the arc cosine of a number.


acos

public static MathDouble acos(java.lang.Number x)

acos

public static MathDouble acos(double x)

atan

public static MathDouble atan(MathDouble x)
Returns the arc tangent of a number.


atan

public static MathDouble atan(java.lang.Number x)

atan

public static MathDouble atan(double x)

asinh

public static MathDouble asinh(MathDouble x)
Returns the arc hyperbolic sine of a number.


asinh

public static MathDouble asinh(java.lang.Number x)

asinh

public static MathDouble asinh(double x)

acosh

public static MathDouble acosh(MathDouble x)
Returns the arc hyperbolic cosine of a number.


acosh

public static MathDouble acosh(java.lang.Number x)

acosh

public static MathDouble acosh(double x)

atanh

public static MathDouble atanh(MathDouble x)
Returns the arc hyperbolic tangent of a number.


atanh

public static MathDouble atanh(java.lang.Number x)

atanh

public static MathDouble atanh(double x)