| 1 | /* specfunc/gsl_sf_trig.h |
| 2 | * |
| 3 | * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 3 of the License, or (at |
| 8 | * your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 | */ |
| 19 | |
| 20 | /* Author: G. Jungman */ |
| 21 | |
| 22 | #ifndef __GSL_SF_TRIG_H__ |
| 23 | #define __GSL_SF_TRIG_H__ |
| 24 | |
| 25 | #include <gsl/gsl_sf_result.h> |
| 26 | |
| 27 | #undef __BEGIN_DECLS |
| 28 | #undef __END_DECLS |
| 29 | #ifdef __cplusplus |
| 30 | # define __BEGIN_DECLS extern "C" { |
| 31 | # define __END_DECLS } |
| 32 | #else |
| 33 | # define __BEGIN_DECLS /* empty */ |
| 34 | # define __END_DECLS /* empty */ |
| 35 | #endif |
| 36 | |
| 37 | __BEGIN_DECLS |
| 38 | |
| 39 | |
| 40 | /* Sin(x) with GSL semantics. This is actually important |
| 41 | * because we want to control the error estimate, and trying |
| 42 | * to guess the error for the standard library implementation |
| 43 | * every time it is used would be a little goofy. |
| 44 | */ |
| 45 | int gsl_sf_sin_e(double x, gsl_sf_result * result); |
| 46 | double gsl_sf_sin(const double x); |
| 47 | |
| 48 | |
| 49 | /* Cos(x) with GSL semantics. |
| 50 | */ |
| 51 | int gsl_sf_cos_e(double x, gsl_sf_result * result); |
| 52 | double gsl_sf_cos(const double x); |
| 53 | |
| 54 | |
| 55 | /* Hypot(x,y) with GSL semantics. |
| 56 | */ |
| 57 | int gsl_sf_hypot_e(const double x, const double y, gsl_sf_result * result); |
| 58 | double gsl_sf_hypot(const double x, const double y); |
| 59 | |
| 60 | |
| 61 | /* Sin(z) for complex z |
| 62 | * |
| 63 | * exceptions: GSL_EOVRFLW |
| 64 | */ |
| 65 | int gsl_sf_complex_sin_e(const double zr, const double zi, gsl_sf_result * szr, gsl_sf_result * szi); |
| 66 | |
| 67 | |
| 68 | /* Cos(z) for complex z |
| 69 | * |
| 70 | * exceptions: GSL_EOVRFLW |
| 71 | */ |
| 72 | int gsl_sf_complex_cos_e(const double zr, const double zi, gsl_sf_result * czr, gsl_sf_result * czi); |
| 73 | |
| 74 | |
| 75 | /* Log(Sin(z)) for complex z |
| 76 | * |
| 77 | * exceptions: GSL_EDOM, GSL_ELOSS |
| 78 | */ |
| 79 | int gsl_sf_complex_logsin_e(const double zr, const double zi, gsl_sf_result * lszr, gsl_sf_result * lszi); |
| 80 | |
| 81 | |
| 82 | /* Sinc(x) = sin(pi x) / (pi x) |
| 83 | * |
| 84 | * exceptions: none |
| 85 | */ |
| 86 | int gsl_sf_sinc_e(double x, gsl_sf_result * result); |
| 87 | double gsl_sf_sinc(const double x); |
| 88 | |
| 89 | |
| 90 | /* Log(Sinh(x)), x > 0 |
| 91 | * |
| 92 | * exceptions: GSL_EDOM |
| 93 | */ |
| 94 | int gsl_sf_lnsinh_e(const double x, gsl_sf_result * result); |
| 95 | double gsl_sf_lnsinh(const double x); |
| 96 | |
| 97 | |
| 98 | /* Log(Cosh(x)) |
| 99 | * |
| 100 | * exceptions: none |
| 101 | */ |
| 102 | int gsl_sf_lncosh_e(const double x, gsl_sf_result * result); |
| 103 | double gsl_sf_lncosh(const double x); |
| 104 | |
| 105 | |
| 106 | /* Convert polar to rectlinear coordinates. |
| 107 | * |
| 108 | * exceptions: GSL_ELOSS |
| 109 | */ |
| 110 | int gsl_sf_polar_to_rect(const double r, const double theta, gsl_sf_result * x, gsl_sf_result * y); |
| 111 | |
| 112 | /* Convert rectilinear to polar coordinates. |
| 113 | * return argument in range [-pi, pi] |
| 114 | * |
| 115 | * exceptions: GSL_EDOM |
| 116 | */ |
| 117 | int gsl_sf_rect_to_polar(const double x, const double y, gsl_sf_result * r, gsl_sf_result * theta); |
| 118 | |
| 119 | /* Sin(x) for quantity with an associated error. |
| 120 | */ |
| 121 | int gsl_sf_sin_err_e(const double x, const double dx, gsl_sf_result * result); |
| 122 | |
| 123 | |
| 124 | /* Cos(x) for quantity with an associated error. |
| 125 | */ |
| 126 | int gsl_sf_cos_err_e(const double x, const double dx, gsl_sf_result * result); |
| 127 | |
| 128 | |
| 129 | /* Force an angle to lie in the range (-pi,pi]. |
| 130 | * |
| 131 | * exceptions: GSL_ELOSS |
| 132 | */ |
| 133 | int gsl_sf_angle_restrict_symm_e(double * theta); |
| 134 | double gsl_sf_angle_restrict_symm(const double theta); |
| 135 | |
| 136 | |
| 137 | /* Force an angle to lie in the range [0, 2pi) |
| 138 | * |
| 139 | * exceptions: GSL_ELOSS |
| 140 | */ |
| 141 | int gsl_sf_angle_restrict_pos_e(double * theta); |
| 142 | double gsl_sf_angle_restrict_pos(const double theta); |
| 143 | |
| 144 | |
| 145 | int gsl_sf_angle_restrict_symm_err_e(const double theta, gsl_sf_result * result); |
| 146 | |
| 147 | int gsl_sf_angle_restrict_pos_err_e(const double theta, gsl_sf_result * result); |
| 148 | |
| 149 | |
| 150 | __END_DECLS |
| 151 | |
| 152 | #endif /* __GSL_SF_TRIG_H__ */ |
| 153 | |