Tuesday, 4 March 2014

Recursion

Initially I thought the use of recursion would only be useful for certain things, but not necessarily have a big impact on anything else.   But the more I sit through this class and others it has became apparent of how important it really is.  Most recently I was sitting in an actuarial science class, and the occurrence of recursion came up.  When determining a value for a function it was dependent on the value of the function 1 prior to it.    So to find out the value of a function at n +1 you need to know the value at n, which means you need to know the at n-1, and this depends on n-2, and so on until you get to 1.   For recursion to work there would always have to a base value for the beginning of the function.

Another function that was recently brought up in Calculus was the Fibonacci sequence.   This sequence depends on the knowing the 2 values prior to it.   Therefore you would need to start with 2 base cases.   Really any sequence of numbers that is related to a function prior to itself will use recursion to determine the current value.

There are many other things that will make use of recursion.   In our first assignment we needed to use it to determine the minimum value of i for a function.   We also needed to use recursion to move cheeses from stool to stool.


So to conclude, I initially felt like recursion would be useful for a small portion of problems.   However the more I learned about the more useful it becomes, and can be used in many real world problems for solving different programs and functions.

No comments:

Post a Comment