gsl_sf_trig.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. /* Author: G. Jungman */
  20. #ifndef __GSL_SF_TRIG_H__
  21. #define __GSL_SF_TRIG_H__
  22. #include "gsl_sf_result.h"
  23. #undef __BEGIN_DECLS
  24. #undef __END_DECLS
  25. #ifdef __cplusplus
  26. # define __BEGIN_DECLS extern "C" {
  27. # define __END_DECLS }
  28. #else
  29. # define __BEGIN_DECLS /* empty */
  30. # define __END_DECLS /* empty */
  31. #endif
  32. __BEGIN_DECLS
  33. /* Sin(x) with GSL semantics. This is actually important
  34. * because we want to control the error estimate, and trying
  35. * to guess the error for the standard library implementation
  36. * every time it is used would be a little goofy.
  37. */
  38. int gsl_sf_sin_e(double x, gsl_sf_result * result);
  39. double gsl_sf_sin(const double x);
  40. /* Cos(x) with GSL semantics.
  41. */
  42. int gsl_sf_cos_e(double x, gsl_sf_result * result);
  43. double gsl_sf_cos(const double x);
  44. /* Hypot(x,y) with GSL semantics.
  45. */
  46. int gsl_sf_hypot_e(const double x, const double y, gsl_sf_result * result);
  47. double gsl_sf_hypot(const double x, const double y);
  48. /* Sin(z) for complex z
  49. *
  50. * exceptions: GSL_EOVRFLW
  51. */
  52. int gsl_sf_complex_sin_e(const double zr, const double zi, gsl_sf_result * szr, gsl_sf_result * szi);
  53. /* Cos(z) for complex z
  54. *
  55. * exceptions: GSL_EOVRFLW
  56. */
  57. int gsl_sf_complex_cos_e(const double zr, const double zi, gsl_sf_result * czr, gsl_sf_result * czi);
  58. /* Log(Sin(z)) for complex z
  59. *
  60. * exceptions: GSL_EDOM, GSL_ELOSS
  61. */
  62. int gsl_sf_complex_logsin_e(const double zr, const double zi, gsl_sf_result * lszr, gsl_sf_result * lszi);
  63. /* Sinc(x) = sin(pi x) / (pi x)
  64. *
  65. * exceptions: none
  66. */
  67. int gsl_sf_sinc_e(double x, gsl_sf_result * result);
  68. double gsl_sf_sinc(const double x);
  69. /* Log(Sinh(x)), x > 0
  70. *
  71. * exceptions: GSL_EDOM
  72. */
  73. int gsl_sf_lnsinh_e(const double x, gsl_sf_result * result);
  74. double gsl_sf_lnsinh(const double x);
  75. /* Log(Cosh(x))
  76. *
  77. * exceptions: none
  78. */
  79. int gsl_sf_lncosh_e(const double x, gsl_sf_result * result);
  80. double gsl_sf_lncosh(const double x);
  81. /* Convert polar to rectlinear coordinates.
  82. *
  83. * exceptions: GSL_ELOSS
  84. */
  85. int gsl_sf_polar_to_rect(const double r, const double theta, gsl_sf_result * x, gsl_sf_result * y);
  86. /* Convert rectilinear to polar coordinates.
  87. * return argument in range [-pi, pi]
  88. *
  89. * exceptions: GSL_EDOM
  90. */
  91. int gsl_sf_rect_to_polar(const double x, const double y, gsl_sf_result * r, gsl_sf_result * theta);
  92. /* Sin(x) for quantity with an associated error.
  93. */
  94. int gsl_sf_sin_err_e(const double x, const double dx, gsl_sf_result * result);
  95. /* Cos(x) for quantity with an associated error.
  96. */
  97. int gsl_sf_cos_err_e(const double x, const double dx, gsl_sf_result * result);
  98. /* Force an angle to lie in the range (-pi,pi].
  99. *
  100. * exceptions: GSL_ELOSS
  101. */
  102. int gsl_sf_angle_restrict_symm_e(double * theta);
  103. double gsl_sf_angle_restrict_symm(const double theta);
  104. /* Force an angle to lie in the range [0, 2pi)
  105. *
  106. * exceptions: GSL_ELOSS
  107. */
  108. int gsl_sf_angle_restrict_pos_e(double * theta);
  109. double gsl_sf_angle_restrict_pos(const double theta);
  110. int gsl_sf_angle_restrict_symm_err_e(const double theta, gsl_sf_result * result);
  111. int gsl_sf_angle_restrict_pos_err_e(const double theta, gsl_sf_result * result);
  112. __END_DECLS
  113. #endif /* __GSL_SF_TRIG_H__ */