Package ffx.numerics.math
Class ComplexNumber
java.lang.Object
ffx.numerics.math.ComplexNumber
ComplexNumber class.
- Since:
- 1.0
- Author:
- Timothy D. Fenn
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for ComplexNumber.ComplexNumber(double real, double imag) Constructor for ComplexNumber. -
Method Summary
Modifier and TypeMethodDescriptiondoubleabs()absReturn a new Complex object whose value is the conjugate of this.voidconjugateIPvoidcopycos()Return a new Complex object whose value is the complex cosine of this.Return a / b.exp()Return a new Complex object whose value is the complex exponential of this.doubleim()imvoidim(double im) imReturn a new Complex object whose value is (this - b).voidminusIPdoublephase()phasephaseShift(double s) phaseShiftstatic ComplexNumberphaseShift(ComplexNumber a, double s) Static version of phaseShift.voidphaseShiftIP(double s) phaseShiftIPReturn a new Complex object whose value is (this + b).voidplusIPdoublere()revoidre(double re) reReturn a new Complex object whose value is the reciprocal of this.voidreciprocalIPsin()Return a new Complex object whose value is the complex sine of this.tan()Return a new Complex object whose value is the complex tangent of this.times(double alpha) Return a new object whose value is (this * alpha).Return a new Complex object whose value is (this * b).voidtimesIP(double alpha) timesIPvoidtimesIPtoString()
-
Constructor Details
-
ComplexNumber
public ComplexNumber()Constructor for ComplexNumber. -
ComplexNumber
public ComplexNumber(double real, double imag) Constructor for ComplexNumber.- Parameters:
real- a double.imag- a double.
-
-
Method Details
-
phaseShift
Static version of phaseShift.- Parameters:
a- aComplexNumberobject.s- a double.- Returns:
- a
ComplexNumberobject.
-
abs
public double abs()abs- Returns:
- a double.
-
conjugate
Return a new Complex object whose value is the conjugate of this.- Returns:
- a
ComplexNumberobject.
-
conjugateIP
public void conjugateIP()conjugateIP -
copy
copy- Parameters:
b- aComplexNumberobject.
-
cos
Return a new Complex object whose value is the complex cosine of this.- Returns:
- a
ComplexNumberobject.
-
divides
Return a / b.- Parameters:
b- aComplexNumberobject.- Returns:
- a
ComplexNumberobject.
-
exp
Return a new Complex object whose value is the complex exponential of this.- Returns:
- a
ComplexNumberobject.
-
im
public double im()im- Returns:
- a double.
-
im
public void im(double im) im- Parameters:
im- a double.
-
minus
Return a new Complex object whose value is (this - b).- Parameters:
b- aComplexNumberobject.- Returns:
- a
ComplexNumberobject.
-
minusIP
minusIP- Parameters:
b- aComplexNumberobject.
-
phase
public double phase()phase- Returns:
- a double.
-
phaseShift
phaseShift- Parameters:
s- a double.- Returns:
- a
ComplexNumberobject.
-
phaseShiftIP
public void phaseShiftIP(double s) phaseShiftIP- Parameters:
s- a double.
-
plus
Return a new Complex object whose value is (this + b).- Parameters:
b- aComplexNumberobject.- Returns:
- a
ComplexNumberobject.
-
plusIP
plusIP- Parameters:
b- aComplexNumberobject.
-
re
public double re()re- Returns:
- a double.
-
re
public void re(double re) re- Parameters:
re- a double.
-
reciprocal
Return a new Complex object whose value is the reciprocal of this.- Returns:
- a
ComplexNumberobject.
-
reciprocalIP
public void reciprocalIP()reciprocalIP -
sin
Return a new Complex object whose value is the complex sine of this.- Returns:
- a
ComplexNumberobject.
-
tan
Return a new Complex object whose value is the complex tangent of this.- Returns:
- a
ComplexNumberobject.
-
times
Return a new Complex object whose value is (this * b).- Parameters:
b- aComplexNumberobject.- Returns:
- a
ComplexNumberobject.
-
times
Return a new object whose value is (this * alpha).- Parameters:
alpha- a double.- Returns:
- a
ComplexNumberobject.
-
timesIP
timesIP- Parameters:
b- aComplexNumberobject.
-
timesIP
public void timesIP(double alpha) timesIP- Parameters:
alpha- a double.
-
toString
-