Complex.Subtraction Operator

Definition

Subtracts a specified number from another specified number, where at least one of them is a complex number, and the other could be a double-precision real number.

Overloads

Subtraction(Complex, Complex)

Subtracts a complex number from another complex number.

Subtraction(Complex, Double)

Subtracts a double-precision real number from a complex number.

Subtraction(Double, Complex)

Subtracts a complex number from a double-precision real number.

Remarks

The Subtraction operator allows performing subtraction operations that involve complex numbers. It enables code such as the following:

System.Numerics.Complex c1 = new System.Numerics.Complex(6.7, -1.3);
System.Numerics.Complex c2 = new System.Numerics.Complex(1.4, 3.8);
System.Numerics.Complex result = c1 - c2;
Console.WriteLine("{0} - {1} = {2}", c1, c2, result);
// The example displays the following output:
//       (6.7, -1.3); - (1.4, 3.8); = (5.3, -5.1)      
Dim c1 As New System.Numerics.Complex(6.7, -1.3)
Dim c2 As New System.Numerics.Complex(1.4, 3.8)
Dim result As System.Numerics.Complex = c1 - c2
Console.WriteLine("{0} - {1} = {2}", c1, c2, result)
' The example displays the following output:
'       (6.7, -1.3) - (1.4, 3.8) = (5.3, -5.1)      

If the subtraction results in an overflow in either the real or imaginary component, the value of that component is either Double.PositiveInfinity or Double.NegativeInfinity.

Languages that do not support custom operators can call the Subtract equivalent group of methods instead.

The Addition operators that receive one double are more efficient than the operators that receive two Complex numbers.

Subtraction(Complex, Complex)

Subtracts a complex number from another complex number.

public:
 static System::Numerics::Complex operator -(System::Numerics::Complex left, System::Numerics::Complex right);
public static System.Numerics.Complex operator - (System.Numerics.Complex left, System.Numerics.Complex right);
static member ( - ) : System.Numerics.Complex * System.Numerics.Complex -> System.Numerics.Complex
Public Shared Operator - (left As Complex, right As Complex) As Complex

Parameters

left
Complex

The value to subtract from (the minuend).

right
Complex

The value to subtract (the subtrahend).

Returns

The result of subtracting right from left.

Remarks

The subtraction of a complex number, c + di, from another complex number, a + bi, takes the following form:

(a - c) + (b - d)i

Languages that do not support custom operators can call the Complex.Subtract(Complex, Complex) method instead.

See also

Subtraction(Complex, Double)

Subtracts a double-precision real number from a complex number.

public:
 static System::Numerics::Complex operator -(System::Numerics::Complex left, double right);
public static System.Numerics.Complex operator - (System.Numerics.Complex left, double right);
static member ( - ) : System.Numerics.Complex * double -> System.Numerics.Complex
Public Shared Operator - (left As Complex, right As Double) As Complex

Parameters

left
Complex

The complex value to subtract from (the minuend).

right
Double

The double-precision real value to subtract (the subtrahend).

Returns

The result of subtracting right from left, as a complex number.

Remarks

The subtraction of a real number (which can be regarded as the complex number c + 0i) from a complex number (a + bi) takes the following form:

(a - c) + bi

Languages that do not support custom operators can call the Complex.Subtract(Complex, Double) method instead.

See also

Subtraction(Double, Complex)

Subtracts a complex number from a double-precision real number.

public:
 static System::Numerics::Complex operator -(double left, System::Numerics::Complex right);
public static System.Numerics.Complex operator - (double left, System.Numerics.Complex right);
static member ( - ) : double * System.Numerics.Complex -> System.Numerics.Complex
Public Shared Operator - (left As Double, right As Complex) As Complex

Parameters

left
Double

The double-precision real value to subtract from (the minuend).

right
Complex

The complex value to subtract (the subtrahend).

Returns

The result of subtracting right from left, as a complex number.

Remarks

The subtraction of a complex number (c + di) from a real number (which can be regarded as the complex number a + 0i) takes the following form:

(a - c) - di

Languages that do not support custom operators can call the Complex.Subtract(Double, Complex) method instead.

See also

Applies to