Question: Define an anonymous function approx _ factorial which will calculate an approximate value of n ! using the first three terms of the Stirling series:

Define an anonymous function approx_factorial which will calculate an approximate
value of n! using the first three terms of the Stirling series:
n !2 n( n
e )n
(1+1
12 n +1
288 n2)
The function should be able to take vector input, e.g.
>> approx_factorial(1:6)
ans =
1.00222.00066.000624.001120720.01
Calculate the relative error of the approximations for n =1,2,3,...,8

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!