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
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

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

Use of string variables: The Characters involve letters of the alphabet, punctuation marks, digits, white space, and control characters. The Control characters are characters

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

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

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

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

Structure Consisting of the Fields A MATLAB can also solve the sets of equations. In this illustration, the solutions for x, y, & z are returned as a structure consisting of th

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

Illustration of logical built-in functions: The function find returns the indices of a vector which meet certain criteria. For illustration, to find all the elements in a vect