Next: , Previous: , Up: Scientific Functions   [Contents][Index]

8.2 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 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 default algebraic simplifications recognize 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 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 ‘pi/2’ are also simplified. Calc includes similar formulas for cos and tan.

Calc’s algebraic simplifications know all angles which are integer multiples of ‘pi/12’, ‘pi/10’, or ‘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.)

The remaining trigonometric functions, calc-sec [sec], calc-csc [csc] and calc-cot [cot], are also available. With the Hyperbolic flag, these compute their hyperbolic counterparts, which are also available separately as calc-sech [sech], calc-csch [csch] and calc-coth [coth]. (These commands do not accept the Inverse flag.)

Next: Advanced Mathematical Functions, Previous: Logarithmic Functions, Up: Scientific Functions   [Contents][Index]