|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.gwoptics.mathutils.Complex
public class Complex
Complex is a class that provides complex numbers and a number of mathematical functions (dynamic and static) such as sqrt() and exp() for complex numbers.
Constructor Summary | |
---|---|
Complex(double re)
Additional constructor that returns a purely real complex number |
|
Complex(double re,
double im)
Additional constructor that return the user defined complex number |
Method Summary | |
---|---|
double |
abs()
This function computes the absolute of a complex number as |z|=sqrt(x^2+y^2). |
static double |
abs(Complex c)
This function computes the absolute of a complex number as |c|=sqrt(x^2+y^2). |
double |
absSquared()
This function returns the absolute square of a complex number as |z|^2=x^2+y^2. |
static double |
absSquared(Complex c)
This function computes the absolute square of a complex numbers as |c|^2=x^2+y^2. |
void |
add(Complex c)
This function add a complex number to a complex number as z=z+c. |
static Complex |
add(Complex a,
Complex b)
This function adds two complex numbers as z=a+b. |
void |
conj()
This function computes the complex conjugate of a complex number. |
static Complex |
conj(Complex z)
This function computes the complex conjugate of a complex number |
void |
divide(Complex b)
This function divides the complex number by a complex number. |
static Complex |
divide(Complex a,
Complex b)
This function computes the division of two complex numbers |
static Complex |
exp(Complex z)
This function computes the exponential of a complex number exp(z). |
static Complex |
expi(java.lang.Double phi)
This function computes the number exp( i phi ) |
double |
imag()
This function returns the imaginary part of the complex number. |
static double |
imag(Complex c)
This function returns the imaginary part of a complex number. |
void |
inv()
This function computes the inverse of the complex number |
static Complex |
inv(Complex z)
This function returns the inverse of a complex number |
boolean |
isEqual(Complex c)
This functions tests whether the Complex number is equal to another. |
static boolean |
isEqual(Complex a,
Complex b)
This function tests whether two Complex numbers are equal. |
boolean |
isNaN()
This funtions tests whether the complex number is `not a number' NaN. |
static boolean |
isNaN(Complex c)
This function tests whether a complex number is `not a number' NaN. |
static Complex |
log(Complex z)
This function computes the logarithm of a complex number |
java.lang.Double |
modulus()
This function computes the modulus of the complex number |
static java.lang.Double |
modulus(Complex z)
This function returns the modulus of a complex number |
void |
multiply(Complex b)
This function multiplies the complex number by a complex number. |
static Complex |
multiply(Complex a,
Complex b)
This function multiplies two complex numbers a*b. |
static Complex |
newAbsPhi(double amp,
double phi)
This function returns a new complex number set via amplitude and phase as amp*exp(i phi). |
static Complex |
pow(Complex z,
int nom,
int denom)
This function computes a rational power of a complex number z^(nom/denom). |
double |
real()
This function returns the real part of the complex number. |
static double |
real(Complex c)
This function returns the real part of a complex number. |
void |
scale(java.lang.Double x)
This function multiplies the complex number by a real number |
static Complex |
scale(java.lang.Double x,
Complex z)
This function multiplies a complex number by a real number |
void |
scaleAndDelay(double amp,
double phi)
This function multiplies the complex number by a real number and adds a phase delay as z=z*x*exp(i phi). |
static Complex |
scaleAndDelay(double amp,
double phi,
Complex z)
This function multiplies a complex number by another given by amplitude and phase as return = z * abs * exp (i phi). |
void |
set(double re,
double im)
This functions sets the real and imaginary part of the complex number. |
void |
setAbsPhi(double amp,
double phi)
This function sets the complex number via an amplitude and phase as amp*exp(i phi). |
void |
setImag(double im)
This function sets the imaginary part of the complex number. |
void |
setReal(double re)
This functions sets the real part of the complex number |
Complex |
sqrt()
This function computes the square root of the complex number |
static Complex |
sqrt(Complex z)
This function returns the sqaure root of a complex number. |
void |
squared()
This function computes the square of the complex number as (x + i y)*(x + i y) |
static Complex |
squared(Complex c)
This function computes the square of a complex number as (x + i y) * (x + i y) |
java.lang.String |
toString()
This function converts a complex number into a String "x + y i" with x being the real and y the imaginary part. |
static java.lang.String |
toString(Complex z)
This function converts a complex number into a String "x + y i" with x being the real and y the imaginary part. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Complex(double re, double im)
re
- real partim
- imaginary partpublic Complex(double re)
re
- real partMethod Detail |
---|
public void set(double re, double im)
re
- real partim
- imaginary partpublic void setReal(double re)
re
- real partpublic void setImag(double im)
im
- imaginary partpublic void setAbsPhi(double amp, double phi)
amp
- amplitudephi
- phasepublic static Complex newAbsPhi(double amp, double phi)
amp
- amplitudephi
- phase
public void add(Complex c)
c
- complex numberpublic static Complex add(Complex a, Complex b)
a
- complex numberb
- complex number
public void squared()
public static Complex squared(Complex c)
c
- complex number
public double absSquared()
public static double absSquared(Complex c)
c
- complex number
public double abs()
public static double abs(Complex c)
c
- complex number
public double real()
public static double real(Complex c)
c
- complex number
public double imag()
public static double imag(Complex c)
c
- complex number
public Complex sqrt()
public static Complex sqrt(Complex z)
z
- complex number
public void inv()
public static Complex inv(Complex z)
z
- complex number
public java.lang.Double modulus()
public static java.lang.Double modulus(Complex z)
z
- complex number
public void multiply(Complex b)
b
- complex numberpublic static Complex multiply(Complex a, Complex b)
a
- complex numberb
- complex number
public void divide(Complex b)
b
- complex numberpublic static Complex divide(Complex a, Complex b)
a
- complex numberb
- complex number
public void conj()
public static Complex conj(Complex z)
z
- complex number
public void scale(java.lang.Double x)
x
- multiplier (real number)public static Complex scale(java.lang.Double x, Complex z)
x
- multiplier (real number)z
- complex number
public void scaleAndDelay(double amp, double phi)
amp
- multiplier (real number)phi
- phase [rad]public static Complex scaleAndDelay(double amp, double phi, Complex z)
amp
- phi
- z
-
public static Complex pow(Complex z, int nom, int denom)
z
- complex numbernom
- nomiator of exponentdenom
- denominator of exponent
public static Complex log(Complex z)
z
- complex number
public static Complex exp(Complex z)
z
- complex number
public static Complex expi(java.lang.Double phi)
phi
- phase
public boolean isNaN()
public static boolean isNaN(Complex c)
c
- complex number
public boolean isEqual(Complex c)
c
- complex number
public static boolean isEqual(Complex a, Complex b)
a
- complex numberb
- complex number
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.String toString(Complex z)
z
- complex number
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |