Program of built-in factorial function, MATLAB in Mathematics

Program of built-in factorial function:

Calling this function yields similar result as the built-in factorial function:

>> fact(5)

ans =

  120

>> factorial(5)

ans =

  120

The recursive factorial function is a very common illustration of a recursive function. It is somewhat of a lame illustration, though, as recursion is not essential to find a factorial; a for loop can be just used as well in the programming (or, obviously, the built-in function in MATLAB).

 

Posted Date: 10/22/2012 1:32:35 AM | Location : United States







Related Discussions:- Program of built-in factorial function, Assignment Help, Ask Question on Program of built-in factorial function, Get Answer, Expert's Help, Program of built-in factorial function Discussions

Write discussion on Program of built-in factorial function
Your posts are moderated
Related Questions
sprintf function: The sprintf function works precisely like the fprintf function, but rather than printing it generates a string. Here are some illustrations in which the outp

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

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

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

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

Illustration of a recursive function: illustration is of a recursive function which does not return anything, but simply prints. The below function prtwords receives a sentenc

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


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

Writing and Reading Spreadsheet Files: The MATLAB functions xlswrite & xlsread will write to and read from the spreadsheet files which have the extension .xls. For illustratio