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
Complex numbers: A complex number is commonly written in the form z = a + bi here a is known as the real part of the number z, b be the imaginary part of z, and i is √-1

Symbolic Expression The solve function solves an equation and returns the solution(s) as symbolic expressions. The answer can be converted to numbers by using any numeric funct

Example of Recursive functions: This definition is recursive as a factorial is defined in terms of the other factorial. There are two parts to any recursive definition: the co

Nested IF-ELSE statements: The if-else statement is used to select between the two statements. In order to select from more than two statements, the if-else statements can als

Illustration of Logical vectors: Calling the function appears to return similar vector as simply vec > 5, and summing the result still works to determine how many elements wer

Example of Symbolic Expression When there is more than one variable, the MATLAB selects which to solve for. In the illustration below, the equation ax 2 + bx = 0 is solved. Th

Plot types: Besides plot and bar, there are another plot types like stem plots, histograms, stem plots, area plots and pie charts, and also other functions which customize the

bar and barh functions: For a matrix, the bar and barh functions will group altogether the values in each and every row. The illustration is as shown: rm = randint(2,4,[1

Use of logical vector: Determine how many elements in the vector vec were greater than 5, the sum function can be used on the resulting vector isg: >> sum(isg) ans =

Give the formula for a rational function that has a hole at x=7 & vertical asmptote at x=-3/2