# Grouping expressions by their $O(..)$ rate of growth around 0

Given a list of expressions like $$3 x^2,\frac{\sqrt{x}}{\sqrt{2}},\frac{2 \sqrt{x}}{\pi },\frac{9 x^3}{2},x,$$, how could I group them based on their rates of growth around 0?

IE, $$2x$$ and $$3x$$ are both $$O(x)$$, while $$x^2$$ is $$O(x^2)$$.

Code below generates 25 expressions I'm trying to group in this way:

pairs = {
{"Kumaraswamy", KumaraswamyDistribution[2, 3]},
{"Weihbul", WeibullDistribution[1/2, 2]},
{"ArcSin", ArcSinDistribution[]},
{"Bates", BatesDistribution[3]},
{"Uniform", UniformDistribution[]},
{"Pareto", ParetoDistribution[1, 2]},
{"Logistic", LogisticDistribution[]},
{"Extreme Value", ExtremeValueDistribution[]},
{"Frechet", FrechetDistribution[2, 1, 0]},
{"Erlang", ErlangDistribution[3, 2]},
{"Gumbel", GumbelDistribution[0, 1]},
{"Marchenko-Pastur", MarchenkoPasturDistribution[1]},
{"Semicircle", WignerSemicircleDistribution[1]},
{"LogNormal", LogNormalDistribution[0, 1]},
{"Cauchy", CauchyDistribution[]},
{"Pareto", ParetoDistribution[1, 2]},
{"Normal", NormalDistribution[]},
{"Student-T", StudentTDistribution[1]},
{"ChiSquared", ChiSquareDistribution[1]},
{"Chi", ChiDistribution[1]},
{"Exponential", ExponentialDistribution[1]},
{"Inverse Normal", InverseGaussianDistribution[2, 1]}
};
trunc[dist_] := TruncatedDistribution[{0, \[Infinity]}, dist];

getGrowth[dist_] :=
Assuming[0 < x < 1/1000, Asymptotic[Refine@CDF[dist, x], x -> 0]];
getGrowth[trunc@Last@#] & /@ pairs


Notebook

Motivation: getting a sense of asymptotics of Laplace transform for various random variables, which can be inferred from behavior of their CDF around 0

• "Rate of growth" generally means the value of the first derivative. I think you mean "order of growth"? Commented Jul 13, 2023 at 18:46

You can use Group and AsymptoticEqual.

exprs = getGrowth[trunc@Last@#] & /@ pairs;
Gather[exprs, AsymptoticEqual[#1, #2, x -> 0, Direction -> "FromAbove"] &]
(* {
{3 x^2, x^2/18, E^(-((-2 + x)^2/(8 x))) Sqrt[2/π] Sqrt[x] - x^2/16 - (E x^2)/16},
{Sqrt[x]/Sqrt[2], (2 Sqrt[x])/π, Sqrt[x], (2 Sqrt[x])/π, Sqrt[2/π] Sqrt[x]},
{(9 x^3)/2, (4 x^3)/3},
{x, x/2, x/(-1 + E), x, (4 x)/π, (2 x)/π, Sqrt[2/π] x, (2 x)/π, Sqrt[2/π] x, x},
{0, 0},
{E^(-(1/x^2))},
{(3 E^(-3/x))/x},
{-(E^(-(1/2) Log[x]^2)/(Sqrt[2 π] Log[x]))}
} *)

• A deficiency: groups ...,{x, x/2, x/(-1 + E), x, (4 x)/π, (2 x)/π, Sqrt[2/π] x, (2 x)/π, Sqrt[2/π] x, x}, {0, 0}, {E^(-(1/x^2))},... are not ordered by the growth at the origin. Commented Jul 13, 2023 at 17:40
• @user64494, first, the language to be used on StackExchange is English, so please refrain from (unnecessary) comments in other languages. Second, the OP says nothing about the ordering, just grouping the expressions. Commented Jul 13, 2023 at 17:52
• (i) There were Chinese signs at this forum without any remarks. (ii) There are Internet translators. Commented Jul 13, 2023 at 17:56
• Commented Jul 14, 2023 at 4:26
• @Choster. Thank you for the link. I clearly understand that English is Latin of nowadays. I don't know such an expression as " Если бы губы Никанора Ивановича да приставить к носу Ивана Кузьмича..." in English. Commented Jul 14, 2023 at 9:05

{3 x^2, Sqrt[x]/Sqrt[2], (2 Sqrt[x])/π, (9 x^3)/2, x, 0, x/2, x/(-1 + E),
E^(-(1/x^2)), (4 x^3)/3, x^2/18, (3 E^(-3/x))/x, x, Sqrt[x], (2 Sqrt[x])/π,
(4 x)/π, -(E^(-(1/2) Log[x]^2)/(Sqrt[2 π] Log[x])), ( 2 x)/π, 0,
Sqrt[2/π] x, (2 x)/π, Sqrt[2/π] Sqrt[x], Sqrt[2/π] x, x,
E^(-((-2 + x)^2/(8 x))) Sqrt[2/π] Sqrt[x] - x^2/16 - (E x^2)/16}


{3 x^2, Sqrt[x]/Sqrt[2], (2 Sqrt[x])/π, (9 x^3)/2, x, 0, x/2, x/(-1 + E), E^(-(1/x^2)), (4 x^3)/3, x^2/18, (3 E^(-3/x))/x, x, Sqrt[x], (2 Sqrt[x])/π, (4 x)/π, -(E^(-(1/2) Log[x]^2)/(Sqrt[2 π] Log[x])), ( 2 x)/π, 0, Sqrt[2/π] x, (2 x)/π, Sqrt[2/π] Sqrt[x], Sqrt[2/π] x, x, E^(-((-2 + x)^2/(8 x))) Sqrt[2/π] Sqrt[x] - x^2/16 - (E x^2)/16}

Now

Sort[%, AsymptoticLess[#1, #2, x -> 0,Direction->"FromAbove"] &]


{0, 0, E^(-(1/x^2)), ( 3 E^(-3/x))/x, -(E^(-(1/2) Log[x]^2)/(Sqrt[2 \[Pi]] Log[x])), ( 4 x^3)/3, (9 x^3)/2, E^(-((-2 + x)^2/(8 x))) Sqrt[2/\[Pi]] Sqrt[x] - x^2/16 - (E x^2)/ 16, x^2/18, 3 x^2, x, Sqrt[2/\[Pi]] x, (2 x)/\[Pi], Sqrt[2/\[Pi]] x, (2 x)/\[Pi], (4 x)/\[Pi], x, x/(-1 + E), x/2, x, Sqrt[2/\[Pi]] Sqrt[x], (2 Sqrt[x])/\[Pi], Sqrt[x], ( 2 Sqrt[x])/\[Pi], Sqrt[x]/Sqrt[2]}

does the job.

Edit. Direction->"FromAbove" is added to produce the more accurate result. Thanks to @Domen.

• Now applying Gather[%, AsymptoticEqual[#1, #2, x -> 0, Direction -> "FromAbove"] &] , one obtains {{0, 0}, {E^(-(1/x^2))}, {-(E^(-(1/2) Log[x]^2)/( Sqrt[2 \[Pi]] Log[x]))}, {E^(-((-2 + x)^2/(8 x))) Sqrt[2/\[Pi]] Sqrt[x] - x^2/16 - (E x^2)/16, x^2/18, 3 x^2}, {x, Sqrt[2/\[Pi]] x, (2 x)/\[Pi], Sqrt[2/\[Pi]] x, (2 x)/\[Pi], ( 4 x)/\[Pi], x, x/(-1 + E), x/2, x}, {Sqrt[2/\[Pi]] Sqrt[x], ( 2 Sqrt[x])/\[Pi], Sqrt[x], (2 Sqrt[x])/\[Pi], Sqrt[x]/Sqrt[2]}, {( 3 E^(-3/x))/x}, {(4 x^3)/3, (9 x^3)/2}}. which is not correct. Commented Jul 13, 2023 at 17:53