Foxmaths! 2.0

January 6, 2008

Recursion Grab Bag

Filed under: Maths, grab bag — Tags: , , , — Fox @ 10:01 pm

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

n! = 1*2*3*...*(n-1)*n

Now, a nicely concise way to write this, not to mention computationally convenient, is to define the following

0! = 1

n! = n*(n-1)!

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…)

Blog at WordPress.com.