C# Complex Magnitude

Description

Complex Magnitude Gets the magnitude (or absolute value) of a complex number.

Syntax

Complex.Magnitude has the following syntax.


public double Magnitude { get; }

Example


using System;/*from   ww w .  j a  v  a 2 s.  c o  m*/
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 code above generates the following result.





















Home »
  C# Tutorial »
    System.Numerics »




BigInteger
Complex