Complex.Subtraction Operator

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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(Double, Complex)

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

Subtraction(Complex, Double)

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

Subtraction(Complex, Complex)

Subtracts a complex number from another complex number.

Remarks

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

C#
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)

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 don't 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(Double, Complex)

Source:
Complex.cs
Source:
Complex.cs
Source:
Complex.cs

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

C#
public static System.Numerics.Complex operator -(double left, System.Numerics.Complex right);

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:

(ac)di

Languages that don't support custom operators can call the Complex.Subtract(Double, Complex) method instead.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10

Subtraction(Complex, Double)

Source:
Complex.cs
Source:
Complex.cs
Source:
Complex.cs

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

C#
public static System.Numerics.Complex operator -(System.Numerics.Complex left, double right);

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:

(ac)+bi

Languages that don't support custom operators can call the Complex.Subtract(Complex, Double) method instead.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10

Subtraction(Complex, Complex)

Source:
Complex.cs
Source:
Complex.cs
Source:
Complex.cs

Subtracts a complex number from another complex number.

C#
public static System.Numerics.Complex operator -(System.Numerics.Complex left, System.Numerics.Complex right);

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.

Implements

Remarks

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

(ac)+(bd)i

Languages that don't support custom operators can call the Complex.Subtract(Complex, Complex) method instead.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0