I am trying to calculate the value of [e^i6(theta)]^2
using C. I am just showing few lines of my code. I have added additional header file as suggested by this answer (How to work with complex numbers in C?):
#include <stdio.h>
#include <math.h>
float theta;
float dist,xcoord,division;
fprintf(fs,"%f\t%f\t%f\t%f\t%f\n",
dist, xcoord, division,
6*theta, pow(exp(I*6*theta),2));
My output is:
1.00000
first 3 lines of my output file:
94.214905 68.130005 0.723134 4.574803 1.000000
107.493179 -33.500000 -0.311648 11.326338 1.000000
120.586807 52.529999 0.435620 6.720418 1.000000
Which I don't think is correct. What could I possibly include to make it work? I agree I can break down this formula in cos and sin but I am looking for a direct option.