gsl_sf_exp.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /* specfunc/gsl_sf_exp.h
  2. *
  3. * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 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_EXP_H__
  21. #define __GSL_SF_EXP_H__
  22. #include "gsl_sf_result.h"
  23. #include "gsl_precision.h"
  24. #undef __BEGIN_DECLS
  25. #undef __END_DECLS
  26. #ifdef __cplusplus
  27. # define __BEGIN_DECLS extern "C" {
  28. # define __END_DECLS }
  29. #else
  30. # define __BEGIN_DECLS /* empty */
  31. # define __END_DECLS /* empty */
  32. #endif
  33. __BEGIN_DECLS
  34. /* Provide an exp() function with GSL semantics,
  35. * i.e. with proper error checking, etc.
  36. *
  37. * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW
  38. */
  39. int gsl_sf_exp_e(const double x, gsl_sf_result * result);
  40. double gsl_sf_exp(const double x);
  41. /* Exp(x)
  42. *
  43. * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW
  44. */
  45. int gsl_sf_exp_e10_e(const double x, gsl_sf_result_e10 * result);
  46. /* Exponentiate and multiply by a given factor: y * Exp(x)
  47. *
  48. * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW
  49. */
  50. int gsl_sf_exp_mult_e(const double x, const double y, gsl_sf_result * result);
  51. double gsl_sf_exp_mult(const double x, const double y);
  52. /* Exponentiate and multiply by a given factor: y * Exp(x)
  53. *
  54. * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW
  55. */
  56. int gsl_sf_exp_mult_e10_e(const double x, const double y, gsl_sf_result_e10 * result);
  57. /* exp(x)-1
  58. *
  59. * exceptions: GSL_EOVRFLW
  60. */
  61. int gsl_sf_expm1_e(const double x, gsl_sf_result * result);
  62. double gsl_sf_expm1(const double x);
  63. /* (exp(x)-1)/x = 1 + x/2 + x^2/(2*3) + x^3/(2*3*4) + ...
  64. *
  65. * exceptions: GSL_EOVRFLW
  66. */
  67. int gsl_sf_exprel_e(const double x, gsl_sf_result * result);
  68. double gsl_sf_exprel(const double x);
  69. /* 2(exp(x)-1-x)/x^2 = 1 + x/3 + x^2/(3*4) + x^3/(3*4*5) + ...
  70. *
  71. * exceptions: GSL_EOVRFLW
  72. */
  73. int gsl_sf_exprel_2_e(double x, gsl_sf_result * result);
  74. double gsl_sf_exprel_2(const double x);
  75. /* Similarly for the N-th generalization of
  76. * the above. The so-called N-relative exponential
  77. *
  78. * exprel_N(x) = N!/x^N (exp(x) - Sum[x^k/k!, {k,0,N-1}])
  79. * = 1 + x/(N+1) + x^2/((N+1)(N+2)) + ...
  80. * = 1F1(1,1+N,x)
  81. */
  82. int gsl_sf_exprel_n_e(const int n, const double x, gsl_sf_result * result);
  83. double gsl_sf_exprel_n(const int n, const double x);
  84. /* Exponentiate a quantity with an associated error.
  85. */
  86. int gsl_sf_exp_err_e(const double x, const double dx, gsl_sf_result * result);
  87. /* Exponentiate a quantity with an associated error.
  88. */
  89. int gsl_sf_exp_err_e10_e(const double x, const double dx, gsl_sf_result_e10 * result);
  90. /* Exponentiate and multiply by a given factor: y * Exp(x),
  91. * for quantities with associated errors.
  92. *
  93. * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW
  94. */
  95. int gsl_sf_exp_mult_err_e(const double x, const double dx, const double y, const double dy, gsl_sf_result * result);
  96. /* Exponentiate and multiply by a given factor: y * Exp(x),
  97. * for quantities with associated errors.
  98. *
  99. * exceptions: GSL_EOVRFLW, GSL_EUNDRFLW
  100. */
  101. int gsl_sf_exp_mult_err_e10_e(const double x, const double dx, const double y, const double dy, gsl_sf_result_e10 * result);
  102. __END_DECLS
  103. #endif /* __GSL_SF_EXP_H__ */