Complex 结构

定义

表示一个复数。Represents a complex number.

public value class Complex : IEquatable<System::Numerics::Complex>, IFormattable
[System.Serializable]
public struct Complex : IEquatable<System.Numerics.Complex>, IFormattable
type Complex = struct
    interface IFormattable
Public Structure Complex
Implements IEquatable(Of Complex), IFormattable
继承
Complex
属性
实现

注解

复数是包含实数部分和虚数部分的数字。A complex number is a number that comprises a real number part and an imaginary number part. 复数 z 通常采用 z = x + yi 形式编写, 其中xy为实数, 而i是具有属性i2 =-1 的虚部。A complex number z is usually written in the form z = x + yi, where x and y are real numbers, and i is the imaginary unit that has the property i2 = -1. 复数的实部由x表示, 复数的虚部是由y表示的。The real part of the complex number is represented by x, and the imaginary part of the complex number is represented by y.

Complex实例化和操作复数时, 该类型使用笛卡尔坐标系统 (real, 虚部)。The Complex type uses the Cartesian coordinate system (real, imaginary) when instantiating and manipulating complex numbers. 复数可以表示为二维坐标系统中的一个点, 这称为复杂平面。A complex number can be represented as a point in a two-dimensional coordinate system, which is known as the complex plane. 复数的实部定位在 x 轴 (水平轴) 上, 而虚部位于 y 轴 (垂直轴) 的位置。The real part of the complex number is positioned on the x-axis (the horizontal axis), and the imaginary part is positioned on the y-axis (the vertical axis).

还可以通过使用极坐标系统基于其绝对值来表示复杂平面中的任何点。Any point in the complex plane can also be expressed based on its absolute value, by using the polar coordinate system. 在极坐标中, 点的特征是两个数字:In polar coordinates, a point is characterized by two numbers:

  • 其量值, 它是原点 (即 0, 0, 或 x 轴和 y 轴相交处的点) 之间的距离。Its magnitude, which is the distance of the point from the origin (that is, 0,0, or the point at which the x-axis and the y-axis intersect).

  • 其阶段, 它是实轴与从原点绘制到点之间的直线之间的角度。Its phase, which is the angle between the real axis and the line drawn from the origin to the point.

实例化复数Instantiating a Complex Number

可以通过以下方式之一将值分配给复数:You can assign a value to a complex number in one of the following ways:

  • 通过向其Double构造函数传递两个值。By passing two Double values to its constructor. 第一个值表示复数的实部, 第二个值表示其虚部。The first value represents the real part of the complex number, and the second value represents its imaginary part. 这些值表示复数在二维笛卡尔坐标系统中的位置。These values represent the position of the complex number in the two-dimensional Cartesian coordinate system.

  • 通过调用静态 (Shared Visual Basic) Complex.FromPolarCoordinates方法从其极坐标创建复数。By calling the static (Shared in Visual Basic) Complex.FromPolarCoordinates method to create a complex number from its polar coordinates.

  • 通过Byte将、 、、、UInt32Int32 、、Double 、或值分配Complex给对象。 Int64 UInt64 Int16 SByte UInt16 SingleBy assigning a Byte, SByte, Int16, UInt16, Int32, UInt32, Int64, UInt64, Single, or Double value to a Complex object. 值变成复数的实部, 其虚部等于0。The value becomes the real part of the complex number, and its imaginary part equals 0.

  • 通过强制转换 ( C#在中) 或将Decimal ComplexBigInteger值转换为对象 (在 Visual Basic 中)。By casting (in C#) or converting (in Visual Basic) a Decimal or BigInteger value to a Complex object. 值变成复数的实部, 其虚部等于0。The value becomes the real part of the complex number, and its imaginary part equals 0.

  • 通过将方法或运算符返回的复数赋给Complex对象。By assigning the complex number that is returned by a method or operator to a Complex object. 例如, Complex.Add是一个静态方法, 它返回一个复数, 该复数是两个复数的和, Complex.Addition运算符添加两个复数并返回结果。For example, Complex.Add is a static method that returns a complex number that is the sum of two complex numbers, and the Complex.Addition operator adds two complex numbers and returns the result.

下面的示例演示了向复数赋值的五种方法中的每一种。The following example demonstrates each of these five ways of assigning a value to a complex number.

using System;
using System.Numerics;

public class Example
{
   public static void Main()
   {
      // Create a complex number by calling its class constructor.
      Complex c1 = new Complex(12, 6);
      Console.WriteLine(c1);
      
      // Assign a Double to a complex number.
      Complex c2 = 3.14;
      Console.WriteLine(c2);
      
      // Cast a Decimal to a complex number.
      Complex c3 = (Complex) 12.3m;
      Console.WriteLine(c3);
      
      // Assign the return value of a method to a Complex variable.
      Complex c4 = Complex.Pow(Complex.One, -1);
      Console.WriteLine(c4);
      
      // Assign the value returned by an operator to a Complex variable.
      Complex c5 = Complex.One + Complex.One;
      Console.WriteLine(c5);

      // Instantiate a complex number from its polar coordinates.
      Complex c6 = Complex.FromPolarCoordinates(10, .524);
      Console.WriteLine(c6);
   }
}
// The example displays the following output:
//       (12, 6)
//       (3.14, 0)
//       (12.3, 0)
//       (1, 0)
//       (2, 0)
//       (8.65824721882145, 5.00347430269914)
Imports System.Numerics

Module Example
   Public Sub Main()
      ' Create a complex number by calling its class constructor.
      Dim c1 As New Complex(12, 6)
      Console.WriteLine(c1)
      
      ' Assign a Double to a complex number.
      Dim c2 As Complex = 3.14
      Console.WriteLine(c2)
      
      ' Cast a Decimal to a complex number.
      Dim c3 As Complex = CType(12.3d, Complex)
      Console.WriteLine(c3)
      
      ' Assign the return value of a method to a Complex variable.
      Dim c4 As Complex = Complex.Pow(Complex.One, -1)
      Console.WriteLine(c4)
      
      ' Assign the value returned by an operator to a Complex variable.
      Dim c5 As Complex = Complex.One + Complex.One
      Console.WriteLine(c5)

      ' Instantiate a complex number from its polar coordinates.
      Dim c6 As Complex = Complex.FromPolarCoordinates(10, .524)
      Console.WriteLine(c6)
   End Sub
End Module
' The example displays the following output:
'       (12, 6)
'       (3.14, 0)
'       (12.3000001907349, 0)
'       (1, 0)
'       (2, 0)
'       (8.65824721882145, 5.00347430269914)

带有复数的操作Operations with Complex Numbers

.NET Framework Complex中的结构包括提供以下功能的成员:The Complex structure in the .NET Framework includes members that provide the following functionality:

  • 用于比较两个复数以确定它们是否相等的方法。Methods to compare two complex numbers to determine whether they are equal.

  • 用于对复数执行算术运算的运算符。Operators to perform arithmetic operations on complex numbers. Complex使用运算符可以对复数执行加法、减法、乘法、除法和一元求反运算。Complex operators enable you to perform addition, subtraction, multiplication, division, and unary negation with complex numbers.

  • 用于对复数执行其他数字运算的方法。Methods to perform other numerical operations on complex numbers. 除了四个基本算术运算外, 还可以将一个复数升高到指定的幂, 查找复数的平方根, 并获取复数的绝对值。In addition to the four basic arithmetic operations, you can raise a complex number to a specified power, find the square root of a complex number, and get the absolute value of a complex number.

  • 用于对复数执行三角函数运算的方法。Methods to perform trigonometric operations on complex numbers. 例如, 您可以计算由复数表示的角度的正切值。For example, you can calculate the tangent of an angle represented by a complex number.

请注意, 由于RealImaginary属性是只读的, 因此不能修改现有Complex对象的值。Note that, because the Real and Imaginary properties are read-only, you cannot modify the value of an existing Complex object. Complex数字执行操作的所有方法 (如果其返回值为类型Complex) 将返回新Complex数字。All methods that perform an operation on a Complex number, if their return value is of type Complex, return a new Complex number.

精度和复数Precision and Complex Numbers

复数的实部和虚部用两个双精度浮点值表示。The real and imaginary parts of a complex number are represented by two double-precision floating-point values. 这意味着Complex , 值 (如双精度浮点值) 可能会因数字运算而丢失精度。This means that Complex values, like double-precision floating-point values, can lose precision as a result of numerical operations. 这意味着, 如果这两个值之间Complex的差比较导致精度损失, 则这两个值的相等比较可能会失败。This means that strict comparisons for equality of two Complex values may fail, even if the difference between the two values is due to a loss of precision. 有关详细信息,请参阅 DoubleFor more information, see Double.

例如, 对某个数字的对数执行幂运算应返回原始数字。For example, performing exponentiation on the logarithm of a number should return the original number. 但是, 在某些情况下, 浮点值的精度损失可能会导致两个值之间的差异, 如下面的示例所示。However, in some cases, the loss of precision of floating-point values can cause slight differences between the two values, as the following example illustrates.

Complex value = new Complex(Double.MinValue/2, Double.MinValue/2);
Complex value2 = Complex.Exp(Complex.Log(value));
Console.WriteLine("{0} \n{1} \nEqual: {2}", value, value2, 
                                            value == value2);
// The example displays the following output:
//    (-8.98846567431158E+307, -8.98846567431158E+307)
//    (-8.98846567431161E+307, -8.98846567431161E+307)
//    Equal: False
Dim value As New Complex(Double.MinValue/2, Double.MinValue/2)
Dim value2 As Complex = Complex.Exp(Complex.Log(value))
Console.WriteLine("{0} {3}{1} {3}Equal: {2}", value, value2, 
                                              value = value2,
                                              vbCrLf)
' The example displays the following output:
'    (-8.98846567431158E+307, -8.98846567431158E+307)
'    (-8.98846567431161E+307, -8.98846567431161E+307)
'    Equal: False

同样, 下面的示例 (计算Complex数字的平方根) 在 .NET Framework 的32位和 IA64 版本上生成的结果略有不同。Similarly, the following example, which calculates the square root of a Complex number, produces slightly different results on the 32-bit and IA64 versions of the .NET Framework.

Complex minusOne = new Complex(-1, 0);
Console.WriteLine(Complex.Sqrt(minusOne));
// The example displays the following output:
//    (6.12303176911189E-17, 1) on 32-bit systems.
//    (6.12323399573677E-17,1) on IA64 systems.
Dim minusOne As New Complex(-1, 0)
Console.WriteLine(Complex.Sqrt(minusOne))
' The example displays the following output:
'    (6.12303176911189E-17, 1) on 32-bit systems.
'    (6.12323399573677E-17,1) on IA64 systems.

复数、无穷和 NaNComplex Numbers, Infinity, and NaN

复数的实部和虚部用Double值表示。The real and imaginary parts of a complex number are represented by Double values. Double.MinValue除了从到Double.MaxValue以外, 复数的实部或虚部Double.PositiveInfinity可以具有值、 Double.NegativeInfinityDouble.NaNIn addition to ranging from Double.MinValue to Double.MaxValue, the real or imaginary part of a complex number can have a value of Double.PositiveInfinity, Double.NegativeInfinity, or Double.NaN. Double.PositiveInfinityDouble.NegativeInfinityDouble.NaN均传播到任何算术或三角函数操作中。Double.PositiveInfinity, Double.NegativeInfinity, and Double.NaN all propagate in any arithmetic or trigonometric operation.

在下面的示例中, 除法Zero运算将生成一个复数, 该复数的实部Double.NaN和虚部均为两者。In the following example, division by Zero produces a complex number whose real and imaginary parts are both Double.NaN. 因此, 使用此值执行乘法还会生成一个实部和虚部为Double.NaN的复数。As a result, performing multiplication with this value also produces a complex number whose real and imaginary parts are Double.NaN. 同样, 执行溢出Double类型范围的乘法会生成一个复数, 其中实部为Double.NaN , 虚部为Double.PositiveInfinitySimilarly, performing a multiplication that overflows the range of the Double type produces a complex number whose real part is Double.NaN and whose imaginary part is Double.PositiveInfinity. 随后使用此复数执行除法运算将返回实部为Double.NaN , 其虚部为Double.PositiveInfinity的复数。Subsequently performing division with this complex number returns a complex number whose real part is Double.NaN and whose imaginary part is Double.PositiveInfinity.

using System;
using System.Numerics;

public class Example
{
   public static void Main()
   {
      Complex c1 = new Complex(Double.MaxValue / 2, Double.MaxValue /2);

      Complex c2 = c1 / Complex.Zero;
      Console.WriteLine(c2.ToString());
      c2 = c2 * new Complex(1.5, 1.5);
      Console.WriteLine(c2.ToString());
      Console.WriteLine();
      
      Complex c3 = c1 * new Complex(2.5, 3.5);
      Console.WriteLine(c3.ToString());
      c3 = c3 + new Complex(Double.MinValue / 2, Double.MaxValue / 2); 
      Console.WriteLine(c3);
   }
}
// The example displays the following output:
//       (NaN, NaN)
//       (NaN, NaN)
//       (NaN, Infinity)
//       (NaN, Infinity)
Imports System.Numerics

Module Example
   Public Sub Main()
      Dim c1 As Complex = New Complex(Double.MaxValue / 2, Double.MaxValue /2)

      Dim c2 As Complex = c1 / Complex.Zero
      Console.WriteLine(c2.ToString())
      c2 = c2 * New Complex(1.5, 1.5)
      Console.WriteLine(c2.ToString())
      Console.WriteLine()
      
      Dim c3 As Complex = c1 * New Complex(2.5, 3.5)
      Console.WriteLine(c3.ToString())
      c3 = c3 + New Complex(Double.MinValue / 2, Double.MaxValue / 2) 
      Console.WriteLine(c3)     
   End Sub
End Module
' The example displays the following output:
'       (NaN, NaN)
'       (NaN, NaN)
'
'       (NaN, Infinity)
'       (NaN, Infinity)

使用无效或溢出Double数据类型范围的复数运算不会引发异常。Mathematical operations with complex numbers that are invalid or that overflow the range of the Double data type do not throw an exception. 相反, 它们会在Double.PositiveInfinity以下Double.NegativeInfinity条件下Double.NaN返回、或:Instead, they return a Double.PositiveInfinity, Double.NegativeInfinity, or Double.NaN under the following conditions:

请注意, 这适用于方法所执行的任何中间计算。Note that this applies to any intermediate calculations performed by a method. 例如, 的乘法new Complex(9e308, 9e308) and new Complex(2.5, 3.5)使用公式 (ac-bd) + (ad + bc) i。For example, the multiplication of new Complex(9e308, 9e308) and new Complex(2.5, 3.5) uses the formula (ac - bd) + (ad + bc)i. 乘法运算产生的实分量计算表达式 9e308 * 2.5-9e308 * 3.5。The calculation of the real component that results from the multiplication evaluates the expression 9e308 * 2.5 - 9e308 * 3.5. 此表达式中的每个中间Double.PositiveInfinity乘法都返回, 尝试从Double.PositiveInfinity Double.PositiveInfinity返回Double.NaN的中减去。Each intermediate multiplication in this expression returns Double.PositiveInfinity, and the attempt to subtract Double.PositiveInfinity from Double.PositiveInfinity returns Double.NaN.

设置复数格式Formatting a Complex Number

默认(情况下, 复数的字符串表示形式采用, 虚部), 其中real虚部Double构成复数实部和虚部部分的值。By default, the string representation of a complex number takes the form (real, imaginary), where real and imaginary are the string representations of the Double values that form the complex number's real and imaginary components. ToString方法的某些重载允许自定义这些Double值的字符串表示形式, 以反映特定区域性的格式设置约定, 或显示为标准或自定义数字定义的特定格式格式字符串。Some overloads of the ToString method allow customization of the string representations of these Double values to reflect the formatting conventions of a particular culture or to appear in a particular format defined by a standard or custom numeric format string. (有关详细信息, 请参阅标准数字格式字符串自定义数字格式字符串。)(For more information, see Standard Numeric Format Strings and Custom Numeric Format Strings.)

表达复数的字符串表示形式的一种更常见方法是使用 a + bi 形式, 其中 a 是复数的实部, b 是复数的虚部。One of the more common ways of expressing the string representation of a complex number takes the form a + bi, where a is the complex number's real component, and b is the complex number's imaginary component. 在电气工程中, 复数最常表示为 + bj。In electrical engineering, a complex number is most commonly expressed as a + bj. 您可以使用以下两种形式之一返回复数的字符串表示形式。You can return the string representation of a complex number in either of these two forms. 为此, 请通过实现ICustomFormatterIFormatProvider接口定义自定义格式提供程序String.Format(IFormatProvider, String, Object[]) , 然后调用方法。To do this, define a custom format provider by implementing the ICustomFormatter and IFormatProvider interfaces, and then call the String.Format(IFormatProvider, String, Object[]) method.

下面的示例定义了ComplexFormatter一个类, 该类将一个以 + bi 或 + bj 形式的字符串表示的复数。The following example defines a ComplexFormatter class that represents a complex number as a string in the form of either a + bi or a + bj.

using System;
using System.Numerics;

public class ComplexFormatter :IFormatProvider, ICustomFormatter
{
   public object GetFormat(Type formatType) 
   {   
      if (formatType == typeof(ICustomFormatter))
         return this;
      else
         return null;
   }
   
   public string Format(string format, object arg, 
                        IFormatProvider provider)
   {
      if (arg is Complex)
      {
         Complex c1 = (Complex) arg; 
         // Check if the format string has a precision specifier.
         int precision;
         string fmtString = String.Empty;
         if (format.Length > 1) {
            try {
               precision = Int32.Parse(format.Substring(1));
            }
            catch (FormatException) {
               precision = 0;
            }
            fmtString = "N" + precision.ToString();
         }
         if (format.Substring(0, 1).Equals("I", StringComparison.OrdinalIgnoreCase))
            return c1.Real.ToString(fmtString) + " + " + c1.Imaginary.ToString(fmtString) + "i";
         else if (format.Substring(0, 1).Equals("J", StringComparison.OrdinalIgnoreCase))
            return c1.Real.ToString(fmtString) + " + " + c1.Imaginary.ToString(fmtString) + "j";
         else
            return c1.ToString(format, provider);
      }
      else
      {
         if (arg is IFormattable)
            return ((IFormattable) arg).ToString(format, provider);
         else if (arg != null) 
            return arg.ToString();
         else
            return String.Empty;
      }                        
   }
}
Imports System.Numerics

Public Class ComplexFormatter 
             Implements IFormatProvider, ICustomFormatter
   
   Public Function GetFormat(formatType As Type) As Object _
                   Implements IFormatProvider.GetFormat
      If formatType Is GetType(ICustomFormatter) Then
         Return Me
      Else
         Return Nothing
      End If
   End Function
   
   Public Function Format(fmt As String, arg As Object, 
                          provider As IFormatProvider) As String _
                   Implements ICustomFormatter.Format
      If TypeOf arg Is Complex Then
         Dim c1 As Complex = DirectCast(arg, Complex)
         ' Check if the format string has a precision specifier.
         Dim precision As Integer
         Dim fmtString As String = String.Empty
         If fmt.Length > 1 Then
            Try
               precision = Int32.Parse(fmt.Substring(1))
            Catch e As FormatException
               precision = 0
            End Try
            fmtString = "N" + precision.ToString()
         End If
         If fmt.Substring(0, 1).Equals("I", StringComparison.OrdinalIgnoreCase) Then
            Return c1.Real.ToString(fmtString) + " + " + c1.Imaginary.ToString(fmtString) + "i"
         ElseIf fmt.Substring(0, 1).Equals("J", StringComparison.OrdinalIgnoreCase) Then
            Return c1.Real.ToString(fmtString) + " + " + c1.Imaginary.ToString(fmtString) + "j"
         Else
            Return c1.ToString(fmt, provider)
         End If
      Else
         If Typeof arg Is IFormattable Then
            Return DirectCast(arg, IFormattable).ToString(fmt, provider)
         ElseIf arg IsNot Nothing Then
            Return arg.ToString()
         Else
            Return String.Empty
         End If   
      End If                        
   End Function
End Class

然后, 下面的示例使用此自定义格式化程序显示复数的字符串表示形式。The following example then uses this custom formatter to display the string representation of a complex number.

public class Example
{
   public static void Main()
   {
      Complex c1 = new Complex(12.1, 15.4);
      Console.WriteLine("Formatting with ToString():       " + 
                        c1.ToString());
      Console.WriteLine("Formatting with ToString(format): " + 
                        c1.ToString("N2"));
      Console.WriteLine("Custom formatting with I0:        " + 
                        String.Format(new ComplexFormatter(), "{0:I0}", c1));
      Console.WriteLine("Custom formatting with J3:        " + 
                        String.Format(new ComplexFormatter(), "{0:J3}", c1));
   }
}
// The example displays the following output:
//    Formatting with ToString():       (12.1, 15.4)
//    Formatting with ToString(format): (12.10, 15.40)
//    Custom formatting with I0:        12 + 15i
//    Custom formatting with J3:        12.100 + 15.400j
Module Example
   Public Sub Main()
      Dim c1 As Complex = New Complex(12.1, 15.4)
      Console.WriteLine("Formatting with ToString():       " + 
                        c1.ToString())
      Console.WriteLine("Formatting with ToString(format): " + 
                        c1.ToString("N2"))
      Console.WriteLine("Custom formatting with I0:        " + 
                        String.Format(New ComplexFormatter(), "{0:I0}", c1))
      Console.WriteLine("Custom formatting with J3:        " + 
                        String.Format(New ComplexFormatter(), "{0:J3}", c1))
   End Sub
End Module
' The example displays the following output:
'    Formatting with ToString():       (12.1, 15.4)
'    Formatting with ToString(format): (12.10, 15.40)
'    Custom formatting with I0:        12 + 15i
'    Custom formatting with J3:        12.100 + 15.400j

构造函数

Complex(Double, Double)

使用指定的实数值和虚数值初始化 Complex 结构的新实例。Initializes a new instance of the Complex structure using the specified real and imaginary values.

字段

ImaginaryOne

返回新的 Complex 实例,其实数等于零,虚数等于一。Returns a new Complex instance with a real number equal to zero and an imaginary number equal to one.

Infinity

用复数表示无穷大。Represents infinity as a complex number.

NaN

表示一个不为数值 (NaN) 的复数实例。Represents a complex instance that is not a number (NaN).

One

返回新的 Complex 实例,其实数等于一,虚数等于零。Returns a new Complex instance with a real number equal to one and an imaginary number equal to zero.

Zero

返回新的 Complex 实例,其实数和虚数都等于零。Returns a new Complex instance with a real number equal to zero and an imaginary number equal to zero.

属性

Imaginary

获取当前 Complex 对象的虚部。Gets the imaginary component of the current Complex object.

Magnitude

获取复数的量值(或绝对值)。Gets the magnitude (or absolute value) of a complex number.

Phase

获取复数的相位。Gets the phase of a complex number.

Real

获取当前 Complex 对象的实部。Gets the real component of the current Complex object.

方法

Abs(Complex)

获取复数的绝对值(或量值)。Gets the absolute value (or magnitude) of a complex number.

Acos(Complex)

返回表示指定复数的反余弦值的角度。Returns the angle that is the arc cosine of the specified complex number.

Add(Complex, Complex)

将两个复数相加,并返回结果。Adds two complex numbers and returns the result.

Add(Complex, Double)

将一个复数与一个双精度实数相加,并返回结果。Adds a complex number to a double-precision real number and returns the result.

Add(Double, Complex)

将一个双精度实数与一个复数相加,并返回结果。Adds a double-precision real number to a complex number and returns the result.

Asin(Complex)

返回表示指定复数的反正弦值的角度。Returns the angle that is the arc sine of the specified complex number.

Atan(Complex)

返回表示指定复数的反正切的角度。Returns the angle that is the arc tangent of the specified complex number.

Conjugate(Complex)

计算复数的共轭,并返回结果。Computes the conjugate of a complex number and returns the result.

Cos(Complex)

返回指定复数的余弦值。Returns the cosine of the specified complex number.

Cosh(Complex)

返回指定复数的双曲余弦值。Returns the hyperbolic cosine of the specified complex number.

Divide(Complex, Complex)

用一个复数除另一个复数并返回结果。Divides one complex number by another and returns the result.

Divide(Complex, Double)

将一个复数除以一个双精度实数,并返回结果。Divides one complex number by a double-precision real number and returns the result.

Divide(Double, Complex)

将一个双精度实数除以一个复数,并返回结果。Divides one double-precision real number by a complex number and returns the result.

Equals(Complex)

返回一个值,该值指示当前实例与指定的复数是否具有相同的值。Returns a value that indicates whether the current instance and a specified complex number have the same value.

Equals(Object)

返回一个值,该值指示当前实例与指定的对象是否具有相同的值。Returns a value that indicates whether the current instance and a specified object have the same value.

Exp(Complex)

返回 e 的由一个复数指定的次幂。Returns e raised to the power specified by a complex number.

FromPolarCoordinates(Double, Double)

从点的极坐标创建复数。Creates a complex number from a point's polar coordinates.

GetHashCode()

返回当前 Complex 对象的哈希代码。Returns the hash code for the current Complex object.

IsFinite(Complex)

确定指定的复数是否是有限的。Determines whether the specified complex number is finite.

IsInfinity(Complex)

返回一个值,该值指示指定复数的计算结果是否为无穷大。Returns a value indicating whether the specified complex number evaluates to infinity.

IsNaN(Complex)

返回一个值,该值指示指定的复数实例是否不为数值 (NaN)。Returns a value that indicates whether the specified complex instance is not a number (NaN).

Log(Complex)

返回指定复数的自然对数(底为 e)。Returns the natural (base e) logarithm of a specified complex number.

Log(Complex, Double)

返回指定复数在使用指定底时的对数。Returns the logarithm of a specified complex number in a specified base.

Log10(Complex)

返回指定复数以 10 为底的对数。Returns the base-10 logarithm of a specified complex number.

Multiply(Complex, Complex)

返回两个复数的乘积。Returns the product of two complex numbers.

Multiply(Complex, Double)

返回一个复数与一个双精度实数的乘积。Returns the product of a complex number and a double-precision real number.

Multiply(Double, Complex)

返回一个双精度实数与一个复数的乘积。Returns the product of a double-precision real number and a complex number.

Negate(Complex)

返回指定复数的加法逆元。Returns the additive inverse of a specified complex number.

Pow(Complex, Complex)

返回指定复数的由复数指定的次幂。Returns a specified complex number raised to a power specified by a complex number.

Pow(Complex, Double)

返回指定复数的由双精度浮点数指定的次幂。Returns a specified complex number raised to a power specified by a double-precision floating-point number.

Reciprocal(Complex)

返回复数的乘法倒数。Returns the multiplicative inverse of a complex number.

Sin(Complex)

返回指定复数的正弦值。Returns the sine of the specified complex number.

Sinh(Complex)

返回指定复数的双曲正弦值。Returns the hyperbolic sine of the specified complex number.

Sqrt(Complex)

返回指定复数的平方根。Returns the square root of a specified complex number.

Subtract(Complex, Complex)

从一个复数中减去另一个复数并返回结果。Subtracts one complex number from another and returns the result.

Subtract(Complex, Double)

一个复数减一个双精度实数,并返回结果。Subtracts one double-precision real number from a complex number and returns the result.

Subtract(Double, Complex)

一个双精度实数减一个复数,并返回结果。Subtracts one complex number from a double-precision real number and returns the result.

Tan(Complex)

返回指定复数的正切值。Returns the tangent of the specified complex number.

Tanh(Complex)

返回指定复数的双曲正切值。Returns the hyperbolic tangent of the specified complex number.

ToString()

将当前复数的值转换为其采用笛卡尔形式的等效字符串表示形式。Converts the value of the current complex number to its equivalent string representation in Cartesian form.

ToString(IFormatProvider)

使用指定的区域性特定格式设置信息,将当前复数的值转换为其采用笛卡尔形式的等效字符串表示形式。Converts the value of the current complex number to its equivalent string representation in Cartesian form by using the specified culture-specific formatting information.

ToString(String)

通过对当前复数的实部和虚部使用指定格式,将它的值转换为其采用笛卡尔形式的等效字符串表示形式。Converts the value of the current complex number to its equivalent string representation in Cartesian form by using the specified format for its real and imaginary parts.

ToString(String, IFormatProvider)

通过对当前复数的实部和虚部使用指定格式和区域性特定格式信息,将它的值转换为其采用笛卡尔形式的等效字符串表示形式。Converts the value of the current complex number to its equivalent string representation in Cartesian form by using the specified format and culture-specific format information for its real and imaginary parts.

操作员

Addition(Complex, Complex)

将两个复数相加。Adds two complex numbers.

Addition(Complex, Double)

将一个复数与一个双精度实数相加。Adds a complex number to a double-precision real number.

Addition(Double, Complex)

将一个双精度实数与一个复数相加。Adds a double-precision real number to a complex number.

Division(Complex, Complex)

用一个指定复数除另一个指定复数。Divides a specified complex number by another specified complex number.

Division(Complex, Double)

将一个指定复数除以一个指定双精度实数。Divides a specified complex number by a specified double-precision real number.

Division(Double, Complex)

将一个指定双精度实数除以一个指定复数。Divides a specified double-precision real number by a specified complex number.

Equality(Complex, Complex)

返回一个值,该值指示两个复数是否相等。Returns a value that indicates whether two complex numbers are equal.

Explicit(BigInteger to Complex)

定义从 BigInteger 值到复数的显式转换。Defines an explicit conversion of a BigInteger value to a complex number.

Explicit(Decimal to Complex)

定义从 Decimal 值到复数的显式转换。Defines an explicit conversion of a Decimal value to a complex number.

Implicit(Byte to Complex)

定义从无符号字节到复数的隐式转换。Defines an implicit conversion of an unsigned byte to a complex number.

Implicit(Double to Complex)

定义从双精度浮点数到复数的隐式转换。Defines an implicit conversion of a double-precision floating-point number to a complex number.

Implicit(Int16 to Complex)

定义从 16 位带符号整数到复数的隐式转换。Defines an implicit conversion of a 16-bit signed integer to a complex number.

Implicit(Int32 to Complex)

定义从 32 位带符号整数到复数的隐式转换。Defines an implicit conversion of a 32-bit signed integer to a complex number.

Implicit(Int64 to Complex)

定义从 64 位带符号整数到复数的隐式转换。Defines an implicit conversion of a 64-bit signed integer to a complex number.

Implicit(SByte to Complex)

定义从带符号字节到复数的隐式转换。Defines an implicit conversion of a signed byte to a complex number.

此 API 不兼容 CLS。This API is not CLS-compliant.

Implicit(Single to Complex)

定义从单精度浮点数到复数的隐式转换。Defines an implicit conversion of a single-precision floating-point number to a complex number.

Implicit(UInt16 to Complex)

定义从 16 位无符号整数到复数的隐式转换。Defines an implicit conversion of a 16-bit unsigned integer to a complex number.

此 API 不兼容 CLS。This API is not CLS-compliant.

Implicit(UInt32 to Complex)

定义从 32 位无符号整数到复数的隐式转换。Defines an implicit conversion of a 32-bit unsigned integer to a complex number.

此 API 不兼容 CLS。This API is not CLS-compliant.

Implicit(UInt64 to Complex)

定义从 64 位无符号整数到复数的隐式转换。Defines an implicit conversion of a 64-bit unsigned integer to a complex number.

此 API 不兼容 CLS。This API is not CLS-compliant.

Inequality(Complex, Complex)

返回一个值,该值指示两个复数是否不相等。Returns a value that indicates whether two complex numbers are not equal.

Multiply(Complex, Complex)

将两个指定复数相乘。Multiplies two specified complex numbers.

Multiply(Complex, Double)

将一个指定复数乘以一个指定双精度实数。Multiplies the specified complex number by a specified double-precision real number.

Multiply(Double, Complex)

将一个指定双精度实数乘以一个指定复数。Multiplies a specified double-precision real number by a specified complex number.

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.

UnaryNegation(Complex)

返回指定复数的加法逆元。Returns the additive inverse of a specified complex number.

适用于