Complex.Negate(Complex) 方法

定义

返回指定复数的累加反函数。

C#
public static System.Numerics.Complex Negate(System.Numerics.Complex value);

参数

value
Complex

复数。

返回

value 参数的 RealImaginary 组件的结果乘以 -1。

示例

以下示例获取复数数组中每个元素的累加反函数。

C#
using System;
using System.Numerics;

public class Example
{
   public static void Main()
   {
      Complex[] values= { Complex.One,
                          new Complex(-7.1, 2.5),
                          new Complex(1.3, -4.2),
                          new Complex(-3.3, -1.8) };
      foreach (Complex c1 in values)
         Console.WriteLine("{0} --> {1}", c1, Complex.Negate(c1));
   }
}
// The example displays the following output:
//       (1, 0) --> (-1, 0)
//       (-7.1, 2.5) --> (7.1, -2.5)
//       (1.3, -4.2) --> (-1.3, 4.2)
//       (-3.3, -1.8) --> (3.3, 1.8)

注解

复数的累加反数是一个复数,当它被添加到原始复数时,它会产生 Zero 的值。 此方法返回一个复数,其中原始复数的实数和虚部乘以 -1。

Negate 方法针对不支持自定义运算符的语言实现。 其行为与使用一元求反运算符求反相同,UnaryNegation

适用于

产品 版本
.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

另请参阅