help-octave
[Top][All Lists]

## Re: Request for combinatorial functions

 From: Jordi Gutierrez Hermoso Subject: Re: Request for combinatorial functions Date: Mon, 16 Apr 2007 20:00:48 -0500

```On 16/04/07, Phillip M. Feldman <address@hidden> wrote:
```
```Combinatorics seems to be an area where Octave is weak.
```
```
I'd say that's intentional. Combinatorics requires some very specific
functions and generally symbolic calculations, something Octave by
design does not do very well. GAP has sufficient functionality for
combinatorics, IMAO, and group theory will almost surely pop up in
combinatorics, so I think that's a much better platform for this kind
of work.

```
```I would really like to be able to do the following: 1) Compute
factorials using the exclamation point notation, e.g., get 24 as the
result if I enter "4!". 2) Compute n-choose-m using the choose(n,m)
notation. These functions really should be part of the Octave base.
```
```
There seems to be few naturally-occurring situations in numerical
mathematics where these functions seem relevant, especially since they
grow so quickly. Are you going to be dividing factorials or
subtracting factorials of very similar sizes only with the precision
afforded by Octave doubles? Do you need it for Taylor expansions? We
already have a gamma function in Octave that works for these functions
(you'll need the gamma and beta functions anyways, since roundoff
errors might give you non-integer arguments to factorial and beta
functions). I think that if your numerical code is involving
factorials, it probably needs a rewrite; if you really need these
functions for combinatorial work, you should be using something else.

I also see that the current factorial function in the 'Forge isn't
simply an alias for the gamma function, which it really should
be. This should be fixed. Looks like the factorial function was
written a long time ago, perhaps before the gamma function was
available.

IMAO,
- Jordi G. H.

```