/[gsl]/gsl/cdf/cdf_gamma.c
ViewVC logotype

Diff of /gsl/cdf/cdf_gamma.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.9 by jstover, Mon Feb 17 23:13:27 2003 UTC revision 1.1.2.10 by jstover, Wed Feb 19 22:29:06 2003 UTC
# Line 1  Line 1 
1  /* cdf/cdf_gamma.c  /* cdf/cdf_gamma.c
2   *   *
3   * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002 Gerard Jungman   * Copyright (C) 2003 Jason Stover.
  * and Jason Stover.  
4   *   *
5   * This program is free software; you can redistribute it and/or modify   * 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   * it under the terms of the GNU General Public License as published by
# Line 19  Line 18 
18   */   */
19    
20  /*  /*
21   * Author:  G. Jungman   * Author: J. Stover
  * modified for gsl/cdf by J. Stover.  
22   */   */
23    
24  #include <config.h>  #include <config.h>
# Line 55  static double gsl_cdf_g(double x) Line 53  static double gsl_cdf_g(double x)
53      }      }
54    else if ( x > 0.0 )    else if ( x > 0.0 )
55      {      {
56        tmp = 1.0-x*x;        tmp = 1.0-x;
57        val = (tmp+2*x*log(x))/(tmp*tmp);        tmp *= tmp;
58          val = (1.0-x*x+2*x*log(x))/tmp;
59        return val;        return val;
60      }      }
61    else    else
# Line 64  static double gsl_cdf_g(double x) Line 63  static double gsl_cdf_g(double x)
63        return GSL_EDOM;        return GSL_EDOM;
64      }      }
65  }  }
66  static double gsl_cdf_norm_arg ( double x, double y )  static double gsl_cdf_norm_arg ( double x, double shape )
67  {  {
68    double val;    double val;
69    double tmp;    double tmp;
70        
71    val = x + 1/3 - y - 0.2/y;    val = x + 1/3 - shape - 0.02/shape;
72    tmp = gsl_cdf_g ( (y-.5)/x);    tmp = gsl_cdf_g ( (shape-.5)/x);
73    if (tmp != GSL_EDOM )    if (tmp != GSL_EDOM )
74      {      {
75        val *= sqrt ( (1+tmp)/x);        val *= sqrt ( (1+tmp)/x);
# Line 96  double gsl_cdf_gamma_P ( double x, doubl Line 95  double gsl_cdf_gamma_P ( double x, doubl
95      {      {
96        return GSL_EDOM;        return GSL_EDOM;
97      }      }
98      if ( x <= 0.0 )
99        {
100          return 0.0;
101        }
102    y = x / scale;    y = x / scale;
103    if( shape < BIG_SHAPE )    if( shape < BIG_SHAPE )
104      {      {
# Line 130  double gsl_cdf_gamma_Q ( double x, doubl Line 133  double gsl_cdf_gamma_Q ( double x, doubl
133      {      {
134        return GSL_EDOM;        return GSL_EDOM;
135      }      }
136      if( x <= 0.0 )
137        {
138          return 1.0;
139        }
140    y = x / scale;    y = x / scale;
141    if ( shape < BIG_SHAPE )    if ( shape < BIG_SHAPE )
142      {      {

Legend:
Removed from v.1.1.2.9  
changed lines
  Added in v.1.1.2.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26