Mercurial > hg > octave-nkf
changeset 12659:8673b08a52bf stable
betaln.m: Improve documentation string, particularly for Tex format.
* betaln.m: Improve DOCSTRING. Space out function with newlines.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Tue, 10 May 2011 14:14:12 -0700 |
parents | 08f8fc1e9872 |
children | eae41900ca01 |
files | scripts/specfun/betaln.m |
diffstat | 1 files changed, 10 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/specfun/betaln.m +++ b/scripts/specfun/betaln.m @@ -21,16 +21,17 @@ ## Return the natural logarithm of the Beta function, ## @tex ## $$ -## B (a, b) = \log {\Gamma (a) \Gamma (b) \over \Gamma (a + b)}. +## {\rm betaln} (a, b) = \ln (B (a,b)) \equiv \ln ({\Gamma (a) \Gamma (b) \over \Gamma (a + b)}). ## $$ ## @end tex ## @ifnottex ## ## @example -## betaln (a, b) = gammaln (a) + gammaln (b) - gammaln (a + b) +## betaln (a, b) = log (beta (a, b)) ## @end example ## ## @end ifnottex +## calculated in a way to reduce the occurrence of underflow. ## @seealso{beta, betainc, gammaln} ## @end deftypefn @@ -39,14 +40,18 @@ ## Keywords: log beta special function function retval = betaln (a, b) + if (nargin != 2) print_usage (); endif retval = gammaln (a) + gammaln (b) - gammaln (a + b); + endfunction -%!assert (betaln(3,4),log(beta(3,4)),eps) + +%!assert (betaln (3,4), log (beta(3,4)),eps); -%!error (betaln(1.)) -%!error (betaln(1.,1.,1.)) +%% Test input validation +%!error (betaln (1)) +%!error (betaln (1,2,3))