C# Class AForge.Math.Complex

Complex number wrapper class.

The class encapsulates complex number and provides set of different operators to manipulate it, lake adding, subtractio, multiplication, etc.

Sample usage:

// define two complex numbers Complex c1 = new Complex( 3, 9 ); Complex c2 = new Complex( 8, 3 ); // sum Complex s1 = Complex.Add( c1, c2 ); Complex s2 = c1 + c2; Complex s3 = c1 + 5; // difference Complex d1 = Complex.Subtract( c1, c2 ); Complex d2 = c1 - c2; Complex d3 = c1 - 2;
Afficher le fichier Open project: atosorigin/Kinect Class Usage Examples

Méthodes publiques

Свойство Type Description
I Complex
Im double
One Complex
Re double
Zero Complex

Méthodes publiques

Méthode Description
Add ( Complex a, Complex b ) : Complex

Adds two complex numbers.

Add ( Complex a, double s ) : Complex

Adds scalar value to a complex number.

Add ( Complex a, Complex b, Complex &result ) : void

Adds two complex numbers and puts the result into the third complex number.

Add ( Complex a, double s, Complex &result ) : void

Adds scalar value to a complex number and puts the result into another complex number.

ApproxEqual ( Complex a, Complex b ) : bool

Tests whether two complex numbers are approximately equal using default tolerance value.

The default tolerance value, which is used for the test, equals to 8.8817841970012523233891E-16.

ApproxEqual ( Complex a, Complex b, double tolerance ) : bool

Tests whether two complex numbers are approximately equal given a tolerance value.

The default tolerance value, which is used for the test, equals to 8.8817841970012523233891E-16.

Clone ( ) : Complex

Creates an exact copy of this Complex object.

Complex ( Complex c ) : System

Initializes a new instance of the Complex class.

Complex ( double re, double im ) : System

Initializes a new instance of the Complex class.

Cos ( Complex a ) : Complex

Calculates Cosine value of the complex number.

Divide ( Complex a, Complex b ) : Complex

Divides one complex number by another complex number.

Divide ( Complex a, double s ) : Complex

Divides a complex number by a scalar value.

Divide ( double s, Complex a ) : Complex

Divides a scalar value by a complex number.

Divide ( Complex a, Complex b, Complex &result ) : void

Divides one complex number by another complex number and puts the result in a third complex number.

Divide ( Complex a, double s, Complex &result ) : void

Divides a complex number by a scalar value and puts the result into another complex number.

Divide ( double s, Complex a, Complex &result ) : void

Divides a scalar value by a complex number and puts the result into another complex number.

Equals ( object obj ) : bool

Returns a value indicating whether this instance is equal to the specified object.

Exp ( Complex a ) : Complex

Calculates exponent (e raised to the specified power) of a complex number.

GetHashCode ( ) : int

Returns the hashcode for this instance.

GetObjectData ( SerializationInfo info, StreamingContext context ) : void

Populates a SerializationInfo with the data needed to serialize the target object.

Log ( Complex a ) : Complex

Calculates natural (base e) logarithm of a complex number.

Multiply ( Complex a, Complex b ) : Complex

Multiplies two complex numbers.

Multiply ( Complex a, double s ) : Complex

Multiplies a complex number by a scalar value.

Multiply ( Complex a, Complex b, Complex &result ) : void

Multiplies two complex numbers and puts the result in a third complex number.

Multiply ( Complex a, double s, Complex &result ) : void

Multiplies a complex number by a scalar value and puts the result into another complex number.

Negate ( Complex a ) : Complex

Negates a complex number.

Parse ( string s ) : Complex

Converts the specified string to its Complex equivalent.

Sin ( Complex a ) : Complex

Calculates Sine value of the complex number.

Sqrt ( Complex a ) : Complex

Calculates square root of a complex number.

Subtract ( Complex a, Complex b ) : Complex

Subtracts one complex number from another.

Subtract ( Complex a, double s ) : Complex

Subtracts a scalar from a complex number.

Subtract ( double s, Complex a ) : Complex

Subtracts a complex number from a scalar value.

Subtract ( Complex a, Complex b, Complex &result ) : void

Subtracts one complex number from another and puts the result in the third complex number.

Subtract ( Complex a, double s, Complex &result ) : void

Subtracts a scalar value from a complex number and puts the result into another complex number.

Subtract ( double s, Complex a, Complex &result ) : void

Subtracts a complex number from a scalar value and puts the result into another complex number.

Tan ( Complex a ) : Complex

Calculates Tangent value of the complex number.

ToString ( ) : string

Returns a string representation of this object.

TryParse ( string s, Complex &result ) : bool

Try to convert the specified string to its Complex equivalent.

operator ( ) : Complex

Negates the complex number.

operator ( ) : bool

Tests whether two specified complex numbers are equal.

Private Methods

Méthode Description
ICloneable ( ) : object

Creates an exact copy of this Complex object.

Method Details

Add() public static méthode

Adds two complex numbers.
public static Add ( Complex a, Complex b ) : Complex
a Complex A instance.
b Complex A instance.
Résultat Complex

Add() public static méthode

Adds scalar value to a complex number.
public static Add ( Complex a, double s ) : Complex
a Complex A instance.
s double A scalar value.
Résultat Complex

Add() public static méthode

Adds two complex numbers and puts the result into the third complex number.
public static Add ( Complex a, Complex b, Complex &result ) : void
a Complex A instance.
b Complex A instance.
result Complex A instance to hold the result.
Résultat void

Add() public static méthode

Adds scalar value to a complex number and puts the result into another complex number.
public static Add ( Complex a, double s, Complex &result ) : void
a Complex A instance.
s double A scalar value.
result Complex A instance to hold the result.
Résultat void

ApproxEqual() public static méthode

Tests whether two complex numbers are approximately equal using default tolerance value.

The default tolerance value, which is used for the test, equals to 8.8817841970012523233891E-16.

public static ApproxEqual ( Complex a, Complex b ) : bool
a Complex A instance.
b Complex A instance.
Résultat bool

ApproxEqual() public static méthode

Tests whether two complex numbers are approximately equal given a tolerance value.

The default tolerance value, which is used for the test, equals to 8.8817841970012523233891E-16.

public static ApproxEqual ( Complex a, Complex b, double tolerance ) : bool
a Complex A instance.
b Complex A instance.
tolerance double The tolerance value used to test approximate equality.
Résultat bool

Clone() public méthode

Creates an exact copy of this Complex object.
public Clone ( ) : Complex
Résultat Complex

Complex() public méthode

Initializes a new instance of the Complex class.
public Complex ( Complex c ) : System
c Complex Source complex number.
Résultat System

Complex() public méthode

Initializes a new instance of the Complex class.
public Complex ( double re, double im ) : System
re double Real part.
im double Imaginary part.
Résultat System

Cos() public static méthode

Calculates Cosine value of the complex number.
public static Cos ( Complex a ) : Complex
a Complex A instance.
Résultat Complex

Divide() public static méthode

Divides one complex number by another complex number.
Can not divide by zero.
public static Divide ( Complex a, Complex b ) : Complex
a Complex A instance.
b Complex A instance.
Résultat Complex

Divide() public static méthode

Divides a complex number by a scalar value.
Can not divide by zero.
public static Divide ( Complex a, double s ) : Complex
a Complex A instance.
s double A scalar value.
Résultat Complex

Divide() public static méthode

Divides a scalar value by a complex number.
Can not divide by zero.
public static Divide ( double s, Complex a ) : Complex
s double A scalar value.
a Complex A instance.
Résultat Complex

Divide() public static méthode

Divides one complex number by another complex number and puts the result in a third complex number.
Can not divide by zero.
public static Divide ( Complex a, Complex b, Complex &result ) : void
a Complex A instance.
b Complex A instance.
result Complex A instance to hold the result.
Résultat void

Divide() public static méthode

Divides a complex number by a scalar value and puts the result into another complex number.
Can not divide by zero.
public static Divide ( Complex a, double s, Complex &result ) : void
a Complex A instance.
s double A scalar value.
result Complex A instance to hold the result.
Résultat void

Divide() public static méthode

Divides a scalar value by a complex number and puts the result into another complex number.
Can not divide by zero.
public static Divide ( double s, Complex a, Complex &result ) : void
s double A scalar value.
a Complex A instance.
result Complex A instance to hold the result.
Résultat void

Equals() public méthode

Returns a value indicating whether this instance is equal to the specified object.
public Equals ( object obj ) : bool
obj object An object to compare to this instance.
Résultat bool

Exp() public static méthode

Calculates exponent (e raised to the specified power) of a complex number.
public static Exp ( Complex a ) : Complex
a Complex A instance.
Résultat Complex

GetHashCode() public méthode

Returns the hashcode for this instance.
public GetHashCode ( ) : int
Résultat int

GetObjectData() public méthode

Populates a SerializationInfo with the data needed to serialize the target object.
public GetObjectData ( SerializationInfo info, StreamingContext context ) : void
info System.Runtime.Serialization.SerializationInfo The to populate with data.
context System.Runtime.Serialization.StreamingContext The destination (see ) for this serialization.
Résultat void

Log() public static méthode

Calculates natural (base e) logarithm of a complex number.
public static Log ( Complex a ) : Complex
a Complex A instance.
Résultat Complex

Multiply() public static méthode

Multiplies two complex numbers.
public static Multiply ( Complex a, Complex b ) : Complex
a Complex A instance.
b Complex A instance.
Résultat Complex

Multiply() public static méthode

Multiplies a complex number by a scalar value.
public static Multiply ( Complex a, double s ) : Complex
a Complex A instance.
s double A scalar value.
Résultat Complex

Multiply() public static méthode

Multiplies two complex numbers and puts the result in a third complex number.
public static Multiply ( Complex a, Complex b, Complex &result ) : void
a Complex A instance.
b Complex A instance.
result Complex A instance to hold the result.
Résultat void

Multiply() public static méthode

Multiplies a complex number by a scalar value and puts the result into another complex number.
public static Multiply ( Complex a, double s, Complex &result ) : void
a Complex A instance.
s double A scalar value.
result Complex A instance to hold the result.
Résultat void

Negate() public static méthode

Negates a complex number.
public static Negate ( Complex a ) : Complex
a Complex A instance.
Résultat Complex

Parse() public static méthode

Converts the specified string to its Complex equivalent.
String representation of the complex number is not correctly formatted.
public static Parse ( string s ) : Complex
s string A string representation of a complex number.
Résultat Complex

Sin() public static méthode

Calculates Sine value of the complex number.
public static Sin ( Complex a ) : Complex
a Complex A instance.
Résultat Complex

Sqrt() public static méthode

Calculates square root of a complex number.
public static Sqrt ( Complex a ) : Complex
a Complex A instance.
Résultat Complex

Subtract() public static méthode

Subtracts one complex number from another.
public static Subtract ( Complex a, Complex b ) : Complex
a Complex A instance to subtract from.
b Complex A instance to be subtracted.
Résultat Complex

Subtract() public static méthode

Subtracts a scalar from a complex number.
public static Subtract ( Complex a, double s ) : Complex
a Complex A instance to subtract from.
s double A scalar value to be subtracted.
Résultat Complex

Subtract() public static méthode

Subtracts a complex number from a scalar value.
public static Subtract ( double s, Complex a ) : Complex
s double A scalar value to subtract from.
a Complex A instance to be subtracted.
Résultat Complex

Subtract() public static méthode

Subtracts one complex number from another and puts the result in the third complex number.
public static Subtract ( Complex a, Complex b, Complex &result ) : void
a Complex A instance to subtract from.
b Complex A instance to be subtracted.
result Complex A instance to hold the result.
Résultat void

Subtract() public static méthode

Subtracts a scalar value from a complex number and puts the result into another complex number.
public static Subtract ( Complex a, double s, Complex &result ) : void
a Complex A instance to subtract from.
s double A scalar value to be subtracted.
result Complex A instance to hold the result.
Résultat void

Subtract() public static méthode

Subtracts a complex number from a scalar value and puts the result into another complex number.
public static Subtract ( double s, Complex a, Complex &result ) : void
s double A scalar value to subtract from.
a Complex A instance to be subtracted.
result Complex A instance to hold the result.
Résultat void

Tan() public static méthode

Calculates Tangent value of the complex number.
public static Tan ( Complex a ) : Complex
a Complex A instance.
Résultat Complex

ToString() public méthode

Returns a string representation of this object.
public ToString ( ) : string
Résultat string

TryParse() public static méthode

Try to convert the specified string to its Complex equivalent.
public static TryParse ( string s, Complex &result ) : bool
s string A string representation of a complex number.
result Complex instance to output the result to.
Résultat bool

operator() public static méthode

Negates the complex number.
public static operator ( ) : Complex
Résultat Complex

operator() public static méthode

Tests whether two specified complex numbers are equal.
public static operator ( ) : bool
Résultat bool

Property Details

I public_oe static_oe property

A double-precision complex number that represents the squere root of (-1).
public static Complex I
Résultat Complex

Im public_oe property

Imaginary part of the complex number.
public double Im
Résultat double

One public_oe static_oe property

A double-precision complex number that represents one.
public static Complex One
Résultat Complex

Re public_oe property

Real part of the complex number.
public double Re
Résultat double

Zero public_oe static_oe property

A double-precision complex number that represents zero.
public static Complex Zero
Résultat Complex