Go to the first, previous, next, last section, table of contents.

Trigonometric/Hyperbolic Functions

The shift-S (calc-sin) [sin] command computes the sine of an angle or complex number. If the input is an HMS form, it is interpreted as degrees-minutes-seconds; otherwise, the input is interpreted according to the current angular mode. It is best to use Radians mode when operating on complex numbers.

Calc's "units" mechanism includes angular units like deg, rad, and grad. While `sin(45 deg)' is not evaluated all the time, the u s (calc-simplify-units) command will simplify `sin(45 deg)' by taking the sine of 45 degrees, regardless of the current angular mode. See section Basic Operations on Units.

Also, the symbolic variable pi is not ordinarily recognized in arguments to trigonometric functions, as in `sin(3 pi / 4)', but the a s (calc-simplify) command recognizes many such formulas when the current angular mode is radians and symbolic mode is enabled; this example would be replaced by `sqrt(2) / 2'. See section Symbolic Mode. Beware, this simplification occurs even if you have stored a different value in the variable `pi'; this is one reason why changing built-in variables is a bad idea. Arguments of the form x plus a multiple of @c{$\pi/2$} pi/2 are also simplified. Calc includes similar formulas for cos and tan.

The a s command knows all angles which are integer multiples of pi/12, @c{$\pi/10$} pi/10, or @c{$\pi/8$} pi/8 radians. In degrees mode, analogous simplifications occur for integer multiples of 15 or 18 degrees, and for arguments plus multiples of 90 degrees.

With the Inverse flag, calc-sin computes an arcsine. This is also available as the calc-arcsin command or arcsin algebraic function. The returned argument is converted to degrees, radians, or HMS notation depending on the current angular mode.

With the Hyperbolic flag, calc-sin computes the hyperbolic sine, also available as calc-sinh [sinh]. With the Hyperbolic and Inverse flags, it computes the hyperbolic arcsine (calc-arcsinh) [arcsinh].

The shift-C (calc-cos) [cos] command computes the cosine of an angle or complex number, and shift-T (calc-tan) [tan] computes the tangent, along with all the various inverse and hyperbolic variants of these functions.

The f T (calc-arctan2) [arctan2] command takes two numbers from the stack and computes the arc tangent of their ratio. The result is in the full range from -180 (exclusive) to +180 (inclusive) degrees, or the analogous range in radians. A similar result would be obtained with / followed by I T, but the value would only be in the range from -90 to +90 degrees since the division loses information about the signs of the two components, and an error might result from an explicit division by zero which arctan2 would avoid. By (arbitrary) definition, `arctan2(0,0)=0'.

The calc-sincos [sincos] command computes the sine and cosine of a number, returning them as a vector of the form `[cos, sin]'. With the Inverse flag [arcsincos], this command takes a two-element vector as an argument and computes arctan2 of the elements. (This command does not accept the Hyperbolic flag.)


Go to the first, previous, next, last section, table of contents.