calc
Class Complex

java.lang.Object
  |
  +--calc.Complex
All Implemented Interfaces:
java.lang.Comparable

public class Complex
extends java.lang.Object
implements java.lang.Comparable

The Representation of a Complex Number


Field Summary
 double imag
           
static int N
          the "constant" for the upper border of the integral (= number of steps in which the integration is performed) used in zeta
static Complex ONE
           
static int Q
          the "constant" for the Number of partial Integrations in the Euler-MacLaurin-Formula used in zeta and zeta_fast
 double real
           
static Complex ZERO
           
 
Constructor Summary
Complex(Complex z1)
           
Complex(double real, double imag)
           
 
Method Summary
 double abs()
           
static double abs(Complex z1)
          the absolute value
 void add(Complex z2)
           
static Complex add(Complex z1, Complex z2)
          z1, z2 -> z1 + z2
 int compareTo(java.lang.Object o)
          we compare the absolute values of complex numbers (needed for sorting) this leads to the inconsistency of ordering with equality (which is normally assumed): a.compareTo(b) = 0 =/=> a.equals(b) !
static Complex cos(Complex z1)
           
 void div(Complex z2)
           
static Complex div(Complex z1, Complex z2)
          z1, z2 -> z1 / z2
 boolean equals(java.lang.Object o)
          two complex numbers are equal, if real- and imaginary part are equal
static Complex exp(Complex z1)
           
 int hashCode()
          needed by HashTables (e.g. in ComplexPowerSum.multiply())
 boolean isValid()
          returns false, if any part of c is NaN (not a number)
static Complex ln(Complex z1)
          the natural logarithm
static Complex log(Complex z1)
          for usability, does the same as ln
static void main(java.lang.String[] args)
          only for testing purposes
 void mult(Complex z2)
           
static Complex mult(Complex z1, Complex z2)
          z1, z2 -> z1 * z2
 void negate()
           
static Complex negate(Complex z1)
          z -> -z
static Complex pow(Complex z1, Complex z2)
          the general power function
static Complex sin(Complex z1)
           
 double square()
           
 void subtract(Complex z2)
           
static Complex subtract(Complex z1, Complex z2)
          z1, z2 -> z1 - z2
 java.lang.String toString()
           
static Complex zeta_fast(Complex s)
          the riemann-zeta-function, improved calculation
static Complex zeta_fastest(Complex s)
          the riemann-zeta-function, "new and improved" calculation.
static Complex zeta(Complex s)
          the riemann-zeta-function
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

real

public double real

imag

public double imag

Q

public static int Q
the "constant" for the Number of partial Integrations in the Euler-MacLaurin-Formula used in zeta and zeta_fast

N

public static int N
the "constant" for the upper border of the integral (= number of steps in which the integration is performed) used in zeta

ZERO

public static final Complex ZERO

ONE

public static final Complex ONE
Constructor Detail

Complex

public Complex(double real,
               double imag)

Complex

public Complex(Complex z1)
Method Detail

abs

public double abs()

square

public double square()

negate

public void negate()

add

public void add(Complex z2)

subtract

public void subtract(Complex z2)

mult

public void mult(Complex z2)

div

public void div(Complex z2)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
we compare the absolute values of complex numbers (needed for sorting) this leads to the inconsistency of ordering with equality (which is normally assumed): a.compareTo(b) = 0 =/=> a.equals(b) !
Specified by:
compareTo in interface java.lang.Comparable

equals

public boolean equals(java.lang.Object o)
two complex numbers are equal, if real- and imaginary part are equal
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
needed by HashTables (e.g. in ComplexPowerSum.multiply())
Overrides:
hashCode in class java.lang.Object

isValid

public boolean isValid()
returns false, if any part of c is NaN (not a number)

abs

public static double abs(Complex z1)
the absolute value

negate

public static Complex negate(Complex z1)
z -> -z

add

public static Complex add(Complex z1,
                          Complex z2)
z1, z2 -> z1 + z2

subtract

public static Complex subtract(Complex z1,
                               Complex z2)
z1, z2 -> z1 - z2

mult

public static Complex mult(Complex z1,
                           Complex z2)
z1, z2 -> z1 * z2

div

public static Complex div(Complex z1,
                          Complex z2)
z1, z2 -> z1 / z2

sin

public static Complex sin(Complex z1)

cos

public static Complex cos(Complex z1)

exp

public static Complex exp(Complex z1)

pow

public static Complex pow(Complex z1,
                          Complex z2)
the general power function

ln

public static Complex ln(Complex z1)
the natural logarithm

log

public static Complex log(Complex z1)
for usability, does the same as ln

zeta_fastest

public static Complex zeta_fastest(Complex s)
the riemann-zeta-function, "new and improved" calculation. Uses the calculation algorithm implemented in PARI

zeta_fast

public static Complex zeta_fast(Complex s)
the riemann-zeta-function, improved calculation

zeta

public static Complex zeta(Complex s)
the riemann-zeta-function

main

public static void main(java.lang.String[] args)
only for testing purposes