1 @cindex trigonometric functions
3 The library includes its own trigonometric functions in order to provide
4 consistency across platforms and reliable error estimates. These
5 functions are declared in the header file @file{gsl_sf_trig.h}.
8 * Circular Trigonometric Functions::
9 * Trigonometric Functions for Complex Arguments::
10 * Hyperbolic Trigonometric Functions::
11 * Conversion Functions::
12 * Restriction Functions::
13 * Trigonometric Functions With Error Estimates::
16 @node Circular Trigonometric Functions
17 @subsection Circular Trigonometric Functions
19 @deftypefun double gsl_sf_sin (double @var{x})
20 @deftypefunx int gsl_sf_sin_e (double @var{x}, gsl_sf_result * @var{result})
21 @cindex sine function, special functions
22 These routines compute the sine function @math{\sin(x)}.
23 @comment Exceptional Return Values:
26 @deftypefun double gsl_sf_cos (double @var{x})
27 @deftypefunx int gsl_sf_cos_e (double @var{x}, gsl_sf_result * @var{result})
28 @cindex cosine function, special functions
29 These routines compute the cosine function @math{\cos(x)}.
30 @comment Exceptional Return Values:
33 @deftypefun double gsl_sf_hypot (double @var{x}, double @var{y})
34 @deftypefunx int gsl_sf_hypot_e (double @var{x}, double @var{y}, gsl_sf_result * @var{result})
35 @cindex hypot function, special functions
36 These routines compute the hypotenuse function @c{$\sqrt{x^2 + y^2}$}
37 @math{\sqrt@{x^2 + y^2@}} avoiding overflow and underflow.
38 @comment Exceptional Return Values:
41 @deftypefun double gsl_sf_sinc (double @var{x})
42 @deftypefunx int gsl_sf_sinc_e (double @var{x}, gsl_sf_result * @var{result})
43 @cindex complex sinc function, special functions
44 These routines compute @math{\sinc(x) = \sin(\pi x) / (\pi x)} for any
46 @comment Exceptional Return Values: none
49 @node Trigonometric Functions for Complex Arguments
50 @subsection Trigonometric Functions for Complex Arguments
52 @deftypefun int gsl_sf_complex_sin_e (double @var{zr}, double @var{zi}, gsl_sf_result * @var{szr}, gsl_sf_result * @var{szi})
53 @cindex complex sine function, special functions
54 This function computes the complex sine, @math{\sin(z_r + i z_i)} storing
55 the real and imaginary parts in @var{szr}, @var{szi}.
56 @comment Exceptional Return Values: GSL_EOVRFLW
59 @deftypefun int gsl_sf_complex_cos_e (double @var{zr}, double @var{zi}, gsl_sf_result * @var{czr}, gsl_sf_result * @var{czi})
60 @cindex complex cosine function, special functions
61 This function computes the complex cosine, @math{\cos(z_r + i z_i)} storing
62 the real and imaginary parts in @var{szr}, @var{szi}.
63 @comment Exceptional Return Values: GSL_EOVRFLW
66 @deftypefun int gsl_sf_complex_logsin_e (double @var{zr}, double @var{zi}, gsl_sf_result * @var{lszr}, gsl_sf_result * @var{lszi})
67 @cindex complex log sine function, special functions
68 This function computes the logarithm of the complex sine,
69 @math{\log(\sin(z_r + i z_i))} storing the real and imaginary parts in
71 @comment Exceptional Return Values: GSL_EDOM, GSL_ELOSS
74 @node Hyperbolic Trigonometric Functions
75 @subsection Hyperbolic Trigonometric Functions
77 @deftypefun double gsl_sf_lnsinh (double @var{x})
78 @deftypefunx int gsl_sf_lnsinh_e (double @var{x}, gsl_sf_result * @var{result})
79 @cindex logarithm of sinh function, special functions
80 These routines compute @math{\log(\sinh(x))} for @math{x > 0}.
81 @comment Domain: x > 0
82 @comment Exceptional Return Values: GSL_EDOM
85 @deftypefun double gsl_sf_lncosh (double @var{x})
86 @deftypefunx int gsl_sf_lncosh_e (double @var{x}, gsl_sf_result * @var{result})
87 @cindex logarithm of cosh function, special functions
88 These routines compute @math{\log(\cosh(x))} for any @var{x}.
89 @comment Exceptional Return Values: none
93 @node Conversion Functions
94 @subsection Conversion Functions
95 @cindex polar to rectangular conversion
96 @cindex rectangular to polar conversion
98 @deftypefun int gsl_sf_polar_to_rect (double @var{r}, double @var{theta}, gsl_sf_result * @var{x}, gsl_sf_result * @var{y});
99 This function converts the polar coordinates (@var{r},@var{theta}) to
100 rectilinear coordinates (@var{x},@var{y}), @math{x = r\cos(\theta)},
101 @math{y = r\sin(\theta)}.
102 @comment Exceptional Return Values: GSL_ELOSS
105 @deftypefun int gsl_sf_rect_to_polar (double @var{x}, double @var{y}, gsl_sf_result * @var{r}, gsl_sf_result * @var{theta})
106 This function converts the rectilinear coordinates (@var{x},@var{y}) to
107 polar coordinates (@var{r},@var{theta}), such that @math{x =
108 r\cos(\theta)}, @math{y = r\sin(\theta)}. The argument @var{theta}
109 lies in the range @math{[-\pi, \pi]}.
110 @comment Exceptional Return Values: GSL_EDOM
113 @node Restriction Functions
114 @subsection Restriction Functions
115 @cindex angular reduction
116 @cindex reduction of angular variables
118 @deftypefun double gsl_sf_angle_restrict_symm (double @var{theta})
119 @deftypefunx int gsl_sf_angle_restrict_symm_e (double * @var{theta})
120 These routines force the angle @var{theta} to lie in the range
123 Note that the mathematical value of @math{\pi} is slightly greater
124 than @code{M_PI}, so the machine numbers @code{M_PI} and @code{-M_PI}
125 are included in the range.
126 @comment Exceptional Return Values: GSL_ELOSS
129 @deftypefun double gsl_sf_angle_restrict_pos (double @var{theta})
130 @deftypefunx int gsl_sf_angle_restrict_pos_e (double * @var{theta})
131 These routines force the angle @var{theta} to lie in the range @math{[0,
134 Note that the mathematical value of @math{2\pi} is slightly greater
135 than @code{2*M_PI}, so the machine number @code{2*M_PI} is included in
138 @comment Exceptional Return Values: GSL_ELOSS
142 @node Trigonometric Functions With Error Estimates
143 @subsection Trigonometric Functions With Error Estimates
145 @deftypefun int gsl_sf_sin_err_e (double @var{x}, double @var{dx}, gsl_sf_result * @var{result})
146 This routine computes the sine of an angle @var{x} with an associated
147 absolute error @var{dx},
149 @math{\sin(x \pm dx)}. Note that this function is provided in the error-handling form only since
150 its purpose is to compute the propagated error.
153 @deftypefun int gsl_sf_cos_err_e (double @var{x}, double @var{dx}, gsl_sf_result * @var{result})
154 This routine computes the cosine of an angle @var{x} with an associated
155 absolute error @var{dx},
157 @math{\cos(x \pm dx)}. Note that this function is provided in the error-handling form only since
158 its purpose is to compute the propagated error.