vmm3d.core
Class Complex
- java.lang.Object
-
- vmm3d.core.Complex
-
public class Complex extends java.lang.ObjectA complex number, with a real and an imaginary part. (Possibley to be replaced with a class that has better support for complex arithmetic and functions of a complex variable.)
-
-
Field Summary
Fields Modifier and Type Field and Description static ComplexI_Cdoubleimstatic ComplexONE_Cdoublerestatic ComplexZERO_C
-
Constructor Summary
Constructors Constructor and Description Complex()Create a complex number initially equal to zeroComplex(Complex c)Create a new complex number that is initially equal to a given complex number.Complex(double x)Create a complex number initially equal to the real number x.Complex(double x, double y)Create a complex number initially equal to x + iy
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description doubleabs2()Returns the absolute value squared of this.voidassign_PlusTimes(Complex a, Complex b)voidassign_PlusTimes(Complex a, double d)voidassign(Complex c)voidassign(double x, double y)voidassignDivide(Complex c)voidassignInvert()voidassignMinus(Complex c)voidassignPlus(Complex c)voidassignPlus(Complex a, Complex b)voidassignPlusTimes(Complex a, Complex b)voidassignPow(Complex z, double x)voidassignTimes_PlusTimes(Complex a, Complex b, double d)voidassignTimes(Complex c)voidassignTimes(Complex a, Complex b)voidassignTimes(Complex c, double d)voidassignTimes(double d)voidassignTimesPlus(Complex a, Complex b)voidassignTimesTimes(Complex a, double d)ComplexcomplexLinComb(Complex a, Complex b, Complex c)z.complexLinComb(a,b,c) returns a*z+b*c, Complex a,b;Complexconj()Computes the conjugate of a complex number.doublecosh(double x)doubledet(Complex c)ComplexdividedBy(Complex c)Returns this / c; c must be non-null.ComplexdividedBy(double x)doubledot(Complex c)z.dot(c) returns the scalar product z.re*c.re + z.im*c.imbooleanequals(java.lang.Object obj)Returns true if obj is equal to this complex number.Complexexponential()Computes the complex exponential function, e^z, where z is this complex number.ComplexintegerPower(int k)Returns new Complex(this^k), for |k|< 9 using multiplication, for larger |k| using exp(k*log(this))ComplexintegerRoot(int k)Returns a complex k-th root of this complex number.Complexinverse()Computes the complex reciprocal function, 1/z, where z is this complex number.Complexinvert()Complexlog()ComplexlogNearer(Complex previous)Computes that complex logarithm of this complex number that is nearest to previous.Complexminus(Complex c)Returns this - c; c must be non-null.Complexminus(double x)Complexmobius1_1(double r)The Moebius transformation ((1+r)z + r)/(rz + 1+r) has +1,-1 as fixed points.Complexplus(Complex c)Returns this + c; c must be non-null.Complexplus(double x)static Complexpolar(double r, double theta)Returns the complex number (r*cos(theta)) + i*(r*sin(theta)).Complexpower(double x)doubler()Returns the absolute value, "r" in polar coordinates, of this.ComplexrealLinComb(double a, double b, Complex c)z.realLinComb(a,b,c) returns a*z+b*c, double a,b;Complexsine()doublesinh(double x)ComplexsquareRootNearer(Complex previous)Computes that square root of this complex number that is nearer to previous than to minus previous.double[]stereographicProjection()doubletheta()Returns arg(this), the angular polar coordinate of this complex number, in the range -pi to pi.Complextimes(Complex c)Returns this * c; c must be non-null.Complextimes(double x)java.lang.StringtoString()Returns a string representation of the form a, i, -i, i*b, -i*b, a + i, a - i, a + i*b, or a - i*b.
-
-
-
Field Detail
-
ZERO_C
public static final Complex ZERO_C
-
ONE_C
public static final Complex ONE_C
-
I_C
public static final Complex I_C
-
re
public double re
-
im
public double im
-
-
Constructor Detail
-
Complex
public Complex()
Create a complex number initially equal to zero
-
Complex
public Complex(double x)
Create a complex number initially equal to the real number x.
-
Complex
public Complex(double x, double y)Create a complex number initially equal to x + iy
-
Complex
public Complex(Complex c)
Create a new complex number that is initially equal to a given complex number.- Parameters:
c- The complex number to be copied. If null, it is treated as zero.
-
-
Method Detail
-
equals
public boolean equals(java.lang.Object obj)
Returns true if obj is equal to this complex number. If obj is null or is not of type Complex, the return value is false.- Overrides:
equalsin classjava.lang.Object
-
conj
public Complex conj()
Computes the conjugate of a complex number.
-
polar
public static Complex polar(double r, double theta)
Returns the complex number (r*cos(theta)) + i*(r*sin(theta)).
-
times
public Complex times(double x)
-
plus
public Complex plus(double x)
-
minus
public Complex minus(double x)
-
dividedBy
public Complex dividedBy(double x)
-
realLinComb
public Complex realLinComb(double a, double b, Complex c)
z.realLinComb(a,b,c) returns a*z+b*c, double a,b;
-
complexLinComb
public Complex complexLinComb(Complex a, Complex b, Complex c)
z.complexLinComb(a,b,c) returns a*z+b*c, Complex a,b;
-
dot
public double dot(Complex c)
z.dot(c) returns the scalar product z.re*c.re + z.im*c.im
-
abs2
public double abs2()
Returns the absolute value squared of this.- Returns:
- real part squared plus imaginary part squared
-
r
public double r()
Returns the absolute value, "r" in polar coordinates, of this.- Returns:
- the square root of (real part squared plus imaginary part squared)
-
theta
public double theta()
Returns arg(this), the angular polar coordinate of this complex number, in the range -pi to pi. The return value is simply Math.atan2(imaginary part, real part).
-
exponential
public Complex exponential()
Computes the complex exponential function, e^z, where z is this complex number.
-
inverse
public Complex inverse()
Computes the complex reciprocal function, 1/z, where z is this complex number.
-
log
public Complex log()
-
logNearer
public Complex logNearer(Complex previous)
Computes that complex logarithm of this complex number that is nearest to previous. A test code is in fractals.TestAnalyticContinuation.
-
sinh
public double sinh(double x)
-
cosh
public double cosh(double x)
-
sine
public Complex sine()
-
power
public Complex power(double x)
-
integerPower
public Complex integerPower(int k)
Returns new Complex(this^k), for |k|< 9 using multiplication, for larger |k| using exp(k*log(this))
-
integerRoot
public Complex integerRoot(int k)
Returns a complex k-th root of this complex number. The root that is returned is the one with the smallest positive arg. (If k is 0, the return value is 1. If k is negative, the value is 1/integerRoot(-k).)
-
squareRootNearer
public Complex squareRootNearer(Complex previous)
Computes that square root of this complex number that is nearer to previous than to minus previous. A test code is in fractals.TestAnalyticContinuation.
-
mobius1_1
public Complex mobius1_1(double r)
The Moebius transformation ((1+r)z + r)/(rz + 1+r) has +1,-1 as fixed points. It maps the real line and the unit circle to itsself
-
stereographicProjection
public double[] stereographicProjection()
-
assign
public void assign(double x, double y)
-
toString
public java.lang.String toString()
Returns a string representation of the form a, i, -i, i*b, -i*b, a + i, a - i, a + i*b, or a - i*b. (Except when the real or imaginary part is undefined or infinite, the form is "(re) + i*(im)" where NaN, +INF, and -INF are used to indicate undefined and infinite values.)- Overrides:
toStringin classjava.lang.Object
-
assign
public void assign(Complex c)
-
det
public double det(Complex c)
-
assignTimes
public void assignTimes(double d)
-
assignInvert
public void assignInvert()
-
assignPow
public void assignPow(Complex z, double x)
-
assignPlus
public void assignPlus(Complex c)
-
assignMinus
public void assignMinus(Complex c)
-
assignTimes
public void assignTimes(Complex c, double d)
-
assignTimes
public void assignTimes(Complex c)
-
assignDivide
public void assignDivide(Complex c)
-
assignTimesTimes
public void assignTimesTimes(Complex a, double d)
-
assign_PlusTimes
public void assign_PlusTimes(Complex a, double d)
-
invert
public Complex invert()
-
-
DMelt 3.0 © DataMelt by jWork.ORG