John Ramey

Don't think…compute.

I must have had this epiphany several times in the last few years, but I had it again this evening while being introduced to the dark side.  Many students are taught that

n! = n \times (n-1) \times \ldots 2 \times 1

and that 0! is defined as 1.  But is there some higher level mathematics in which this factorial idea is just a corollary as with most pre-graduate school mathematics.  Well, there is!  This is the epic Gamma function.  It is defined as

\Gamma( \alpha ) = \int_0^{\infty} y^{\alpha - 1} e^{-y} dy.

If \alpha is a positive integer, then \Gamma( \alpha ) = (\alpha - 1)!.

Here is the main event.  Suppose \alpha = 1; because \alpha is a positive integer, \Gamma( \alpha ) = 0!  But then, notice that

\Gamma( 1 ) = \int_0^{\infty} y^{ 1 - 1 } e^{-y} dy = \int_0^{\infty} e^{-y} dy = 1.

Hence, our conclusion is that 0! = 1.

Posted in Math, Statistics | No Comments »

Anthony turned me onto this new project called Project Euler.  On the site, there are currently 202 computational math problems ranging from easy to extremely difficult.  Several of the problems can be brute-forced in order to find a solution, but there are some that are just not possible to solve in this manner in this lifetime, and thus, clever methods are needed to solve the more difficult problems.  As you may guess, I am becoming obsessed with this site; last night, I stayed up until 6:30am working on as many as I could.  So far, I have solved 14 of them.

I was not too savvy with Python until now that I am restricting myself to using one and only one programming language for these problems; I have learned much about the language, and I’m quite impressed.  It is always great to have mundane aspects of coding shot into oblivion because they really just are not needed anymore: well, maybe some will continue to believe C is necessary for all.

In the next couple of days, I am going to start uploading my code for these solutions; if anyone cares, maybe it will be a learning experience for us all.  For the most part, I have the math know-how to solve these problems within the recommended minute, but I ask that any and all advice be given to improve my Python skills.

Posted in Code, Python | 1 Comment »