chickadee » scheme » tan

exp zprocedure
log zprocedure
sin zprocedure
cos zprocedure
tan zprocedure
asin zprocedure
acos zprocedure
atan zprocedure
atan y xprocedure

These procedures are part of every implementation that supports general real numbers; they compute the usual transcendental functions. Log computes the natural logarithm of z (not the base ten logarithm). Asin, acos, and atan compute arcsine (sin^-1), arccosine (cos^-1), and arctangent (tan^-1), respectively. The two-argument variant of atan computes (angle (make-rectangular x y)) (see below), even in implementations that don't support general complex numbers.

In general, the mathematical functions log, arcsine, arccosine, and arctangent are multiply defined. The value of log z is defined to be the one whose imaginary part lies in the range from -pi (exclusive) to pi (inclusive). log 0 is undefined. With log defined this way, the values of sin^-1 z, cos^-1 z, and tan^-1 z are according to the following formulae:

sin^-1 z = - i log (i z + (1 - z^2)^1/2)

cos^-1 z = pi / 2 - sin^-1 z

tan^-1 z = (log (1 + i z) - log (1 - i z)) / (2 i)

The above specification follows [27], which in turn cites [19]; refer to these sources for more detailed discussion of branch cuts, boundary conditions, and implementation of these functions. When it is possible these procedures produce a real result from a real argument.