edu.jas.arith
Class BigComplex

java.lang.Object
  extended by edu.jas.arith.BigComplex
All Implemented Interfaces:
Coefficient, java.io.Serializable, java.lang.Comparable

public class BigComplex
extends java.lang.Object
implements Coefficient, java.lang.Comparable, java.io.Serializable

BigComplex class based on BigRational implementing the Coefficient interface and with the familiar SAC method names.

See Also:
Serialized Form

Field Summary
static BigComplex I
           
static BigComplex ONE
           
static BigComplex ZERO
          constants: 1, 0 und i
 
Constructor Summary
BigComplex()
           
BigComplex(BigRational r)
           
BigComplex(BigRational r, BigRational i)
          The constructors create a BigComplex object from two BigRational objects real and imaginary part.
BigComplex(int r)
           
BigComplex(java.lang.String s)
           
 
Method Summary
 Coefficient abs()
           
 Coefficient add(Coefficient b)
          arithmetic operations: +, -, -
static BigRational CABS(BigComplex A)
          Complex number absolute value.
static BigComplex CCON(BigComplex A)
          Complex number conjugate.
static BigComplex CDIF(BigComplex A, BigComplex B)
          Complex number difference.
static BigComplex CINV(BigComplex A)
          Complex number inverse.
static BigComplex CNEG(BigComplex A)
          Complex number negative.
 int compareTo(java.lang.Object b)
          since complex numbers are unordered, there is no compareTo method.
 BigComplex conjugate()
          arithmetic operations: conjugate, absolut value
static BigComplex CPROD(BigComplex A, BigComplex B)
          Complex number product.
static BigComplex CQ(BigComplex A, BigComplex B)
          Complex number quotient.
static BigComplex CRAND(int n)
          Complex number, random.
static BigComplex CSUM(BigComplex A, BigComplex B)
          Complex number sum.
 Coefficient divide(Coefficient b)
           
 boolean equals(java.lang.Object b)
          comparison of two BigComplex numbers
 Coefficient fromInteger(java.math.BigInteger a)
           
 Coefficient fromInteger(long a)
           
 BigRational getIm()
           
 BigRational getRe()
          get the real and imaginary part
 Coefficient inverse()
           
static boolean isCONE(BigComplex A)
          Complex number one.
static boolean isCZERO(BigComplex A)
          Complex number zero.
 boolean isIMAG()
           
 boolean isONE()
           
 boolean isZERO()
           
 Coefficient multiply(Coefficient b)
          arithmetic operations: *, inverse, /
 Coefficient negate()
           
 Coefficient random(int n)
          random complex number
 int signum()
           
 Coefficient subtract(Coefficient b)
           
 java.lang.String toString()
          string representation
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ZERO

public static final BigComplex ZERO
constants: 1, 0 und i


ONE

public static final BigComplex ONE

I

public static final BigComplex I
Constructor Detail

BigComplex

public BigComplex(BigRational r,
                  BigRational i)
The constructors create a BigComplex object from two BigRational objects real and imaginary part.


BigComplex

public BigComplex(BigRational r)

BigComplex

public BigComplex(int r)

BigComplex

public BigComplex()

BigComplex

public BigComplex(java.lang.String s)
           throws java.lang.NumberFormatException
Throws:
java.lang.NumberFormatException
Method Detail

fromInteger

public Coefficient fromInteger(java.math.BigInteger a)
Specified by:
fromInteger in interface Coefficient

fromInteger

public Coefficient fromInteger(long a)
Specified by:
fromInteger in interface Coefficient

getRe

public BigRational getRe()
get the real and imaginary part


getIm

public BigRational getIm()

toString

public java.lang.String toString()
string representation

Overrides:
toString in class java.lang.Object

isCZERO

public static boolean isCZERO(BigComplex A)
Complex number zero. A is a complex number. If A is 0 then true is returned, else false.


isZERO

public boolean isZERO()
Specified by:
isZERO in interface Coefficient

isCONE

public static boolean isCONE(BigComplex A)
Complex number one. A is a complex number. If A is 1 then true is returned, else false.


isONE

public boolean isONE()
Specified by:
isONE in interface Coefficient

isIMAG

public boolean isIMAG()

equals

public boolean equals(java.lang.Object b)
comparison of two BigComplex numbers

Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object b)
since complex numbers are unordered, there is no compareTo method. We define the result to be

Specified by:
compareTo in interface Coefficient
Specified by:
compareTo in interface java.lang.Comparable
Returns:
-1 if b is not a BigComplex object

signum

public int signum()
Specified by:
signum in interface Coefficient

add

public Coefficient add(Coefficient b)
arithmetic operations: +, -, -

Specified by:
add in interface Coefficient

CSUM

public static BigComplex CSUM(BigComplex A,
                              BigComplex B)
Complex number sum. A and B are complex numbers.

Returns:
T=A+B.

CDIF

public static BigComplex CDIF(BigComplex A,
                              BigComplex B)
Complex number difference. A and B are complex numbers.

Returns:
T=A-B.

subtract

public Coefficient subtract(Coefficient b)
Specified by:
subtract in interface Coefficient

CNEG

public static BigComplex CNEG(BigComplex A)
Complex number negative. A is a complex number.

Returns:
S=-A.

negate

public Coefficient negate()
Specified by:
negate in interface Coefficient

CCON

public static BigComplex CCON(BigComplex A)
Complex number conjugate. A is a complex number. S is the complex conjugate of A.


conjugate

public BigComplex conjugate()
arithmetic operations: conjugate, absolut value


abs

public Coefficient abs()
Specified by:
abs in interface Coefficient

CABS

public static BigRational CABS(BigComplex A)
Complex number absolute value. R is a complex number. S is the absolute value of R, a rational number.


CPROD

public static BigComplex CPROD(BigComplex A,
                               BigComplex B)
Complex number product. A and B are complex numbers.

Returns:
T=A*B.

multiply

public Coefficient multiply(Coefficient b)
arithmetic operations: *, inverse, /

Specified by:
multiply in interface Coefficient

CINV

public static BigComplex CINV(BigComplex A)
Complex number inverse. A is a non-zero complex number. S A=1.


inverse

public Coefficient inverse()
Specified by:
inverse in interface Coefficient

CQ

public static BigComplex CQ(BigComplex A,
                            BigComplex B)
Complex number quotient. A and B are complex numbers, B non-zero.

Returns:
T=R/S.

divide

public Coefficient divide(Coefficient b)
Specified by:
divide in interface Coefficient

CRAND

public static BigComplex CRAND(int n)
Complex number, random. n is a positive beta-integer. Random rational numbers A and B are generated using RNRAND(n). Then R is the complex number with real part A and imaginary part B.


random

public Coefficient random(int n)
random complex number

Specified by:
random in interface Coefficient