The trigonometric functions available in AMPL are listed in
Table A-2 of the
AMPL book. You can write cos(. . .) and sin(. . .) for the cosine and sine functions, where . . . is replaced by any AMPL numerical expression. The units of AMPL trigonometric functions are radians, as you can see in this example:
ampl: param pi = 3.141592653589793;
ampl: display sin(pi), cos(pi);
sin(pi) = 1.22465e-16
cos(pi) = -1
(The value of sin(pi) comes out slightly nonzero because pi cannot be represented exactly in computer arithmetic.) You can easily convert from degrees; here is an example of showing the sine and cosine of 90 degrees:
ampl: param c = 180/pi;
ampl: display sin(90/c), cos(90/c);
sin(90/c) = 1
cos(90/c) = 6.12323e-17