Complex.Divide Method

Definition

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

Overloads

Divide(Double, Complex)

Divides one double-precision real number by a complex number and returns the result.

Divide(Complex, Double)

Divides one complex number by a double-precision real number and returns the result.

Divide(Complex, Complex)

Divides one complex number by another and returns the result.

Examples

The following example divides a complex number by each element in an array of complex numbers.

C#
using System;
using System.Numerics;

public class Example
{
   public static void Main()
   {
      Complex c1 = new Complex(1.2, 2.3);
      Complex[] values = { new Complex(1.2, 2.3),
                           new Complex(0.5, 0.75),
                           new Complex(3.0, -5.0) };
      foreach (Complex c2 in values)
         Console.WriteLine("{0} / {1} = {2:N2}", c1, c2,
                           Complex.Divide(c1, c2));
   }
}
// The example displays the following output:
//       (1.2, 2.3) / (1.2, 2.3) = (1.00, 0.00)
//       (1.2, 2.3) / (0.5, 0.75) = (2.86, 0.31)
//       (1.2, 2.3) / (3, -5) = (-0.23, 0.38)

Remarks

The Divide methods allow performing division operations that involve complex numbers.

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

The Divide method can be used by Languages that don't support custom operators. Its behavior is identical to division using the division operator.

The Divide methods that receive one double are more efficient than the methods that receive two complex numbers.

Divide(Double, Complex)

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

Divides one double-precision real number by a complex number and returns the result.

C#
public static System.Numerics.Complex Divide(double dividend, System.Numerics.Complex divisor);

Parameters

dividend
Double

The double-precision real number to be divided.

divisor
Complex

The complex number to divide by.

Returns

The quotient of the division.

Remarks

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

acc2+d2+(adc2+d2)i

See also

Applies to

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

Divide(Complex, Double)

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

Divides one complex number by a double-precision real number and returns the result.

C#
public static System.Numerics.Complex Divide(System.Numerics.Complex dividend, double divisor);

Parameters

dividend
Complex

The complex number to be divided.

divisor
Double

The double-precision real number to divide by.

Returns

The quotient of the division.

Remarks

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

acc2+(bcc2)i

See also

Applies to

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

Divide(Complex, Complex)

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

Divides one complex number by another and returns the result.

C#
public static System.Numerics.Complex Divide(System.Numerics.Complex dividend, System.Numerics.Complex divisor);

Parameters

dividend
Complex

The complex number to be divided.

divisor
Complex

The complex number to divide by.

Returns

The quotient of the division.

Remarks

The division of a complex number, a + bi, by a second complex number, c + di, takes the following form:

ac+bdc2+d2+(bcadc2+d2)i

See also

Applies to

.NET 9 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
.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