Complex.js

Defines the Complex class.

Description

The Complex class, just like the Polar class, is used by the Hypertree, ST and RGraph as a 2D point representation.

See also

http://en.wikipedia.org/wiki/Complex_number

Summary
Complex.jsDefines the Complex class.
ComplexA multi-purpose Complex Class with common methods.
Functions
getcReturns a complex number.
getpReturns a Polar representation of this number.
setSets a number.
setcSets a complex number.
setpSets a polar number.
cloneReturns a copy of the current object.
toPolarTransforms cartesian to polar coordinates.
normCalculates a Complex number norm.
squaredNormCalculates a Complex number squared norm.
addReturns the result of adding two complex numbers.
prodReturns the result of multiplying two Complex numbers.
conjugateReturns the conjugate of this Complex number.
scaleReturns the result of scaling a Complex instance.
equalsComparison method.
$addReturns the result of adding two Complex numbers.
$prodReturns the result of multiplying two Complex numbers.
$conjugateReturns the conjugate for this Complex.
$scaleReturns the result of scaling a Complex instance.
$divReturns the division of two Complex numbers.
isZeroReturns true if the number is zero.

Complex

A multi-purpose Complex Class with common methods.

Description

The Complex class, just like the Polar class, is used by the Hypertree, ST and RGraph as a 2D point representation.

See also

http://en.wikipedia.org/wiki/Complex_number

Parameters

xoptional A Complex number real part.
yoptional A Complex number imaginary part.
Summary
Functions
getcReturns a complex number.
getpReturns a Polar representation of this number.
setSets a number.
setcSets a complex number.
setpSets a polar number.
cloneReturns a copy of the current object.
toPolarTransforms cartesian to polar coordinates.
normCalculates a Complex number norm.
squaredNormCalculates a Complex number squared norm.
addReturns the result of adding two complex numbers.
prodReturns the result of multiplying two Complex numbers.
conjugateReturns the conjugate of this Complex number.
scaleReturns the result of scaling a Complex instance.
equalsComparison method.
$addReturns the result of adding two Complex numbers.
$prodReturns the result of multiplying two Complex numbers.
$conjugateReturns the conjugate for this Complex.
$scaleReturns the result of scaling a Complex instance.
$divReturns the division of two Complex numbers.
isZeroReturns true if the number is zero.

Functions

getc

getc: function()

Returns a complex number.

Returns

A complex number.

getp

getp: function(simple)

Returns a Polar representation of this number.

Parameters

simpleoptional If true, this method will return only an object holding theta and rho properties and not a Polar instance.  Default’s false.

Returns

A variable in Polar coordinates.

set

set: function(c)

Sets a number.

Parameters

cA Complex or Polar instance.

setc

setc: function(x,
y)

Sets a complex number.

Parameters

xA Complex number Real part.
yA Complex number Imaginary part.

setp

setp: function(theta,
rho)

Sets a polar number.

Parameters

thetaA Polar number theta property.
rhoA Polar number rho property.

clone

clone: function()

Returns a copy of the current object.

Returns

A copy of the real object.

toPolar

toPolar: function(simple)

Transforms cartesian to polar coordinates.

Parameters

simpleoptional If true this method will only return an object with theta and rho properties (and not the whole Polar instance).  Default’s false.

Returns

A new Polar instance.

norm

norm: function ()

Calculates a Complex number norm.

Returns

A real number representing the complex norm.

squaredNorm

squaredNorm: function ()

Calculates a Complex number squared norm.

Returns

A real number representing the complex squared norm.

add

add: function(pos)

Returns the result of adding two complex numbers.

Does not alter the original object.

Parameters

posA Complex instance.

Returns

The result of adding two complex numbers.

prod

prod: function(pos)

Returns the result of multiplying two Complex numbers.

Does not alter the original object.

Parameters

posA Complex instance.

Returns

The result of multiplying two complex numbers.

conjugate

conjugate: function()

Returns the conjugate of this Complex number.

Does not alter the original object.

Returns

The conjugate of this Complex number.

scale

scale: function(factor)

Returns the result of scaling a Complex instance.

Does not alter the original object.

Parameters

factorA scale factor.

Returns

The result of scaling this complex to a factor.

equals

equals: function(c)

Comparison method.

Returns true if both real and imaginary parts are equal.

Parameters

cA Complex instance.

Returns

A boolean instance indicating if both Complex numbers are equal.

$add

$add: function(pos)

Returns the result of adding two Complex numbers.

Alters the original object.

Parameters

posA Complex instance.

Returns

The result of adding two complex numbers.

$prod

$prod:function(pos)

Returns the result of multiplying two Complex numbers.

Alters the original object.

Parameters

posA Complex instance.

Returns

The result of multiplying two complex numbers.

$conjugate

$conjugate: function()

Returns the conjugate for this Complex.

Alters the original object.

Returns

The conjugate for this complex.

$scale

$scale: function(factor)

Returns the result of scaling a Complex instance.

Alters the original object.

Parameters

factorA scale factor.

Returns

The result of scaling this complex to a factor.

$div

$div: function(pos)

Returns the division of two Complex numbers.

Alters the original object.

Parameters

posA Complex number.

Returns

The result of scaling this complex to a factor.

isZero

isZero: function ()

Returns true if the number is zero.

A multi-purpose Complex Class with common methods.
getc: function()
Returns a complex number.
getp: function(simple)
Returns a Polar representation of this number.
A multi purpose polar representation.
set: function(c)
Sets a number.
setc: function(x,
y)
Sets a complex number.
setp: function(theta,
rho)
Sets a polar number.
clone: function()
Returns a copy of the current object.
toPolar: function(simple)
Transforms cartesian to polar coordinates.
norm: function ()
Calculates a Complex number norm.
squaredNorm: function ()
Calculates a Complex number squared norm.
add: function(pos)
Returns the result of adding two complex numbers.
prod: function(pos)
Returns the result of multiplying two Complex numbers.
conjugate: function()
Returns the conjugate of this Complex number.
scale: function(factor)
Returns the result of scaling a Complex instance.
equals: function(c)
Comparison method.
$add: function(pos)
Returns the result of adding two Complex numbers.
$prod:function(pos)
Returns the result of multiplying two Complex numbers.
$conjugate: function()
Returns the conjugate for this Complex.
$scale: function(factor)
Returns the result of scaling a Complex instance.
$div: function(pos)
Returns the division of two Complex numbers.
isZero: function ()
Returns true if the number is zero.
A Hyperbolic Tree/Graph visualization.
A Tree layout with advanced contraction and expansion animations.
A radial graph visualization with advanced animations.
Close