Skip to main content

Posts

Showing posts with the label gosper

Factorial of a number using Stirling's(Gosper) Approximation using Matlab

Problem Find the factorial of a number using Modified Stirling's formula(Gospers). Also print the difference upto 5 decimals between the result from the factorial function in Matlab and the result you get from approximations.The relation to find the factorial of a number using the Stirling's formula is given by: Gospers formula(Modified Stirling formula) To know more about Stirling's formula or Gospers formula then go to: Stirling's Approximation - Math.Wolfram Solution We will solve this problem using Matlab functions . This is similar to our previous post Velocity of a moving fluid using Matlab . But the little difference between the previous post and this post is that we are required to print the difference upto five decimals of the difference between the factorial function in matlab and the above formula. It should be remembered that we are asked indirectly to print the modulus of the difference. To know about modulus of a number then please do check...