cos x computes the cosine of the angle x, where x is measured in degrees:

cos x

x

write cos 90

To compute the cosine in radians, you can use Math.cos instead:

Math.cos

write Math.cos PI/2

Other trigonometric functions include sin and tan.

sin

tan