Mercurial > hg > octave-nkf
annotate scripts/specfun/betaln.m @ 10358:72fab01e5d68
improve some size_t queries
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 25 Feb 2010 12:55:13 +0100 |
parents | f0c3d3fc4903 |
children | a8ce6bdecce5 |
rev | line source |
---|---|
8920 | 1 ## Copyright (C) 1998, 2006, 2007, 2008, 2009 by Nicol N. Schraudolph |
5820 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7016 | 7 ## the Free Software Foundation; either version 3 of the License, or (at |
8 ## your option) any later version. | |
5820 | 9 ## |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
7016 | 16 ## along with Octave; see the file COPYING. If not, see |
17 ## <http://www.gnu.org/licenses/>. | |
5820 | 18 |
19 ## -*- texinfo -*- | |
20 ## @deftypefn {Mapping Function} {} betaln (@var{a}, @var{b}) | |
21 ## Return the log of the Beta function, | |
22 ## @tex | |
23 ## $$ | |
24 ## B (a, b) = \log {\Gamma (a) \Gamma (b) \over \Gamma (a + b)}. | |
25 ## $$ | |
26 ## @end tex | |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8286
diff
changeset
|
27 ## @ifnottex |
5820 | 28 ## |
29 ## @example | |
30 ## betaln (a, b) = gammaln (a) + gammaln (b) - gammaln (a + b) | |
31 ## @end example | |
8517
81d6ab3ac93c
Allow documentation tobe built for other formats than tex and info
sh@sh-laptop
parents:
8286
diff
changeset
|
32 ## @end ifnottex |
8286
6f2d95255911
fix @seealso references to point to existing anchors
Thorsten Meyer <thorsten.meyier@gmx.de>
parents:
7017
diff
changeset
|
33 ## @seealso{beta, betainc, gammaln} |
5820 | 34 ## @end deftypefn |
35 | |
36 ## Author: Nicol N. Schraudolph <nic@idsia.ch> | |
37 ## Created: 06 Aug 1998 | |
38 ## Keywords: log beta special function | |
39 | |
40 function retval = betaln (a, b) | |
41 if (nargin != 2) | |
6046 | 42 print_usage (); |
5820 | 43 endif |
44 | |
45 retval = gammaln (a) + gammaln (b) - gammaln (a + b); | |
46 endfunction | |
47 | |
48 %!assert (betaln(3,4),log(beta(3,4)),eps) | |
49 | |
50 %!error (betaln(1.)) | |
51 %!error (betaln(1.,1.,1.)) |