Sine, Cosine, and Tangent

To understand the transcendental functions (particularly, sine, cosine, and tangent, and their friends), one must know about the relationships for a right triangle. The discussion will use the below reference figure:

Figure 12-1. A right triangle

Sine, cosine, and tangent are used when you know an angle and a length of one of the sides of a right triangle, and you want to know the length of another side. For these functions, the angle (theta) is in radians, not degrees. Using the reference diagram above, for sine, you work with the hypotenuse (AC) and the height (AB), for cosine, you work with the hypotenuse (AC) and the base length (BC), and for tangent, you work with the base and the height.


sin[Generic]

Returns the sine of a real number.

Synopsis

sin (x) => (y)

Parameters

xAn instance of <real>.

Return Values

yAn instance of <float>.

Description

Returns the sine of a real number. Using the above right triangle in Figure 12-1, the sine of theta is AB / AC. For example, say AC is 12 meters and theta is $double-pi / 6 (30 degrees). You solve for AB by multiplying AC and sine theta. AB = 12 * sin( $double-pi / 6.0) => 6 meters.


cos[Generic]

Returns the cosine of a real number.

Synopsis

cos (x) => (y)

Parameters

xAn instance of <real>.

Return Values

yAn instance of <float>.

Description

Returns the cosine of a real number. The cosine of theta is BC / AC. Problem: Given theta is $double-pi / 4 and BC is 7 meters, what length is AC? What is theta in degrees? (see the entry for $double-pi for help)


tan[Generic]

Returns the tangent of a real number.

Synopsis

tan (x) => (y)

Parameters

xAn instance of <real>.

Return Values

yAn instance of <float>.

Description

Returns the tangent of a real number. The tangent of theta is AB / BC. The canonical exercise for tangent is to compute the height of a building. Let's say you want to know how high your chimney is. You are standing 25 meters from the building, and the chimney is 4 hands above the ground (where a hand is equivalent to 12 degrees). How tall is your chimney?