**Problem:**

It is easy to find the factorial of a positive integer by using the factorial command in MATLAB? But how would one find the value of an integer n in MATLAB such as n!>m, where m is a real number. Such inequalities need to be found in problems such as finding how many terms of the Taylor series are needed to assure that the true error is less than a certain number. To see an example of such a need, see Example 6 of this document: http://bit.ly/12Fktwm

**Solution**

clc

clear all

m=32034567.89

n=0

while (factorial(n)<=m)

n=n+1

end

n

This post is brought to you by

- Holistic Numerical Methods: Numerical Methods for the STEM undergraduate at http://nm.MathForCollege.com,
- the textbook on Numerical Methods with Applications available from the lulu storefront,
- the textbook on Introduction to Programming Concepts Using MATLAB, and
- the Massive Open Online Course (MOOC) available at http://udemy.com/numericalmethodsguy

Advertisements