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

### Like this:

Like Loading...

## Author: Autar Kaw

Autar Kaw (http://autarkaw.com) is a Professor of Mechanical Engineering at the University of South Florida. He has been at USF since 1987, the same year in which he received his Ph. D. in Engineering Mechanics from Clemson University. He is a recipient of the 2012 U.S. Professor of the Year Award. With major funding from NSF, he is the principal and managing contributor in developing the multiple award-winning online open courseware for an undergraduate course in Numerical Methods. The OpenCourseWare (nm.MathForCollege.com) annually receives 1,000,000+ page views, 1,000,000+ views of the YouTube audiovisual lectures, and 150,000+ page views at the NumericalMethodsGuy blog. His current research interests include engineering education research methods, adaptive learning, open courseware, massive open online courses, flipped classrooms, and learning strategies. He has written four textbooks and 80 refereed technical papers, and his opinion editorials have appeared in the St. Petersburg Times and Tampa Tribune.
View all posts by Autar Kaw

Reblogged this on Mustafa Alper YILDIZ's Blog and commented:

Very useful application of MATLAB for finding number of terms in Taylor series needed for true error determination less than a certain number.

LikeLike