QScript  2.1
Expression and algorithm evaluator
 All Classes Namespaces Functions Variables Pages
org.qscript.Complex Class Reference

Public Member Functions

 Complex ()
 
 Complex (Complex z)
 
 Complex (double real)
 
 Complex (double real, double imag)
 
double abs ()
 
Complex acos ()
 
Complex acosh ()
 
Complex add (Complex z)
 
Complex add (double s)
 
double arg ()
 
Complex asin ()
 
Complex asinh ()
 
Complex atan ()
 
Complex atanh ()
 
Complex cbrt ()
 
Complex conj ()
 
Complex cos ()
 
Complex cosec ()
 
Complex cosech ()
 
Complex cosh ()
 
Complex cot ()
 
Complex coth ()
 
Complex cubed ()
 
Complex div (Complex z)
 
Complex div (double s)
 
boolean equals (Complex z)
 
boolean equals (Object obj)
 
Complex exp ()
 
boolean isZero ()
 
Complex log ()
 
double mag ()
 
Complex mult (Complex z)
 
Complex mult (double s)
 
Complex negative ()
 
Complex norm ()
 
Complex pow (Complex z2)
 
Complex pow (double s)
 
Complex sin ()
 
Complex sinh ()
 
Complex sqrt ()
 
Complex squared ()
 
Complex sub (Complex z)
 
Complex sub (double s)
 
Complex tan ()
 
Complex tanh ()
 
String toString ()
 

Static Public Member Functions

static double abs (Complex z)
 
static Complex acos (Complex z)
 
static Complex acosh (Complex z)
 
static Complex add (Complex z1, Complex z2)
 
static Complex add (Complex z, double s)
 
static Complex add (double s, Complex z)
 
static double arg (Complex z)
 
static Complex asin (Complex z)
 
static Complex asinh (Complex z)
 
static Complex atan (Complex z)
 
static Complex atanh (Complex z)
 
static Complex cbrt (Complex z)
 
static Complex conj (Complex z)
 
static Complex cos (Complex z)
 
static Complex cosec (Complex z)
 
static Complex cosech (Complex z)
 
static Complex cosh (Complex z)
 
static Complex cot (Complex z)
 
static Complex coth (Complex z)
 
static Complex cubed (Complex z)
 
static Complex div (Complex z1, Complex z2)
 
static Complex div (Complex z, double s)
 
static Complex div (double s, Complex z)
 
static Complex exp (Complex z)
 
static Complex lerp (Complex c1, Complex c2, double t)
 
static Complex log (Complex z)
 
static double mag (Complex z)
 
static Complex mult (Complex z1, Complex z2)
 
static Complex mult (Complex z, double s)
 
static Complex mult (double s, Complex z)
 
static Complex negative (Complex z)
 
static Complex norm (Complex z)
 
static Complex pow (Complex z1, Complex z2)
 
static Complex pow (Complex z, double s)
 
static Complex sec (Complex z)
 
static Complex sech (Complex z)
 
static Complex sin (Complex z)
 
static Complex sinh (Complex z)
 
static Complex sqrt (Complex z)
 
static Complex squared (Complex z)
 
static Complex sub (Complex z1, Complex z2)
 
static Complex sub (Complex z, double s)
 
static Complex sub (double s, Complex z)
 
static Complex tan (Complex z)
 
static Complex tanh (Complex z)
 

Public Attributes

final double real
 
final double imag
 

Detailed Description

Immutable class used to represent complex numbers.

The original author(s) and origin of this class has been lost in time but it has been modified to include both static and instance methods for all calculations, and made immutable.

Peter Lager 2016

Author
Unknown

Constructor & Destructor Documentation

org.qscript.Complex.Complex ( )

Default constructor Creates the complex number 0 + 0i

org.qscript.Complex.Complex ( Complex  z)

Copy constructor Creates the complex number z.real + z.imag i

org.qscript.Complex.Complex ( double  real)

Constructor Creates the complex number real + 0i

org.qscript.Complex.Complex ( double  real,
double  imag 
)

Constructor Creates the complex number real + imag i

Member Function Documentation

static double org.qscript.Complex.abs ( Complex  z)
static

Returns the absolute value or magnitude of a complex number

double org.qscript.Complex.abs ( )

Returns the absolute value or magnitude of a complex number

static Complex org.qscript.Complex.acos ( Complex  z)
static

Returns the acos of z

Complex org.qscript.Complex.acos ( )

Returns the acos of z

static Complex org.qscript.Complex.acosh ( Complex  z)
static

Returns the acosh of z

Complex org.qscript.Complex.acosh ( )

Returns the acosh

static Complex org.qscript.Complex.add ( Complex  z1,
Complex  z2 
)
static

Returns the sum of 2 complex numbers

static Complex org.qscript.Complex.add ( Complex  z,
double  s 
)
static

Returns the sum of a complex and a real number

static Complex org.qscript.Complex.add ( double  s,
Complex  z 
)
static

Returns the sum of a real and a complex number

Complex org.qscript.Complex.add ( Complex  z)

Returns the sum of this number and a complex number

Complex org.qscript.Complex.add ( double  s)

Returns the sum of this number and a scalar number

static double org.qscript.Complex.arg ( Complex  z)
static

Returns the arg (angle in the complex plane) of a complex number

double org.qscript.Complex.arg ( )

Returns the arg (angle in the complex plane)

static Complex org.qscript.Complex.asin ( Complex  z)
static

Returns the asin of z

Complex org.qscript.Complex.asin ( )

Returns the asin

static Complex org.qscript.Complex.asinh ( Complex  z)
static

Returns the asinh of z

Complex org.qscript.Complex.asinh ( )

Returns the asinh

static Complex org.qscript.Complex.atan ( Complex  z)
static

Returns the atan of z

Complex org.qscript.Complex.atan ( )

Returns the atan

static Complex org.qscript.Complex.atanh ( Complex  z)
static

Returns the atanh of z

Complex org.qscript.Complex.atanh ( )

Returns the atanh

static Complex org.qscript.Complex.cbrt ( Complex  z)
static

Returns the cube root of z

Complex org.qscript.Complex.cbrt ( )

Returns the cube root

static Complex org.qscript.Complex.conj ( Complex  z)
static

Returns the conjugate of z

Complex org.qscript.Complex.conj ( )

Returns the conjugate

static Complex org.qscript.Complex.cos ( Complex  z)
static

Returns the cos of z

Complex org.qscript.Complex.cos ( )

Returns the cos

static Complex org.qscript.Complex.cosec ( Complex  z)
static

Returns the cosec of z

Complex org.qscript.Complex.cosec ( )

Returns the cosec

static Complex org.qscript.Complex.cosech ( Complex  z)
static

Returns the cosech of z

Complex org.qscript.Complex.cosech ( )

Returns the cosech

static Complex org.qscript.Complex.cosh ( Complex  z)
static

Returns the cosh of z

Complex org.qscript.Complex.cosh ( )

Returns the cosh

static Complex org.qscript.Complex.cot ( Complex  z)
static

Returns the cot of z

Complex org.qscript.Complex.cot ( )

Returns the cot

static Complex org.qscript.Complex.coth ( Complex  z)
static

Returns the coth of z

Complex org.qscript.Complex.coth ( )

Returns the coth

static Complex org.qscript.Complex.cubed ( Complex  z)
static

Returns z^3

Complex org.qscript.Complex.cubed ( )

Returns z^3

static Complex org.qscript.Complex.div ( Complex  z1,
Complex  z2 
)
static

Returns the result of dividing z1 by z2

static Complex org.qscript.Complex.div ( Complex  z,
double  s 
)
static

Returns the result of dividing z by a scalar

static Complex org.qscript.Complex.div ( double  s,
Complex  z 
)
static

Returns the result of dividing a scalar by z

Complex org.qscript.Complex.div ( Complex  z)

Divide this by a complex number and return result

Complex org.qscript.Complex.div ( double  s)

Divide this by a scalar and return result

boolean org.qscript.Complex.equals ( Complex  z)

Compare 2 complex numbers for equality

boolean org.qscript.Complex.equals ( Object  obj)

Compares two complex numbers for equality

static Complex org.qscript.Complex.exp ( Complex  z)
static

Returns e to the power z

Complex org.qscript.Complex.exp ( )

Returns the exponential of this number (e^z)

boolean org.qscript.Complex.isZero ( )

Returns true is both real and imaginary parts are less than E

static Complex org.qscript.Complex.lerp ( Complex  c1,
Complex  c2,
double  t 
)
static

Linear interpretation between 2 complex numbers

static Complex org.qscript.Complex.log ( Complex  z)
static

Returns the natural log of z

Complex org.qscript.Complex.log ( )

Returns the natural log of z

double org.qscript.Complex.mag ( )

Multiply this by z and return the result

static Complex org.qscript.Complex.mult ( Complex  z1,
Complex  z2 
)
static

Returns z1 multiplied by z2

static Complex org.qscript.Complex.mult ( Complex  z,
double  s 
)
static

Returns a complex number multiplied by a scalar

static Complex org.qscript.Complex.mult ( double  s,
Complex  z 
)
static

Returns a scalar multiplied by a complex number

Complex org.qscript.Complex.mult ( Complex  z)

Multiply this by z and return the result

Complex org.qscript.Complex.mult ( double  s)

Multiply this by a scalar and return result

static Complex org.qscript.Complex.negative ( Complex  z)
static

Returns the negative value of z

Complex org.qscript.Complex.negative ( )

Returns the negative value

static Complex org.qscript.Complex.norm ( Complex  z)
static

Returns a Complex number which is the value of z normalised so the magnitude is 1

Complex org.qscript.Complex.norm ( )

Return a complex number of length 1 and the same angle

static Complex org.qscript.Complex.pow ( Complex  z1,
Complex  z2 
)
static

Returns this number raised to the power of z2

static Complex org.qscript.Complex.pow ( Complex  z,
double  s 
)
static

Returns this number raised to the power of a scalar

Complex org.qscript.Complex.pow ( Complex  z2)

Returns the number raised to the power of z2

Complex org.qscript.Complex.pow ( double  s)

Returns z raised to the power of a scalar

static Complex org.qscript.Complex.sec ( Complex  z)
static

Returns the sec of this number

static Complex org.qscript.Complex.sech ( Complex  z)
static

Returns the sech of this number

static Complex org.qscript.Complex.sin ( Complex  z)
static

Returns the sin of z

Complex org.qscript.Complex.sin ( )

Returns the sin of z

static Complex org.qscript.Complex.sinh ( Complex  z)
static

Returns the sinh of z

Complex org.qscript.Complex.sinh ( )

Returns the sinh

static Complex org.qscript.Complex.sqrt ( Complex  z)
static

Returns the square root of z

Complex org.qscript.Complex.sqrt ( )

Returns the square root of z

static Complex org.qscript.Complex.squared ( Complex  z)
static

Returns z^2

Complex org.qscript.Complex.squared ( )

Returns z^2

static Complex org.qscript.Complex.sub ( Complex  z1,
Complex  z2 
)
static

Returns difference between z1 and z2

static Complex org.qscript.Complex.sub ( Complex  z,
double  s 
)
static

Returns the z - scalar value

static Complex org.qscript.Complex.sub ( double  s,
Complex  z 
)
static

Returns the scalar value - z

Complex org.qscript.Complex.sub ( Complex  z)

Returns the result of subtracting a complex number from this number

Complex org.qscript.Complex.sub ( double  s)

Returns the result of subtracting a scalar number from this number

static Complex org.qscript.Complex.tan ( Complex  z)
static

Returns the tan of z

Complex org.qscript.Complex.tan ( )

Returns the tan

static Complex org.qscript.Complex.tanh ( Complex  z)
static

Returns the tanh of z

Complex org.qscript.Complex.tanh ( )

Returns the tanh

String org.qscript.Complex.toString ( )

Creates a string representation of this complex number