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