Skip to content
Reference > Classes

Complex

Definition

Complex var = .... ;

Extends

Extended By

None

Description

A number with a real and imaginary component.

Method Summary

Owner Name Return Type Description
Complex constructor(real, imaginary) Complex Initialize a complex number as a Complex object. Must provide the real and imaginary components.
Complex getAbsolute() Double Returns the absolute value, or modulus, of this complex number.
Object getClassName() String Returns the string name of this object's class type.
Complex getConjugate() Complex Returns the complex conjugate value of the complex number.
Complex getCos() Complex Returns the cosine of the supplied complex number.
Complex getCosh() Complex Returns the hyperbolic cosine of the supplied complex number.
Complex getExponential() Complex Returns e raised to the power of the supplied complex number.
Complex getImaginary() Double Returns the imaginary (i) component of the complex number.
Complex getLogarithm() Complex Returns the natural log of the supplied complex value.
Complex getNegative() Complex Returns the negative value of the supplied complex number.
Complex getReal() Double Returns the real (non i) component of the complex number.
Complex getSin() Complex Returns the sine of the supplied complex number.
Complex getSinh() Complex Returns the hyperbolic sine of the supplied complex number.
Complex getSqrt() Complex Returns the square root of the supplied complex number.
Complex getTan() Complex Returns the tangent of the supplied complex number.
Object toJson() String Returns a string of a json representation of this object.

Method Definitions


constructor(real,imaginary)

Complex complex = new Complex(Number real, Number imaginary)

Description

Initialize a complex number as a Complex object. Must provide the real and imaginary components.

Parameter Definition

Name Type Description
real Number  value of real part
imaginary Number  value of imaginary part

Example 1

1
2
3
4
5
Complex c1 = new Complex(1,2);
Complex c2 = 1+2i;

// c1.getClassName() = Complex
// c2.getClassName() = Complex

These two statements are equivalent.


getAbsolute()

Double Complex::getAbsolute()

Description

Returns the absolute value, or modulus, of this complex number.

Example 1

1
2
3
4
Complex c = 3+4i;
c.getAbsolute();

// c.getAbsolute() = 5.0

getClassName()

String Object::getClassName()

Description

Returns the string name of this object's class type.


getConjugate()

Complex Complex::getConjugate()

Description

Returns the complex conjugate value of the complex number.

Example 1

1
2
3
4
Complex c = 3+4i;
c.getConjugate();

// c.getConjugate() = 3.0-4.0i

getCos()

Complex Complex::getCos()

Description

Returns the cosine of the supplied complex number.

Example 1

1
2
3
4
Complex c = 3+4i;
c.getCos();

// c.getCos() = -27.034945603074224-3.851153334811777i

getCosh()

Complex Complex::getCosh()

Description

Returns the hyperbolic cosine of the supplied complex number.

Example 1

1
2
3
4
Complex c = 3+4i;
c.getCosh();

// c.getCosh() = -6.580663040551157-7.581552742746545i

getExponential()

Complex Complex::getExponential()

Description

Returns e raised to the power of the supplied complex number.

Example 1

1
2
3
4
Complex c = 3+4i;
c.getExponential();

// c.getExponential() = -13.128783081462158-15.200784463067954i

getImaginary()

Double Complex::getImaginary()

Description

Returns the imaginary (i) component of the complex number.

Example 1

1
2
3
4
Complex c = 1+2i;
c.getImaginary();

// c.getImaginary() = 2.0

getLogarithm()

Complex Complex::getLogarithm()

Description

Returns the natural log of the supplied complex value.

Example 1

1
2
3
4
Complex c = 3+4i;
c.getLogarithm();

// c.getLogarithm() = 1.6094379124341003+0.9272952180016122i

getNegative()

Complex Complex::getNegative()

Description

Returns the negative value of the supplied complex number.

Example 1

1
2
3
4
Complex c = 3+4i;
c.getNegative();

// c.getNegative() = -3.0-4.0i

getReal()

Double Complex::getReal()

Description

Returns the real (non i) component of the complex number.

Example 1

1
2
3
4
Complex c = 1+2i;
c.getReal();

// c.getReal() = 1.0

getSin()

Complex Complex::getSin()

Description

Returns the sine of the supplied complex number.

Example 1

1
2
3
4
Complex c = 3+4i;
c.getSin();

// c.getSin() = 3.853738037919377-27.016813258003932i

getSinh()

Complex Complex::getSinh()

Description

Returns the hyperbolic sine of the supplied complex number.

Example 1

1
2
3
4
Complex c = 3+4i;
c.getSinh();

// c.getSinh() = -6.5481200409110025-7.61923172032141i

getSqrt()

Complex Complex::getSqrt()

Description

Returns the square root of the supplied complex number.

Example 1

1
2
3
4
Complex c = 3+4i;
c.getSqrt();

// c.getSqrt() = 2.0+1.0i

getTan()

Complex Complex::getTan()

Description

Returns the tangent of the supplied complex number.

Example 1

1
2
3
4
Complex c = 3+4i;
c.getTan();

// c.getTan() = -1.8734620462949032E-4+0.9993559873814729i

toJson()

String Object::toJson()

Description

Returns a string of a json representation of this object.