Re: factorial of negative numbers

Поиск
Список
Период
Сортировка
От Dean Rasheed
Тема Re: factorial of negative numbers
Дата
Msg-id CAEZATCWcab1wZ72sAbohFebctwnmt0wBAi5OkAs7hUQWBW3sYA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: factorial of negative numbers  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
On Tue, 16 Jun 2020 at 09:55, Bruce Momjian <bruce@momjian.us> wrote:
>
> On Tue, Jun 16, 2020 at 08:31:21AM +0100, Dean Rasheed wrote:
> >
> > Most common implementations do regard factorial as undefined for
> > anything other than positive integers, as well as following the
> > convention that factorial(0) = 1. Some implementations extend the
> > factorial to non-integer inputs, negative inputs, or even complex
> > inputs by defining it in terms of the gamma function. However, even
> > then, it is undefined for negative integer inputs.
>
> Wow, they define it for negative inputs, but not negative integer
> inputs?  I am curious what the logic is behind that.
>

That's just the way the maths works out. The gamma function is
well-defined for all real and complex numbers except for zero and
negative integers, where it has poles (singularities/infinities).
Actually the gamma function isn't the only possible extension of the
factorial function, but it's the one nearly everyone uses, if they
bother at all (most people don't).

Curiously, the most widespread implementation is probably the
calculator in MS Windows.

Regards,
Dean



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: pg_upgrade fails if vacuum_defer_cleanup_age > 0
Следующее
От: Dean Rasheed
Дата:
Сообщение: Re: factorial of negative numbers