home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / SPECFUN.DI$ / BETA.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  571 b   |  22 lines

  1. function y = beta(z,w,v)
  2. %BETA    Beta function.
  3. %    y = beta(z,w).
  4. %    y = integral from 0 to 1 of t.^(z-1) .* (1-t).^(w-1) dt.
  5. %    z and w must be compatible for addition.
  6. %    Incomplete beta function.
  7. %       y = beta(x,a,b).
  8. %       The elements of x must be in the interval [0,1].
  9. %       a and b must be scalars.
  10. %
  11. %    See also BETAINC, BETALN.
  12.  
  13. %    C. Moler, 2-1-91.
  14. %    Ref: Abramowitz & Stegun, sec. 6.2.
  15. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  16.  
  17. if nargin == 2
  18.     y = exp(gammaln(z)+gammaln(w)-gammaln(z+w));
  19. elseif nargin == 3
  20.     y = betainc(z,w,v);
  21. end
  22.