cpx - Complex number module

Module Description

The cpx module implements words for using complex numbers.

Module Words

Complex Structure

cpx% ( - n )
Get the required space for the cpx data structure

Complex structure creation, initialisation and destruction

cpx-init ( w:cpx - )
Initialise the zero complex number

cpx-create ( "name" - )
Create a named complex number in the dictionary

cpx-new ( - w:cpx )
Create a new complex number on the heap

cpx-free ( w:cpx - )
Free the complex number from the heap

Calculation module words

cpx+add ( r:re2 r:im2 r:re1 r:im1 - r:re r:im )
Add two complex numbers on stack

cpx+sub ( r:re2 r:im2 r:re1 r:im1 - r:re r:im )
Subtract complex number 1 from number 2 on stack

cpx+mul ( r:re2 r:im2 r:re1 r:im1 - r:re r:im )
Multiply two complex numbers on stack

cpx+rmul ( r:re r:im r:re2 - r:re r:im )
Multiply a complex number with a real number

cpx+imul ( r:re r:im r:im2 - r:re r:im )
Multiply a complex number with an imaginary number

cpx+div ( r:re2 r:im2 r:re1 r:im1 - r:re r:im )
Divide complex number 2 by number 1 on stack

cpx+conj ( r:re r:im - r:re r:im )
Conjugate the complex number on stack

cpx+nrm ( r:re r:im - r )
Calculate the square of the modulus of the complex number

cpx+abs ( r:re r:im - r )
Calculate the modulus of the complex number

cpx+sqrt ( r:re r:im - r:re r:im )
Calculate the square root for the complex number on stack

cpx+exp ( r:re r:im - r:re r:im )
Calculate the exponent function for the complex number on stack

cpx+ln ( r:re r:im - r:re r:im )
Calculate the natural logarithm for the complex number on stack

cpx+sin ( r:re r:im - r:re r:im )
Calculate the trigonometric functions sine for the complex number on stack

cpx+cos ( r:re r:im - r:re r:im )
Calculate the trigonometric functions cosine for the complex number on stack

cpx+tan ( r:re r:im - r:re r:im )
Calculate the trigonometric functions trangent for the complex number on stack

cpx+asin ( r:re r:im - r:re r:im )
Calculate the inverse trigonometric function sine for the complex number on stack

cpx+acos ( r:re r:im - r:re r:im )
Calculate the inverse trigonometric function cosine for the complex number on stack

cpx+atan ( r:re r:im - r:re r:im )
Calculate the inverse trigonometric function tangent for the complex number on stack

cpx+sinh ( r:re r:im - r:re r:im )
Calculate the hyperbolic function sine for the complex number on stack

cpx+cosh ( r:re r:im - r:re r:im )
Calculate the hyperbolic function cosine for the complex number on stack

cpx+tanh ( r:re r:im - r:re r:im )
Calculate the hyperbolic function tangent for the complex number on stack

cpx+asinh ( r:re r:im - r:re r:im )
Calculate the inverse hyperbolic function sine for the complex number on stack

cpx+acosh ( r:re r:im - r:re r:im )
Calculate the inverse hyperbolic function cosine for the complex number on stack

cpx+atanh ( r:re r:im - r:re r:im )
Calculate the inverse hyperbolic function tangent for the complex number on stack

Conversion module words

cpx+to-string ( r:re r:im - c-addr u )
Convert the complex number to a string, using precision and PAD

cpx+to-polar ( r:re r:im - r:r r:theta )
Convert complex number to polar

cpx+from-polar ( r:r r:theta - r:re r:im )
Convert polar to complex number

Compare module words

cpx+equal? ( r:re2 r:im2 r:re1 r:im1 - f )
Check if two complex numbers are [true] equal

Structure words

cpx-re@ ( w:cpx - r:re )
Get the real part of the complex number

cpx-im@ ( w:cpx - r:im )
Get the imaginary part of the complex number

cpx-get ( w:cpx - r:re r:im )
Get the complex number

cpx-set ( r:re r:im w:cpx )
Set the complex number

cpx^move ( w:cpx2 w:cpx1 - )
Move complex2 in complex1

cpx^equal? ( w:cpx2 w:cpx1 - f )
Check if complex2 is [true] equal to complex1

cpx-dump ( w:cpx - )
Dump the complex number


generated 09-Jan-2007 by ofcfrth-0.2.0