Click or drag to resize
Complex Class
The Complex class represents a complex number. Complex numbers are immutable: their values cannot be changed after they are created. It includes methods for addition, subtraction, multiplication, division, conjugation, and other common functions on complex numbers.
Inheritance Hierarchy
SystemObject
  Algs4NetComplex

Namespace: Algs4Net
Assembly: Algs4Net (in Algs4Net.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public class Complex

The Complex type exposes the following members.

Constructors
  NameDescription
Public methodComplex
Initializes a complex number from the specified real and imaginary parts.
Top
Properties
  NameDescription
Public propertyIm
Returns the imaginary part of this complex number.
Public propertyRe
Returns the real part of this complex number.
Top
Methods
  NameDescription
Public methodAbs
Returns the absolute value of this complex number, or angle/phase/argument. This quantity is also known as the Modulus or Magnitude.
Public methodConjugate
Returns the complex conjugate of this complex number.
Public methodCos
Returns the complex cosine of this complex number.
Public methodExp
Returns the complex exponential of this complex number.
Public methodStatic memberMainTest
Demo test the Complex data type.
Public methodPhase
Returns the phase of this complex number. This quantity is also known as the Ange or Argument.
Public methodReciprocal
Returns the reciprocal of this complex number.
Public methodScale
Returns the product of this complex number and the specified scalar.
Public methodSin
Returns the complex sine of this complex number.
Public methodTan
Returns the complex tangent of this complex number.
Public methodToString
Returns a string representation of this complex number.
(Overrides ObjectToString.)
Top
Operators
  NameDescription
Public operatorStatic memberAddition
Returns the sum of this complex number and the specified complex number.
Public operatorStatic memberDivision
Returns the result of dividing the specified complex number into this complex number.
Public operatorStatic memberMultiply
Returns the product of this complex number and the specified complex number.
Public operatorStatic memberSubtraction
Returns the result of subtracting the specified complex number from this complex number.
Top
Remarks

For additional documentation, see Section 9.9 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

This class is a C# port from the original Java class Complex implementation by the respective authors.

See Also