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
fprintf function - File function: The fprintf function really returns the number of bytes which was written to the file, therefore if you do not want to see that number, suppr

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

Writing to Files: There are many lower level functions which can write to files. We will focus on the fprintf function that can be used to write a file and also to append to a

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

Error-Checking for Integers: As MATLAB uses the type double by default for all the values, to check to make confirm that the user has entered an integer, the program have to c

Built-in functions for Complex numbers:   We know that in MATLAB both i and j are built-in functions which return √-1 (therefore, they can be thought of as built-in constants).

Script a MATLAB program which meets the following speci cations: The program expects an input of a two-variable real-valued continuous function f : R^2--> R The program is to cal

Illustrations of Variable number of output arguments: In the illustrations shown here, the user should actually know the type of the argument in order to establish how many va

Illustration of Writing variables to a file: For illustration, in the below session in the Command Window, 3 variables are generated; these are then exhibited using who. Then,

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