I'm trying to convert a complex number from rectangular form to polar. Using the old school method (pencil and calculator) i get:
25 + j20 Rectangular
32<38.66 polar
the following is the code i'm using:
static void Main(string[] args)
{
Complex RA = new Complex(25, 20);
Console.WriteLine("{0} + i{1}", RA.Real, RA.Imaginary);
double r, q;
r = Math.Sqrt((RA.Real * RA.Real) + (RA.Imaginary * RA.Imaginary));
q = Math.Atan(RA.Imaginary/RA.Real);
Console.WriteLine("{0} < {1}", r, q);
Console.ReadLine();
}
And the console is printing
25 + i20
32 < 0.674
Can anyone help me to get the correct answer from the Atan function?