2
$\begingroup$

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]},
   {"Gamma", GammaDistribution[2, 3]},
   {"InverseGamma", InverseGammaDistribution[2, 3]},
   {"Gumbel", GumbelDistribution[0, 1]},
   {"Beta", BetaDistribution[1/2, 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

$\endgroup$
1
  • $\begingroup$ "Rate of growth" generally means the value of the first derivative. I think you mean "order of growth"? $\endgroup$
    – Michael E2
    Commented Jul 13, 2023 at 18:46

2 Answers 2

4
$\begingroup$

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]))}
} *)
$\endgroup$
5
  • $\begingroup$ 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. $\endgroup$
    – user64494
    Commented Jul 13, 2023 at 17:40
  • 3
    $\begingroup$ @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. $\endgroup$
    – Domen
    Commented Jul 13, 2023 at 17:52
  • $\begingroup$ (i) There were Chinese signs at this forum without any remarks. (ii) There are Internet translators. $\endgroup$
    – user64494
    Commented Jul 13, 2023 at 17:56
  • $\begingroup$ @user64494 Do posts have to be in English on Stack Exchange? $\endgroup$
    – Ghoster
    Commented Jul 14, 2023 at 4:26
  • $\begingroup$ @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. $\endgroup$
    – user64494
    Commented Jul 14, 2023 at 9:05
1
$\begingroup$

Your code produces a list

{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.

$\endgroup$
1
  • $\begingroup$ 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. $\endgroup$
    – user64494
    Commented Jul 13, 2023 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.