A rather interesting topic in math (what a general way to start a post) is the matter of recursive functions. These are functions that are expressed in terms of themselves. A fairly traditional example would be factorial. n! is defined to be
Now, a nicely concise way to write this, not to mention computationally convenient, is to define the following
So, the operation is defined, effectively, with respect to itself.
There are a couple of points of interest when it comes to recursive functions. One is expressing common operations and calculations in terms of recursion – it’s often more elegant and much more natural, like the above definition of recursion. Then, there are some functions that can -only- be expressed in terms of recursion. Which is of special interest, since one of the nice things to do with recursively defined functions is to determine a formula for what that function is – and quite often, you just can’t.
It’s all very interesting.
(more…)