jhplot.math
Class Complex
- java.lang.Object
-
- jhplot.math.Complex
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class Complex extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable
Complex implements a complex number and defines complex arithmetic and mathematical functions Last Updated February 27, 2001 Copyright 1997-2001- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description Complex(double u, double v)
Constructs the complex number z = u + i*v
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description double
arg()
Argument of this Complex number (the angle in radians with the x-axis in polar coordinates).Complex
chs()
Negative of this complex number (chs stands for change sign).java.lang.Object
clone()
Complex
conj()
Complex conjugate of this Complex number (the conjugate of x+i*y is x-i*y).Complex
cos()
Cosine of this Complex number (doesn't change this Complex number).Complex
cosh()
Hyperbolic cosine of this Complex number (doesn't change this Complex number).Complex
div(Complex w)
Division of Complex numbers (doesn't change this Complex number).Complex
divide(double k)
Returns this complex divided by the specified factor.Complex
exp()
Complex exponential (doesn't change this Complex number).double
imag()
Imaginary part of this Complex number (the y-coordinate in rectangular coordinates).Complex
log()
Principal branch of the Complex logarithm of this Complex number.Complex
minus(Complex w)
Subtraction of Complex numbers (doesn't change this Complex number).Complex
minusReal(double w)
Subtraction from real partdouble
mod()
Modulus of this Complex number (the distance from the origin in polar coordinates).Complex
plus(Complex w)
Addition of Complex numbers (doesn't change this Complex number).double
real()
Real part of this Complex number (the x-coordinate in rectangular coordinates).Complex
sin()
Sine of this Complex number (doesn't change this Complex number).Complex
sinh()
Hyperbolic sine of this Complex number (doesn't change this Complex number).Complex
sqrt()
Complex square root (doesn't change this complex number).Complex
tan()
Tangent of this Complex number (doesn't change this Complex number).Complex
times(Complex w)
Complex multiplication (doesn't change this Complex number).Complex
times(double k)
Returns this complex multiplied by the specified factor.java.lang.String
toString()
String representation of this Complex number.
-
-
-
Constructor Detail
-
Complex
public Complex(double u, double v)
Constructs the complex number z = u + i*v- Parameters:
u
- Real partv
- Imaginary part
-
-
Method Detail
-
real
public double real()
Real part of this Complex number (the x-coordinate in rectangular coordinates).- Returns:
- Re[z] where z is this Complex number.
-
imag
public double imag()
Imaginary part of this Complex number (the y-coordinate in rectangular coordinates).- Returns:
- Im[z] where z is this Complex number.
-
mod
public double mod()
Modulus of this Complex number (the distance from the origin in polar coordinates).- Returns:
- |z| where z is this Complex number.
-
arg
public double arg()
Argument of this Complex number (the angle in radians with the x-axis in polar coordinates).- Returns:
- arg(z) where z is this Complex number.
-
conj
public Complex conj()
Complex conjugate of this Complex number (the conjugate of x+i*y is x-i*y).- Returns:
- z-bar where z is this Complex number.
-
plus
public Complex plus(Complex w)
Addition of Complex numbers (doesn't change this Complex number).
(x+i*y) + (s+i*t) = (x+s)+i*(y+t).- Parameters:
w
- is the number to add.- Returns:
- z+w where z is this Complex number.
-
minus
public Complex minus(Complex w)
Subtraction of Complex numbers (doesn't change this Complex number).
(x+i*y) - (s+i*t) = (x-s)+i*(y-t).- Parameters:
w
- is the number to subtract.- Returns:
- z-w where z is this Complex number.
-
minusReal
public Complex minusReal(double w)
Subtraction from real part- Parameters:
w
- real value for subtraction
-
times
public Complex times(Complex w)
Complex multiplication (doesn't change this Complex number).- Parameters:
w
- is the number to multiply by.- Returns:
- z*w where z is this Complex number.
-
times
public Complex times(double k)
Returns this complex multiplied by the specified factor.- Parameters:
k
- the factor multiplier.- Returns:
this * k
.
-
divide
public Complex divide(double k)
Returns this complex divided by the specified factor.- Parameters:
k
- the factor divisor.- Returns:
this / k
.
-
div
public Complex div(Complex w)
Division of Complex numbers (doesn't change this Complex number).
(x+i*y)/(s+i*t) = ((x*s+y*t) + i*(y*s-y*t)) / (s^2+t^2)- Parameters:
w
- is the number to divide by- Returns:
- new Complex number z/w where z is this Complex number
-
exp
public Complex exp()
Complex exponential (doesn't change this Complex number).- Returns:
- exp(z) where z is this Complex number.
-
log
public Complex log()
Principal branch of the Complex logarithm of this Complex number. (doesn't change this Complex number). The principal branch is the branch with -pi < arg <= pi.- Returns:
- log(z) where z is this Complex number.
-
sqrt
public Complex sqrt()
Complex square root (doesn't change this complex number). Computes the principal branch of the square root, which is the value with 0 <= arg < pi.- Returns:
- sqrt(z) where z is this Complex number.
-
sin
public Complex sin()
Sine of this Complex number (doesn't change this Complex number).
sin(z) = (exp(i*z)-exp(-i*z))/(2*i).- Returns:
- sin(z) where z is this Complex number.
-
cos
public Complex cos()
Cosine of this Complex number (doesn't change this Complex number).
cos(z) = (exp(i*z)+exp(-i*z))/ 2.- Returns:
- cos(z) where z is this Complex number.
-
sinh
public Complex sinh()
Hyperbolic sine of this Complex number (doesn't change this Complex number).
sinh(z) = (exp(z)-exp(-z))/2.- Returns:
- sinh(z) where z is this Complex number.
-
cosh
public Complex cosh()
Hyperbolic cosine of this Complex number (doesn't change this Complex number).
cosh(z) = (exp(z) + exp(-z)) / 2.- Returns:
- cosh(z) where z is this Complex number.
-
tan
public Complex tan()
Tangent of this Complex number (doesn't change this Complex number).
tan(z) = sin(z)/cos(z).- Returns:
- tan(z) where z is this Complex number.
-
chs
public Complex chs()
Negative of this complex number (chs stands for change sign). This produces a new Complex number and doesn't change this Complex number.
-(x+i*y) = -x-i*y.- Returns:
- -z where z is this Complex number.
-
clone
public java.lang.Object clone()
- Overrides:
clone
in classjava.lang.Object
-
toString
public java.lang.String toString()
String representation of this Complex number.- Overrides:
toString
in classjava.lang.Object
- Returns:
- x+i*y, x-i*y, x, or i*y as appropriate.
-
-
DMelt 3.0 © DataMelt by jWork.ORG