btdtrl.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* btdtrl.c
  2. *
  3. * Beta distribution
  4. *
  5. *
  6. *
  7. * SYNOPSIS:
  8. *
  9. * long double a, b, x, y, btdtrl();
  10. *
  11. * y = btdtrl( a, b, x );
  12. *
  13. *
  14. *
  15. * DESCRIPTION:
  16. *
  17. * Returns the area from zero to x under the beta density
  18. * function:
  19. *
  20. *
  21. * x
  22. * - -
  23. * | (a+b) | | a-1 b-1
  24. * P(x) = ---------- | t (1-t) dt
  25. * - - | |
  26. * | (a) | (b) -
  27. * 0
  28. *
  29. *
  30. * The mean value of this distribution is a/(a+b). The variance
  31. * is ab/[(a+b)^2 (a+b+1)].
  32. *
  33. * This function is identical to the incomplete beta integral
  34. * function, incbetl(a, b, x).
  35. *
  36. * The complemented function is
  37. *
  38. * 1 - P(1-x) = incbetl( b, a, x );
  39. *
  40. *
  41. * ACCURACY:
  42. *
  43. * See incbetl.c.
  44. *
  45. */
  46. /* btdtrl() */
  47. /*
  48. Cephes Math Library Release 2.0: April, 1987
  49. Copyright 1984, 1995 by Stephen L. Moshier
  50. Direct inquiries to 30 Frost Street, Cambridge, MA 02140
  51. */
  52. #include <math.h>
  53. #ifdef ANSIPROT
  54. extern long double incbetl ( long double, long double, long double );
  55. #else
  56. long double incbetl();
  57. #endif
  58. long double btdtrl( a, b, x )
  59. long double a, b, x;
  60. {
  61. return( incbetl( a, b, x ) );
  62. }