Complex.Negate(Complex) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
傳回指定之複數的加法反元素。
public:
static System::Numerics::Complex Negate(System::Numerics::Complex value);
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 的結果。
範例
下列範例會取得複數陣列中每個元素的加法反值。
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)
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
適用於
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應