Skip to Main Content
Class Complex

Class Complex

java.lang.Object
   |
   +----Complex

public class Complex
extends Object
A class representing complex numbers, implementing calculations with them and providing some numerical computations for fundamental domains.


Variable Index

 o DOUBLEDIGITS
The default number of digits to display in formatted coversion of Doubles to Strings.
 o FOUR
The complex constant 4.
 o I
The complex constant i.
 o IDENTRESOL
Powers of an elliptic generator whose (1,1) entry are at this distance squared or less are considered to be the identity, so enabling us to compute the order of that elliptic element.
 o MAXELLIPORD
An cutoff for the calculation of orders of elliptic elements.
 o MAXPOWMAX
The cutoff for calculated maxpows -- above this value we arbitrarily truncate down to this.
 o MINUS_I
The complex constant -i.
 o MINUS_ONE
The complex constant -1.
 o ONE
The complex constant 1.
 o period
A string containing one period for formatting Double.toString output to a certain number of decimal digits.
 o TWO
The complex constant 2.
 o x
The real part of this complex number.
 o y
The imaginary part of this complex number.
 o ZERO
The complex constant 0.

Constructor Index

 o Complex()
Constructor for the complex number zero.
 o Complex(Complex)
Constructor for a complex number identical to one given as input.
 o Complex(double, double)
Constructor for an arbitrary complex number.

Method Index

 o add(Complex, Complex)
Compute the sum of two complex numbers.
 o argument()
Compute this's argument.
 o argument(Complex)
Compute the argument of a complex number, in the range (-pi,pi].
 o conj()
Computes this's complex conjugate.
 o conj(Complex)
Computes the complex conjugate of the input complex number.
 o distsq(Complex, Complex)
Computes the square of the distance between two complex numbers.
 o divide(Complex, Complex)
Divides one input complex number by another.
 o DoubleToString(double)
The default invocation of DoubleToString has DOUBLEDIGITS of precision.
 o DoubleToString(double, int)
Converts a double to a string with a certain number of digits of precision.
 o make_maxpow(Complex, Complex)
Compute the maxpow corresponding to the current trace and previously calculated (1,1) entry.
 o make_z11(Complex)
Compute the (1,1) entry of the canonical matrix with given trace.
 o modsq()
Compute this's modulus squared.
 o modsq(Complex)
Compute the modulus squared of a complex number.
 o modulus()
Compute this's modulus.
 o modulus(Complex)
Computes the modulus of an input complex number.
 o multiply(Complex, Complex)
Multiplies one input complex number by another.
 o sqrt(Complex)
Computes the square root of an input complex number
 o square(Complex)
Squares an input complex number.
 o stringToComplex(String)
Convert an input string to a complex number.
 o subtract(Complex, Complex)
Compute the difference of two complex numbers.
 o toString()
Convert this complex number to a string, with the real and imaginary parts separated by a comma.

Variables

 o x
 public double x
The real part of this complex number.

 o y
 public double y
The imaginary part of this complex number.

 o ZERO
 public static final Complex ZERO
The complex constant 0.

 o ONE
 public static final Complex ONE
The complex constant 1.

 o TWO
 public static final Complex TWO
The complex constant 2.

 o FOUR
 public static final Complex FOUR
The complex constant 4.

 o MINUS_ONE
 public static final Complex MINUS_ONE
The complex constant -1.

 o I
 public static final Complex I
The complex constant i.

 o MINUS_I
 public static final Complex MINUS_I
The complex constant -i.

 o MAXPOWMAX
 public static final int MAXPOWMAX
The cutoff for calculated maxpows -- above this value we arbitrarily truncate down to this. A good default is around 50; much more and computations start to take way too long, much less and a reasonable window on the trace plane includes lots of pixel for which we use the artificial cutoff.

 o MAXELLIPORD
 public static final int MAXELLIPORD
An cutoff for the calculation of orders of elliptic elements. We only try possible orders up to this value, then give up.

 o IDENTRESOL
 public static final double IDENTRESOL
Powers of an elliptic generator whose (1,1) entry are at this distance squared or less are considered to be the identity, so enabling us to compute the order of that elliptic element.

 o period
 public static final String period
A string containing one period for formatting Double.toString output to a certain number of decimal digits.

 o DOUBLEDIGITS
 public static final int DOUBLEDIGITS
The default number of digits to display in formatted coversion of Doubles to Strings.

Constructors

 o Complex
 public Complex()
Constructor for the complex number zero.

 o Complex
 public Complex(double xx,
                double yy)
Constructor for an arbitrary complex number.

Parameters:
xx - the real part
yy - the imaginary part
 o Complex
 public Complex(Complex z)
Constructor for a complex number identical to one given as input.

Parameters:
z - the complex number to duplicate

Methods

 o add
 public static Complex add(Complex a,
                           Complex b)
Compute the sum of two complex numbers.

Parameters:
a - one input complex number
b - and another
Returns:
the sum
 o subtract
 public static Complex subtract(Complex a,
                                Complex b)
Compute the difference of two complex numbers.

Parameters:
a - one input complex number
b - and another
Returns:
the difference
 o multiply
 public static Complex multiply(Complex a,
                                Complex b)
Multiplies one input complex number by another.

Parameters:
a - one input complex number
b - and another
Returns:
the product
 o divide
 public static Complex divide(Complex a,
                              Complex b)
Divides one input complex number by another.

Parameters:
a - the numerator
b - the denominator
Returns:
the ratio
 o square
 public static Complex square(Complex z)
Squares an input complex number.

Parameters:
z - the complex number to square
Returns:
its square
 o sqrt
 public static Complex sqrt(Complex z)
Computes the square root of an input complex number

Parameters:
z - the number whose square root to compute
Returns:
s the square root
 o argument
 public static double argument(Complex z)
Compute the argument of a complex number, in the range (-pi,pi].

Parameters:
z - the complex number to examine
Returns:
its argument
 o argument
 public double argument()
Compute this's argument.

Returns:
this's argument
 o conj
 public static Complex conj(Complex z)
Computes the complex conjugate of the input complex number.

Parameters:
z - the complex number to conjugate
Returns:
the conjugate
 o conj
 public Complex conj()
Computes this's complex conjugate.

Returns:
this's conjugate
 o modulus
 public static double modulus(Complex z)
Computes the modulus of an input complex number.

Parameters:
z - the number whose modulus to compute
Returns:
the modulus
 o modulus
 public double modulus()
Compute this's modulus.

Returns:
this's modulus
 o modsq
 public static double modsq(Complex z)
Compute the modulus squared of a complex number.

Parameters:
z - the number whose modulus squared to compute
Returns:
the modulus square
 o modsq
 public double modsq()
Compute this's modulus squared.

Returns:
this's modulus squared
 o stringToComplex
 public static Complex stringToComplex(String s)
Convert an input string to a complex number. Really should throw a NumberFormatException if the string has an inappropriate form (which would then have to be caught wherever this method is used!); instead, returns the complex number i in such cases. Valid format of a string is two numbers separated by a comma, indicating the real and imaginary parts, respectively, of the complex number.

Parameters:
the - string to convert
Returns:
the complex number corresponding to that string
 o distsq
 public static double distsq(Complex a,
                             Complex b)
Computes the square of the distance between two complex numbers.

Parameters:
a - one input complex number
b - and another
Returns:
the square of the distance
 o DoubleToString
 public static String DoubleToString(double d)
The default invocation of DoubleToString has DOUBLEDIGITS of precision.

Parameters:
d - the double to be stringified
Returns:
the string version
 o DoubleToString
 public static String DoubleToString(double d,
                                     int res)
Converts a double to a string with a certain number of digits of precision.

Parameters:
d - the double to convert
res - the number of digits of precision to use
 o toString
 public String toString()
Convert this complex number to a string, with the real and imaginary parts separated by a comma.

Returns:
the string version of this complex number
Overrides:
toString in class Object
 o make_z11
 public static Complex make_z11(Complex trace)
Compute the (1,1) entry of the canonical matrix with given trace. Answer will be the x such that x+x^{-1}=trace, in fact the one chosen to have modulus greater than or equal to one.

Parameters:
trace - the trace of the matrix we are interested in
Returns:
the (1,1) entry of the corresponding canonical matrix
 o make_maxpow
 public static int make_maxpow(Complex trace,
                               Complex z11)
Compute the maxpow corresponding to the current trace and previously calculated (1,1) entry. For purely hyerpbolic and parabolic elements, always returns 1; for elliptic, returns half the order of the element, up to value MAXELLIPORD; for loxodromic elements, the result is valid for Ford domains, but is not known to be correct for Dirichlet domains -- although we use it in that case as well.

Parameters:
trace - the current trace
z11 - the (1,1) entry of the generator with that trace
Returns:
the corresponding Ford domain maxpow