Skip to main content

plotting - Stirling Approximation in Mathematica


I want to plot to show how accurate is Stirling approximation in Mathematica by plotting the Percentage error against n. I want to take the value of n at the interval of 10 starting from 10 to 1000. So, I basically used the Listplot function to plot all these datas, which has been rather tedious. Is there any way simpler method to plot this approximation $\ln n!=n\ln n-n$



Answer




Although n is allowed to take non integer values, you probably intend it to take only integer values, so this is a job for DiscretePlot


DiscretePlot[Log[n!]/(n Log[n] - n), {n, 10, 1000, 10}, 
PlotRange -> All, Frame -> True]

Mathematica graphics


Comments