Skip to main content

The Problem Pit: The Pit of Logarithmic Moments

 

The Pit of Logarithmic Moments: Wrestling With 0xnex(lnx)mdx\int_0^\infty x^n e^{-x} (\ln x)^m dx

There are integrals that lure you in with simplicity. They look like exercises, the kind of thing you’d solve in two lines on a quiet afternoon. But sometimes, behind the mask of a simple integrand lies a sprawling network of special functions, combinatorics, and asymptotics that refuses to let go once you fall in.

This is the story of how I got trapped in one such pit:

In,m=0xnex(lnx)mdx.I_{n,m} = \int_0^\infty x^n e^{-x} (\ln x)^m \, dx.

At first glance, I thought: ah, trivial, it’s just Gamma with a log. Within minutes, I realized I was not climbing out of this problem so easily.


Step 1: “It’s Just Gamma, Right?”

We all know the Gamma function:

Γ(s)=0xs1exdx.\Gamma(s) = \int_0^\infty x^{s-1} e^{-x} dx.

Differentiate under the integral sign:

ddsΓ(s)=0xs1exlnxdx.\frac{d}{ds} \Gamma(s) = \int_0^\infty x^{s-1} e^{-x} \ln x \, dx.

Differentiate mm times:

dmdsmΓ(s)=0xs1ex(lnx)mdx.\frac{d^m}{ds^m} \Gamma(s) = \int_0^\infty x^{s-1} e^{-x} (\ln x)^m \, dx.

So directly,

In,m=Γ(m)(n+1).I_{n,m} = \Gamma^{(m)}(n+1).

Solved? Not really. All I had done was restate the problem. What is Γ(m)(n+1)\Gamma^{(m)}(n+1)? That question opened the door to the pit.


Step 2: First Peek — m=1m=1 and m=2m=2

For m=1m=1:

In,1=Γ(n+1).I_{n,1} = \Gamma'(n+1).

Using the digamma function ψ(x)=Γ(x)Γ(x)\psi(x) = \frac{\Gamma'(x)}{\Gamma(x)}:

In,1=Γ(n+1)ψ(n+1).I_{n,1} = \Gamma(n+1)\psi(n+1).

Since Γ(n+1)=n!\Gamma(n+1) = n!:

In,1=n!ψ(n+1).I_{n,1} = n! \psi(n+1).

This already hides harmonic numbers. Recall:

ψ(n+1)=Hnγ,\psi(n+1) = H_n - \gamma,

where Hn=1+12++1nH_n = 1 + \tfrac12 + \cdots + \tfrac1n and γ\gamma is Euler–Mascheroni.

So:

In,1=n!(Hnγ).I_{n,1} = n!(H_n - \gamma).

That’s neat! But for m=2m=2:

In,2=Γ(n+1).I_{n,2} = \Gamma''(n+1).

Expanding:

In,2=n!(ψ(n+1)+ψ(n+1)2).I_{n,2} = n!\Big(\psi'(n+1) + \psi(n+1)^2\Big).

Here ψ(x)\psi'(x) is the trigamma function, and at integers:

ψ(n+1)=π26k=1n1k2.\psi'(n+1) = \frac{\pi^2}{6} - \sum_{k=1}^n \frac{1}{k^2}.

So:

In,2=n!((Hnγ)2+π26k=1n1k2).I_{n,2} = n!\Big((H_n - \gamma)^2 + \frac{\pi^2}{6} - \sum_{k=1}^n \frac{1}{k^2}\Big).

Now we see a pattern: zeta constants, harmonic numbers, factorials.

So what about m=3m=3?


Step 3: The Hydra Appears — m=3,4m=3,4

The third derivative:

In,3=n!(ψ(n+1)+3ψ(n+1)ψ(n+1)+ψ(n+1)3).I_{n,3} = n!\Big(\psi''(n+1) + 3\psi(n+1)\psi'(n+1) + \psi(n+1)^3\Big).

Here ψ\psi'' is the tetragamma function. At integers, it involves 2k=1n1k3-2\sum_{k=1}^n \frac{1}{k^3}. So:

In,3=n!((Hnγ)3+3(Hnγ)(π26k=1n1k2)2k=1n1k3).I_{n,3} = n!\Big((H_n - \gamma)^3 + 3(H_n - \gamma)\Big(\frac{\pi^2}{6} - \sum_{k=1}^n \frac{1}{k^2}\Big) - 2\sum_{k=1}^n \frac{1}{k^3}\Big).

Already messy.

For m=4m=4:

In,4=n!(ψ(3)(n+1)+4ψ(n+1)ψ(n+1)+3ψ(n+1)2+6ψ(n+1)2ψ(n+1)+ψ(n+1)4).I_{n,4} = n!\Big(\psi^{(3)}(n+1) + 4\psi(n+1)\psi''(n+1) + 3\psi'(n+1)^2 + 6\psi(n+1)^2\psi'(n+1) + \psi(n+1)^4\Big).

At integers:

  • ψ(3)(n+1)=6k=1n1k4π415.\psi^{(3)}(n+1) = 6\sum_{k=1}^n \frac{1}{k^4} - \frac{\pi^4}{15}.

So we get:

In,4=n!((Hnγ)4+6(Hnγ)2(π26k=1n1k2)+).I_{n,4} = n!\Big((H_n - \gamma)^4 + 6(H_n - \gamma)^2\Big(\frac{\pi^2}{6} - \sum_{k=1}^n \tfrac{1}{k^2}\Big) + \cdots \Big).

The formulas explode. Each new mm brings higher zeta values ζ(k)\zeta(k) and nested harmonic sums.

This is the Hydra: every derivative sprouts more heads.


Step 4: The Bell Polynomial Revelation

At this point, I realized: these aren’t random; they’re structured.

The derivatives of Γ\Gamma expand like Bell polynomials in the derivatives of lnΓ\ln \Gamma. More precisely:

In,m=n!Ym(ψ(n+1),ψ(n+1),,ψ(m1)(n+1)),I_{n,m} = n! \, Y_m\big(\psi(n+1), \psi'(n+1), \dots, \psi^{(m-1)}(n+1)\big),

where YmY_m is the complete exponential Bell polynomial.

For small mm:

  • Y1(x1)=x1Y_1(x_1) = x_1.

  • Y2(x1,x2)=x12+x2Y_2(x_1,x_2) = x_1^2 + x_2.

  • Y3(x1,x2,x3)=x13+3x1x2+x3Y_3(x_1,x_2,x_3) = x_1^3 + 3x_1x_2 + x_3.

  • Y4(x1,x2,x3,x4)=x14+6x12x2+4x1x3+3x22+x4Y_4(x_1,x_2,x_3,x_4) = x_1^4 + 6x_1^2x_2 + 4x_1x_3 + 3x_2^2 + x_4.

And indeed, that matches exactly what I computed!

So the combinatorial skeleton behind these integrals is Bell polynomials in polygamma values.


Step 5: Stirling Numbers in the Shadows

Then I recalled: Bell polynomials connect to Stirling numbers.

Expanding Γ(n+1+t)\Gamma(n+1+t):

Γ(n+1+t)=n!m=0Sm(n)tmm!,\Gamma(n+1+t) = n! \sum_{m=0}^\infty S_m(n) \frac{t^m}{m!},

where the coefficients Sm(n)S_m(n) are complicated sums involving Stirling numbers of the first kind.

Thus,

In,m=n!Sm(n),I_{n,m} = n! \cdot S_m(n),

where Sm(n)S_m(n) encodes the log-derivative structure combinatorially.

This was a revelation: the humble integral secretly encodes Stirling numbers.


Step 6: The Asymptotic Mirage (Again)

I came back to asymptotics.

For large nn:

  • ψ(n+1)lnn12n+112n2\psi(n+1) \sim \ln n - \tfrac{1}{2n} + \tfrac{1}{12n^2} - \cdots.

  • ψ(n+1)1n+12n216n3+\psi'(n+1) \sim \tfrac{1}{n} + \tfrac{1}{2n^2} - \tfrac{1}{6n^3} + \cdots.

So:

In,mn!(lnn)m+(m1)n!(lnn)m1(γ+12n)+(m2)n!(lnn)m2(ζ(2)1n)+I_{n,m} \sim n!(\ln n)^m + \binom{m}{1}n!(\ln n)^{m-1}\Big(-\gamma + \tfrac{1}{2n}\Big) + \binom{m}{2}n!(\ln n)^{m-2}\Big(\zeta(2) - \tfrac{1}{n}\Big) + \cdots

Every layer of correction brings in zeta constants and Bernoulli numbers.

It’s like peeling an infinite onion.


Step 7: Climbing Out (Barely)

So what did I learn in this pit?

  1. Exact Form:

    In,m=n!Ym(ψ(n+1),ψ(n+1),,ψ(m1)(n+1)).I_{n,m} = n! \, Y_m\big(\psi(n+1), \psi'(n+1), \dots, \psi^{(m-1)}(n+1)\big).
  2. Combinatorial Backbone: Bell polynomials and Stirling numbers orchestrate the chaos.

  3. Asymptotics:

    In,mn!(lnn)m(n),I_{n,m} \sim n!(\ln n)^m \quad (n\to\infty),

    with corrections from γ\gamma, ζ(2),ζ(3),\zeta(2), \zeta(3), \dots.

  4. Moral: What looked like a toy integral is a portal into special functions, combinatorics, and asymptotic analysis.

The pit was deep — and I barely crawled out.



Comments

Popular posts from this blog

Sharp Extremal Bounds for Angular Occupancy (Behind the Curtains)

you can find the full paper here First Attempts, and the Limits of Energy When I first began thinking about angular occupancy, I wasn’t looking for a brand-new problem. I was chasing a theme that has long fascinated me in discrete geometry: how do we measure the geometric richness of a finite set of points? This fascination is not unique to me. Erdős, way back in 1946, posed the distinct distances problem : given n points in the plane, how many distinct distances can they determine? That question alone gave birth to entire decades of work in combinatorial geometry. Later, Fishburn and Füredi asked about distinct angles , while Pach and Sharir studied repeated angles . Each time, the same underlying itch was being scratched: when you place points in the plane, what kinds of diversity can they generate? Why angles, why bins? It was natural to think of angles — after all, distances and directions had already been well studied. But if you go straight for “distinct angles,” you run in...

The Art of Goodbye

  The Art of Goodbye: How Relationships End and Why It Matters The friendship had been slowly dissolving for months. What used to be weekly coffee dates became monthly check-ins, then sporadic text messages, then silence. No fight precipitated the ending, no dramatic confrontation or betrayal. It simply... faded. One day you realized you hadn't spoken to someone who was once central to your life, and you weren't sure when the relationship had officially ended or even if it had. This ambiguous loss left you with a peculiar grief – mourning someone still alive, still accessible, but no longer present in your world. This experience is incredibly common yet rarely discussed. While we have cultural scripts for how relationships begin – meet-cutes, first dates, friendship origin stories – we have few models for how they end. We talk extensively about building connections but rarely about gracefully releasing them. This gap in our social understanding leaves many people unprepared ...

Getting Stuck: When Dijkstra Meets Negative Edges

  Getting Stuck: When Dijkstra Meets Negative Edges One of the joys (and pains) of computer science is when you take a tool you know, confidently apply it, and then watch everything break down in surprising ways. This happened to me recently when I decided to revisit shortest path algorithms — specifically, Dijkstra’s algorithm — only to get stuck in a swamp of negative edges. Setting the Scene The problem was classic: Given a directed, weighted graph and a source vertex, find the shortest path to all other vertices. This is the kind of problem that every CS student learns early, usually with Dijkstra’s algorithm. I already knew Dijkstra like an old friend: Keep a priority queue of distances. Always expand the node with the current smallest distance. Relax its edges. Simple, elegant, efficient ( O((V + E) log V) with a binary heap). So when I started coding a graph utility for my project — a tool to analyze transportation networks — I confidently plugged in D...