bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gsl] problem in calling function gsl_sf_hyperg_2F1


From: Patrick Alken
Subject: Re: [Bug-gsl] problem in calling function gsl_sf_hyperg_2F1
Date: Tue, 31 Mar 2015 10:48:06 -0600
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

Hello,

The issue seems to be one of the hypergeometric series not converging properly, however the resulting solution doesn't seem to be affected too much. You can use

gsl_set_error_handler_off()

to ignore the error, and you should find the resulting value agrees pretty well with Mathematica. Unfortunately when you do this the error code is not properly passed to the user program so I've corrected this on the git repository.

Patrick

On 03/30/2015 11:54 PM, liweiming wrote:
I have a problem calling function gsl_sf_hyperg_2F1 in gsl.  My orginal code is 
:

#include <gsl/gsl_sf_hyperg.h>
#include <cmath>
#include <iostream>

int main(int argc, char * argv[])
{
     double result;
     double a, b, c, x;
     a = 3.23191;
     b = -4.0229;
     c = 8.02291;
     x = 0.5;
     result = gsl_sf_hyperg_2F1(a, b, c, x);
     std::cout << "result = " << result << std::endl;
     return 0;
}

My gcc version is 4.8.2. I could compile and link with no problem.
I complied using :  g++ -o test test.cpp -lgsl -lgslcblas

But on running, it returned the following message:
$ ./test
gsl: hyperg_2F1.c:65: ERROR: error
Default GSL error handler invoked.
Aborted (core dumped)


But by definition the series should be convergent at x=0.5.
I could get the result using maple, which returned the following :

hypergeom([3.32191, -4.0229], [8.0229], .5);
                           0.4186139005

Is it because I made a mistake when calling this function ?

Thank you very much !




reply via email to

[Prev in Thread] Current Thread [Next in Thread]