C# Complex Phase
Description
Complex Phase
Gets the phase of a complex number.
Syntax
Complex.Phase
has the following syntax.
public double Phase { get; }
Example
/*from w ww. j av a 2 s. c o m*/
using System;
using System.Numerics;
public class Example
{
public static void Main()
{
Complex c1 = Complex.FromPolarCoordinates(10, 45 * Math.PI / 180);
Console.WriteLine("{0}:", c1);
Console.WriteLine(" Magnitude: {0}", Complex.Abs(c1));
Console.WriteLine(" Phase: {0} radians", c1.Phase);
Console.WriteLine(" Phase {0} degrees", c1.Phase * 180/Math.PI);
Console.WriteLine(" Atan(b/a): {0}", Math.Atan(c1.Imaginary/c1.Real));
}
}
The code above generates the following result.