コード例 #1
0
ファイル: hyperg.cpp プロジェクト: c304728539/itpp-fastica
double hyperg(double a, double b, double x)
{
  double asum, psum, acanc, pcanc = 0, temp;

  /* See if a Kummer transformation will help */
  temp = b - a;
  if (fabs(temp) < 0.001 * fabs(a))
    return(exp(x) * hyperg(temp, b, -x));


  psum = hy1f1p(a, b, x, &pcanc);
  if (pcanc < 1.0e-15)
    goto done;


  /* try asymptotic series */

  asum = hy1f1a(a, b, x, &acanc);


  /* Pick the result with less estimated error */

  if (acanc < pcanc) {
    pcanc = acanc;
    psum = asum;
  }

done:
  if (pcanc > 1.0e-12) {
    it_warning("hyperg(): partial loss of precision");
  }

  return(psum);
}
コード例 #2
0
ファイル: hyperg.c プロジェクト: HelioGuilherme66/gretl
double hyperg (double a, double b, double x)
{
    double asum, psum, acanc, temp, pcanc = 0;

    /* See if a Kummer transformation will help */
    temp = b - a;
    if (fabs(temp) < 0.001 * fabs(a))
	return exp(x) * hyperg(temp, b, -x);

    psum = hy1f1p(a, b, x, &pcanc);
    if (pcanc < 1.0e-15)
	goto done;

    /* try asymptotic series */
    asum = hy1f1a(a, b, x, &acanc);

    /* Pick the result with less estimated error */
    if (acanc < pcanc) {
	pcanc = acanc;
	psum = asum;
    }

 done:
    if (pcanc > 1.0e-12)
	mtherr("hyperg", CEPHES_PLOSS);

    return psum;
}