Asymptotic comparison of functions
I want to compare following functions asymptotically and then开发者_如何学Python arrange them in the ascending order. Also requested is a proper explanation lg((√n)!), lg(SquareRoot(n!)), SquareRootlg(n!), (lg(√n))!, (SquareRoot(lg n))!, SquareRoot(lg n)!
If you wonder about "general solution" and you follow a lot into asymptotic functions comparisons. Here is what I recommend :
Use limit definition of BigO notation, once you know:
f(n) = O(g(n)) iff limit (n approaches +inf) f(n)/g(n) exists and is not +inf
You can use Computer Algebra System, for example opensource Maxima, here is in Maxima documentation about limits .
So, checking lg(n)*lg(n) = O(sqrt(n))
can be dane is checking limit of (lg(n)lg(n))/sqrt(n)
:
(%i1) limit( (log(n)^2) / (sqrt(n)), n, inf);
(%o1) 0
If you like, longer, more descriptive notation :
(%i1) f(n) := log(n)^2 ;
2
(%o1) f(n) := log (n)
(%i2) g(n) := sqrt(n) ;
(%o2) g(n) := sqrt(n)
(%i3) limit(f(n)/g(n), n, inf);
(%o3) 0
精彩评论