mae.tut.num
Class Cruncher

java.lang.Object
  extended bymae.tut.num.Cruncher

public class Cruncher
extends java.lang.Object

Defines static methods to calculate several functions.

Greatest Common Divisor and Exponential functions are included.


Field Summary
static Number e
          Decimal e
static Number i
          Complex i
 
Method Summary
static float exp(float x)
          Raises argument x to e (calls Math.log(x))
 Number exp(Number n)
          Raises Number n to e (uses Math class)
static float expPS(float x)
          Raises argument x to e approximately.
 Number expPS(Number n)
          Raises Number n to e (power series approximation)
static long gcd(long a, long b)
          Returns the greatest common divisor of the arguments.
static float log(float x)
          Inverse of exp: log of x to base e (calls Math.log(x))
 Number log(Number n)
          Inverse of exp: log of n to base e (Works with any subclass)
static float pow(float x, float a)
          Power to the a of x (calls Math.pow(x, a))
 Number pow(Number n, Number a)
          Power to the a of x (Works with any subclass)
static float sqrt(float x)
          Square root of x (calls Math.sqrt(x))
 Number sqrt(Number n)
          Square root of n (Works with any subclass)
 java.lang.String toString()
          String representation of this Object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

i

public static final Number i
Complex i


e

public static final Number e
Decimal e

Method Detail

toString

public java.lang.String toString()
String representation of this Object


expPS

public Number expPS(Number n)
Raises Number n to e (power series approximation)


exp

public Number exp(Number n)
Raises Number n to e (uses Math class)


log

public Number log(Number n)
Inverse of exp: log of n to base e (Works with any subclass)


sqrt

public Number sqrt(Number n)
Square root of n (Works with any subclass)


pow

public Number pow(Number n,
                  Number a)
Power to the a of x (Works with any subclass)


expPS

public static float expPS(float x)
Raises argument x to e approximately. (Should return a value close to Math.exp(x))


exp

public static float exp(float x)
Raises argument x to e (calls Math.log(x))


log

public static float log(float x)
Inverse of exp: log of x to base e (calls Math.log(x))


sqrt

public static float sqrt(float x)
Square root of x (calls Math.sqrt(x))


pow

public static float pow(float x,
                        float a)
Power to the a of x (calls Math.pow(x, a))


gcd

public static long gcd(long a,
                       long b)
Returns the greatest common divisor of the arguments.

Invokes static method Rational.gcd().