Aracılığıyla paylaş


Complex.Abs(Complex) Yöntem

Tanım

Karmaşık bir sayının mutlak değerini (veya büyüklüğünü) alır.

public:
 static double Abs(System::Numerics::Complex value);
public static double Abs(System.Numerics.Complex value);
static member Abs : System.Numerics.Complex -> double
Public Shared Function Abs (value As Complex) As Double

Parametreler

value
Complex

Karmaşık bir sayı.

Döndürülenler

değerinin valuemutlak değeri.

Örnekler

Aşağıdaki örnek, karmaşık bir sayının mutlak değerini hesaplar ve özelliğin Magnitude değerine eşdeğer olduğunu gösterir.

using System;
using System.Numerics;

public class Example
{
   public static void Main()
   {
      Complex complex1 = new Complex(2.0, 3.0);
      Console.WriteLine("|{0}| = {1:N2}", complex1, Complex.Abs(complex1));
      Console.WriteLine("Equal to Magnitude: {0}",
                        Complex.Abs(complex1).Equals(complex1.Magnitude));
   }
}
// The example displays the following output:
//       |(2, 3)| = 3.61
//       Equal to Magnitude: True
open System.Numerics

let complex1 = Complex(2., 3.)
printfn $"|{complex1}| = {Complex.Abs complex1:N2}"
printfn $"Equal to Magnitude: {Complex.Abs(complex1).Equals complex1.Magnitude}"
// The example displays the following output:
//       |(2, 3)| = 3.61
//       Equal to Magnitude: True

Açıklamalar

Karmaşık bir sayının mutlak değeri, özelliğine Magnitude eşdeğerdir. Karmaşık bir sayının a + bi mutlak değeri aşağıdaki gibi hesaplanır:

  • ise b = 0, sonuç olur a.
  • ise a > b, sonuç \times \sqrt{1 + \frac{b^2}{a^2}}$ $a olur.
  • ise b > a, sonuç \times \sqrt{1 + \frac{a^2}{b^2}}$ $b olur.

Mutlak değerin hesaplanması taşmayla sonuçlanırsa, yöntem veya Double.NegativeInfinitydöndürürDouble.PositiveInfinity. veya özelliği ise ve diğer özellik ne de Double.NegativeInfinityDouble.PositiveInfinity ise yöntemi döndürürDouble.NaN.Double.NaNImaginaryReal

Şunlara uygulanır

Ayrıca bkz.