Complex.Negate(Complex) 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回指定复数的累加反函数。
public:
static System::Numerics::Complex Negate(System::Numerics::Complex value);
C#
public static System.Numerics.Complex Negate(System.Numerics.Complex value);
static member Negate : System.Numerics.Complex -> System.Numerics.Complex
Public Shared Function Negate (value As Complex) As Complex
- value
- Complex
复数。
value
参数的 Real 和 Imaginary 组件的结果乘以 -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)
open System.Numerics
let values =
[ Complex.One; Complex(-7.1, 2.5); Complex(1.3, -4.2); Complex(-3.3, -1.8) ]
for c1 in values do
printfn $"{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)
Imports System.Numerics
Module Example
Public Sub Main()
Dim values() As Complex = { Complex.One,
New Complex(-7.1, 2.5),
New Complex(1.3, -4.2),
New Complex(-3.3, -1.8) }
For Each c1 In values
Console.WriteLine("{0} --> {1}", c1, Complex.Negate(c1))
Next
End Sub
End Module
' 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 |