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
Functions to create special matrices: The MATLAB also has various functions which create special matrices. For illustration, the zeros function generates a matrix of all zeros

Applications of Customized Strings: Labels, Prompts, Arguments to Functions: The one of very useful application of this is to involve numbers in strings that are used to plot

Pie chart - plot functions: The MATLAB also has a function pie which will generate a pie chart. Calling the function with the form pie (vec) draws a pie chart, by using the pe

Illustration of Spreadsheet Files: This reads the numbers in a double vector variable nums and the text in a cell array txt (the xlsread function forever returns the numbers f

Indexed empty matrix: The Individual elements cannot be eliminated from matrices, as matrices always have the similar number of elements in every row. >> mat = [7 9 8; 4 6

Three-Dimensional Plots: The MATLAB has many functions which will display three-dimensional plots. Most of these functions have similar name as corresponding two-dimensional p

Plot Functions: Faraway, we have plotted to generate two-dimensional plots and bar to generate bar charts. We have seen how to clear the Figure Window by using clf, and how to

Customizing Plots : There are numerous ways to customize figures in the Figure Window. On clicking the Plot Tools icon will bring up the Property Editor & Plot Browser, with ma

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

Empty Vectors: An empty vector or in another words, a vector which stores no values, can be generated using the empty square brackets: >> evec = [] evec = [] >> lengt