Helper Utilities


Given a sequence of moments, how do we recover the corresponding distribution?
​
For density in (0..1) this is known as the Hausdorff moment problem (wikipedia) and you can get other densities after rescaling.
For example central binomial coefficients rescaled by
-n
4
give us the ArcSin distribution.
In[]:=
dist=ArcSinDistribution[];​​Plot[PDF[dist,x],{x,-1/2,1+1/2},PlotLabel->"ArcSin density"]
Out[]=
Out[]//TableForm=
n=1
1
2
1
2
n=2
3
8
3
8
n=3
5
16
5
16
A number of famous sequence correspond to moments of some distribution: Catalan numbers, Motzkin Numbers, Riordan Numbers.
​
Density corresponding to moments
n
n
/n!
was recently shown to correspond to a certain limiting distribution, and it comes up in practice when multiplying many large projection matrices together (mathoverflow discussion with Carlo Beenakker)
Several methods exist for obtaining the density given a sequence of moments:
- Stieltjes-Perron inversion formula
- Inverse Laplace Transform
- Hilbert Transform
​
The connections between these can be seen in the following diagram
We have three distinct ways of looking at this problem, arranged in columns:
​
- Random Variable view: Moment Generating Function (MGF) and Stieltjes transform of random variable X
- Density view: Laplace transform and double Laplace Transform of the density of X
- Sequence view: exponential generating function (EGF) and ordinary generating function (OGF) of the sequence of moments
Entries on the same row are related by simple algebra which you can see in this table of quantities for Beta(1/2,1) distribution
Out[]//TableForm=
R.V.
Density
Sequence
Time Domain
π
Erf[
-t
]
2
-t
π
Erf[
t1
]
2
t1
π
Erf[
-t
]
2
-t
Frequency Domain
-
ArcTan
1
-z

-z
ArcTan
1
z1

z1
ArcTan[
-s
]
-s
We can chain the arrows together to form 4 general algebraic approaches. Consider Uniform(0,1) density with moments
1
1+n
. We can chain together OGF/EGF with inverse Laplace, double Inverse Laplace, and inverse Stieltjes. The latter can be performed using Stieltjes-Perron Inversion formula or using Hilbert Transform.

Inverse methods

Inverse Laplace

Consider the following sequence of moments
In[]:=
expr=
1
1+2n
;​​DiscretePlot[expr,{n,1,5},AxesLabel->{"n"},PlotLabel->pretty[expr],AxesOrigin->{0,0}]
Out[]=
Obtain the ordinary generating function of the moment sequence, putting us in row 3, column 3 of the table
In[]:=
col3row3=GeneratingFunction
1
2n+1
,n,s
Out[]=
ArcTanh[
s
]
s
Now move one column left using algebra
In[]:=
col2row3=
1
z1
col3row3/.s->
-1
z1
;​​col2row3=Assuming[{z1>1},Simplify@col2row3]
Out[]=
ArcTan
1
z1

z1
Move one row up by performing inverse Laplace Transform
In[]:=
InverseLaplaceTransform
ArcTan
1
z1

z1
,z1,t1
Out[]=
π
Erf[
t1
]
2
t1
Another Inverse Laplace Transform recovers Beta(1/2,1) density
In[]:=
Assuming{t1>0,0<x<1},​​InverseLaplaceTransform
π
Erf[
t1
]
2
t1
,t1,x//Simplify
Out[]=
1
2
x
Alternatively, we could’ve computed exponential generating function, in which case only a single inverse Laplace Transform would be required

Stieltjes-Perron Inversion Formula

We can extract the density from the height of branch cut along the support, as you can see in the Stieltjes transform of the UniformDistribution[0,1]
Perform a re-arrangement to get the Stieltjes transform
Now wrap this into a function and apply inverse formula of Stieltjes-Perron (wikipedia)
You can overlap with Beta(1/2,1) density to ensure it’s the same distribution

Hilbert Transform

Sokhotski–Plemelj theorem links inverse Stieltjes Transform with Hilbert Transform.
Consider Stieltjes transform of the Beta(1/2,1) distribution
Integrate this expression numerically

References

- Theorem 2.2 in “Computing Inverses of Stieltjes Transforms of Probability Measures” Chen/Olver https://arxiv.org/abs/2410.16178
- Inverse Stieltjes Transform discussion (community, mathematica.SE answer)​
- Scratch (notebook and notability)

CITE THIS NOTEBOOK

Hausdorff moment problem: recovering density from moments in Wolfram​
by Yaroslav Bulatov​
Wolfram Community, STAFF PICKS, June 6, 2025
​https://community.wolfram.com/groups/-/m/t/3475415