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
Histogram: The histogram is a particular type of bar chart which shows the frequency of occurrence of the values within a vector. The Histograms use what are known as bins to

Dimensions - matrix: The size and length functions in the MATLAB are used to find array dimensions. Length function returns the number of elements in the vector. The size func

Illustration of Writing to files: Here is the other illustration in which a matrix is written to a file. At First, an arbitrary 2 × 4 matrix is generated, and then it is writt

Types of User-defined Functions: We know how to write a user-defined function, stored in an M-file, which computes and returns one value. This is merely one type of the functi

Illustration of Variance For illustration, for the vector [4, 6, 1, 5], there are n = 4 values therefore n - 1 is 3. The mean of this data set is also 4. The variance will be

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

User input in the while loop: Here is an illustration of running this script: >> readonenum Enter a positive number: -5 Invalid! Enter a positive number: -2.2

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

Matrix of Plots: The other function which is very useful with any type of plot is subplot that creates a matrix of plots in the present Figure Window. The three arguments are

Built in recursive function in MATLAB: We have seen that the built-in function in MATLAB to compute factorials, termed as the factorial and we know how to implement the iterat