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.
- Author:
- Jonathan A. Poritz
-
DOUBLEDIGITS
- The default number of digits to display in formatted coversion of
Doubles to Strings.
-
FOUR
- The complex constant 4.
-
I
- The complex constant i.
-
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.
-
MAXELLIPORD
- An cutoff for the calculation of orders of elliptic elements.
-
MAXPOWMAX
- The cutoff for calculated maxpows -- above this value we arbitrarily
truncate down to this.
-
MINUS_I
- The complex constant -i.
-
MINUS_ONE
- The complex constant -1.
-
ONE
- The complex constant 1.
-
period
- A string containing one period for formatting Double.toString
output to a certain number of decimal digits.
-
TWO
- The complex constant 2.
-
x
- The real part of this complex number.
-
y
- The imaginary part of this complex number.
-
ZERO
- The complex constant 0.
-
Complex()
- Constructor for the complex number zero.
-
Complex(Complex)
- Constructor for a complex number identical to one given as input.
-
Complex(double, double)
- Constructor for an arbitrary complex number.
-
add(Complex, Complex)
- Compute the sum of two complex numbers.
-
argument()
- Compute this's argument.
-
argument(Complex)
- Compute the argument of a complex number, in the range (-pi,pi].
-
conj()
- Computes this's complex conjugate.
-
conj(Complex)
- Computes the complex conjugate of the input complex number.
-
distsq(Complex, Complex)
- Computes the square of the distance between two complex numbers.
-
divide(Complex, Complex)
- Divides one input complex number by another.
-
DoubleToString(double)
- The default invocation of DoubleToString has DOUBLEDIGITS of
precision.
-
DoubleToString(double, int)
- Converts a double to a string with a certain number of digits of
precision.
-
make_maxpow(Complex, Complex)
- Compute the maxpow corresponding to the current trace and previously
calculated (1,1) entry.
-
make_z11(Complex)
- Compute the (1,1) entry of the canonical matrix with given trace.
-
modsq()
- Compute this's modulus squared.
-
modsq(Complex)
- Compute the modulus squared of a complex number.
-
modulus()
- Compute this's modulus.
-
modulus(Complex)
- Computes the modulus of an input complex number.
-
multiply(Complex, Complex)
- Multiplies one input complex number by another.
-
sqrt(Complex)
- Computes the square root of an input complex number
-
square(Complex)
- Squares an input complex number.
-
stringToComplex(String)
- Convert an input string to a complex number.
-
subtract(Complex, Complex)
- Compute the difference of two complex numbers.
-
toString()
- Convert this complex number to a string, with the real and imaginary
parts separated by a comma.
x
public double x
- The real part of this complex number.
y
public double y
- The imaginary part of this complex number.
ZERO
public static final Complex ZERO
- The complex constant 0.
ONE
public static final Complex ONE
- The complex constant 1.
TWO
public static final Complex TWO
- The complex constant 2.
FOUR
public static final Complex FOUR
- The complex constant 4.
MINUS_ONE
public static final Complex MINUS_ONE
- The complex constant -1.
I
public static final Complex I
- The complex constant i.
MINUS_I
public static final Complex MINUS_I
- The complex constant -i.
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.
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.
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.
period
public static final String period
- A string containing one period for formatting Double.toString
output to a certain number of decimal digits.
DOUBLEDIGITS
public static final int DOUBLEDIGITS
- The default number of digits to display in formatted coversion of
Doubles to Strings.
Complex
public Complex()
- Constructor for the complex number zero.
Complex
public Complex(double xx,
double yy)
- Constructor for an arbitrary complex number.
- Parameters:
- xx - the real part
- yy - the imaginary part
Complex
public Complex(Complex z)
- Constructor for a complex number identical to one given as input.
- Parameters:
- z - the complex number to duplicate
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
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
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
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
square
public static Complex square(Complex z)
- Squares an input complex number.
- Parameters:
- z - the complex number to square
- Returns:
- its square
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
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
argument
public double argument()
- Compute this's argument.
- Returns:
- this's argument
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
conj
public Complex conj()
- Computes this's complex conjugate.
- Returns:
- this's conjugate
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
modulus
public double modulus()
- Compute this's modulus.
- Returns:
- this's modulus
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
modsq
public double modsq()
- Compute this's modulus squared.
- Returns:
- this's modulus squared
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
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
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
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
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
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
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