Recursive functions, MATLAB in Mathematics

Recursive Functions:

The Recursion occurs whenever something is defined in terms of itself. In the programming, a recursive function is a function which calls itself. The Recursion is very commonly used in the programming, however many simple illustrations are really not very efficient and can be substituted by the iterative techniques (loops, or vectorized code in MATLAB). Nontrivial illustrations go beyond the scope; therefore the concept of recursion is easily introduced here.

The illustration used will be of a factorial. Generally, the factorial of an integer n is defined iteratively:

n! = 1 * 2 * 3 *  ...  * n

For illustration, 4! = 1 * 2 * 3 * 4, or 24.

The other, recursive, definition is:

n! = n * (n - 1)!  general case

1! = 1  base case

 

Posted Date: 10/22/2012 1:28:20 AM | Location : United States







Related Discussions:- Recursive functions, Assignment Help, Ask Question on Recursive functions, Get Answer, Expert's Help, Recursive functions Discussions

Write discussion on Recursive functions
Your posts are moderated
Related Questions
If I have a vector representing the packed storage form of a symmetric matrix, how do I perform a cholesky factorisation on that?

Differentiation: The derivative of a function y = f(x) can be written as follows or f  '(x) and is defined as the rate of change of the dependent variable y with respe

Standard Deviation The standard deviation is the square root of variance: The built-in function in a MATLAB for the standard deviation is known as std; the standard dev

Creating string Variables: The string consists of a few numbers of characters (including, possibly, none). These are the illustrations of the strings: '' 'x' 'ca

Strings as matrix: The matrix can be generated, that consists of strings in each row. Therefore, essentially it is created as a column vector of strings, but the final result

Illustration of Minimum and Maximum Value Both of these functions also return the index of the minimum or maximum value; when there is more than one occurrence, it returns the

Illustration of Empty vectors: The Empty vectors can also be used to delete elements from the arrays. For illustration, to remove the third element from array, an empty vector

Example of Minimum and Maximum Value For matrices, the functions min and max operate column wise by the default: >> mat = randint(2,4,[1 20]) mat =    9   10   1

Find Minimum and Maximum for each row To find the maximum (or minimum) for each row, the dimension of 2 (that is how a MATLAB refers to rows) can be identified as the third arg

Referring to and Modifying the Matrix Elements: To refer to matrix elements, the row and then the column indices are given in parentheses (always the row index initially and t