JSci.maths.analysis.ComplexExponential Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsci Show documentation
Show all versions of jsci Show documentation
JSci is a set of open source Java packages. The aim is to encapsulate scientific methods/principles in the most natural way possible. As such they should greatly aid the development of scientific based software.
It offers: abstract math interfaces, linear algebra (support for various matrix and vector types), statistics (including probability distributions), wavelets, newtonian mechanics, chart/graph components (AWT and Swing), MathML DOM implementation, ...
Note: some packages, like javax.comm, for the astro and instruments package aren't listed as dependencies (not available).
The newest version!
package JSci.maths.analysis;
import JSci.maths.Complex;
/**
* The complex exponential function.
* @version 1.0
* @author Mark Hale
*/
public class ComplexExponential extends ComplexFunction {
private final Complex A;
private final Complex w;
/**
* Constructs an exponential function of the form exp(iz)
.
*/
public ComplexExponential() {
A = Complex.ONE;
w = Complex.ONE;
}
/**
* Constructs an exponential function of the form A exp(iwz)
.
*/
public ComplexExponential(Complex A, Complex w) {
this.A = A;
this.w = w;
}
public Complex map(double x, double y) {
final double iwzRe = -(w.imag()*x + w.real()*y);
final double iwzIm = w.real()*x - w.imag()*y;
return A.multiply(new Complex(
Math.exp(iwzRe)*Math.cos(iwzIm),
Math.exp(iwzRe)*Math.sin(iwzIm)
));
}
public Complex map(Complex z) {
return map(z.real(), z.imag());
}
public ComplexFunction differentiate() {
return new ComplexExponential(A.multiply(Complex.I.multiply(w)), w);
}
public ComplexFunction integrate() {
return new ComplexExponential(A.divide(Complex.I.multiply(w)), w);
}
}