How to use #include <math.h> in arduino

Like I said before:

(2) You use uninitialized variables.

This line:

  P = (duration*2*Pi)/T;

depends upon the value of duration, which probably defaults to zero when you don't provide a value. Of course this results in P being zero. What do you expect?

Oh, and just credit me as vaj4088. Thanks

Oh, and the documentation at https://www.arduino.cc/en/Reference/Cos

could be clearer, but it says that cos(...) takes a float - in radians - and returns a double. There is nothing that should be assumed about taking P and putting it in double quotes. There is nothing about degrees.

I have reason with my variable,
I choose P for Phase
ang for angle
T for Period (length of 1 period in ms)
duration for input (ms)
then I put in double cause I thinking it count in degree at the moment,

the formula

P = (duration*2*Pi)/T;

the formula is correct, based

P = (duration*360*Pi)/(180*T) // this formulas convert degree to rad

Actually I have duration in setup stage
but the result still 0 because I forgot to put that in loop stage.

#include <LiquidCrystal.h>
#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG)

int pin = 7;
double Hz = 50;
double T = (1000/Hz);
const float Pi = 3.14159; 
double P;
double PF;
double duration;

LiquidCrystal lcd(12, 11, 5, 4, 10, 9);

void setup() 
{
 lcd.begin(17, 3);
 pinMode(pin, INPUT);
 P = (duration*2*Pi)/T;
 PF = cos(P);
}

void loop()
 {
 P = (duration*2*Pi)/T;
 PF = cos(P);
 lcd.setCursor(0, 0);
 duration = pulseIn(pin, HIGH);
 lcd.print(PF);
 lcd.setCursor(0, 1);
 lcd.print(P);
 lcd.setCursor(7, 0);
 lcd.print(T);
 lcd.setCursor(7, 3);
 lcd.print(duration);
}

Its work