Strange results from trigonometric functions

hello,
I use trigonometric functions “tan” and “cos” in my code. The result of AMPL is strange, as shown below.

thet tan(the) cos(the)

30.97 -0.48 0.90
23.96 -2.35 0.39
33.69 -1.17 -0.65 …

Can you please explain why this happens?

Are 30.97, 23.96, and 33.69 expressed in degrees? AMPL’s trigonometric functions require their arguments to be in radians. To convert, you need to replace the by the*(2*pi/360).

To get an accurate value for \pi in AMPL, you can define param pi = 4*atan(1);.