| 1 |
/* specfunc/hyperg_2F0.c |
| 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 |
#include "gsl__config.h" |
| 23 |
#include "gsl_math.h" |
| 24 |
#include "gsl_errno.h" |
| 25 |
#include "gsl_sf_hyperg.h" |
| 26 |
|
| 27 |
#include "gsl_specfunc__error.h" |
| 28 |
#include "gsl_specfunc__hyperg.h" |
| 29 |
|
| 30 |
int |
| 31 |
gsl_sf_hyperg_2F0_e(const double a, const double b, const double x, gsl_sf_result * result) |
| 32 |
{ |
| 33 |
if(x < 0.0) { |
| 34 |
/* Use "definition" 2F0(a,b,x) = (-1/x)^a U(a,1+a-b,-1/x). |
| 35 |
*/ |
| 36 |
gsl_sf_result U; |
| 37 |
double pre = pow(-1.0/x, a); |
| 38 |
int stat_U = gsl_sf_hyperg_U_e(a, 1.0+a-b, -1.0/x, &U); |
| 39 |
result->val = pre * U.val; |
| 40 |
result->err = GSL_DBL_EPSILON * fabs(result->val) + pre * U.err; |
| 41 |
return stat_U; |
| 42 |
} |
| 43 |
else if(x == 0.0) { |
| 44 |
result->val = 1.0; |
| 45 |
result->err = 0.0; |
| 46 |
return GSL_SUCCESS; |
| 47 |
} |
| 48 |
else { |
| 49 |
/* Use asymptotic series. ?? |
| 50 |
*/ |
| 51 |
/* return hyperg_2F0_series(a, b, x, -1, result, &prec); */ |
| 52 |
DOMAIN_ERROR(result); |
| 53 |
} |
| 54 |
} |
| 55 |
|
| 56 |
/*-*-*-*-*-*-*-*-*-* Functions w/ Natural Prototypes *-*-*-*-*-*-*-*-*-*-*/ |
| 57 |
|
| 58 |
#include "gsl_specfunc__eval.h" |
| 59 |
|
| 60 |
double gsl_sf_hyperg_2F0(const double a, const double b, const double x) |
| 61 |
{ |
| 62 |
EVAL_RESULT(gsl_sf_hyperg_2F0_e(a, b, x, &result)); |
| 63 |
} |