C# Complex Abs
Description
Complex Abs
Gets the absolute value (or magnitude) of
a complex number.
Syntax
Complex.Abs
has the following syntax.
public static double Abs(
Complex value
)
Parameters
Complex.Abs
has the following parameters.
value
- A complex number.
Returns
Complex.Abs
method returns The absolute value of value.
Example
/*from www .j a va 2s. c om*/
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 code above generates the following result.