Weighted sum of Dirac Measures

using MultivariateSeries

Series with 3 variables

x = @ring x1 x2 x3
n = length(x)
r = 4;

Random weights in $[0,1]$

w0 = rand(Float64,r)
4-element Vector{Float64}:
 0.46545963898811915
 0.021978038390889187
 0.04877312766629227
 0.1370341036362387

Random points in $[0,1]^n$

Xi0 = rand(Float64,n,r)
3×4 Matrix{Float64}:
 0.37808   0.231761  0.794831  0.0190203
 0.621472  0.149643  0.162051  0.623349
 0.85187   0.715274  0.039446  0.961319

Moment function of the sum of the Dirac measures of the points $\Xi_0$ with weights $\omega_0$ and its generating series up to degree 3.

mt = moment(w0, Xi0)
s = series(mt, monomials(x, 0:3))
0.6732449086815393 + 0.22244747548801583dx1 + 0.3858826556686884dx2 + 0.5458888158350238dx3 + 0.09857770553712933dx1^2 + 0.11803628307639027dx1*dx2 + 0.15759110449457098dx1*dx3 + 0.23479256902151965dx2^2 + 0.3312005626490396dx2*dx3 + 0.4757340405356967dx3^2 + 0.049920949492184286dx1^3 + 0.04655035411064641dx1^2dx2 + 0.05878658405010533dx1^2dx3 + 0.07011345415830575dx1*dx2^2 + 0.09552151593531152dx1*dx2*dx3 + 0.13278137141780286dx1*dx3^2 + 0.14519624175782025dx2^3 + 0.2047327416078236dx2^2dx3 + 0.29055270964631225dx2*dx3^2 + 0.41752635290304874dx3^3

Decomposition of the series from its terms up to degree 3.

w, Xi = decompose(s);
w
4-element Vector{Float64}:
 0.1370341036362443
 0.4654596389880742
 0.021978038390932233
 0.04877312766629078
Xi
3×4 Matrix{Float64}:
 0.0190203  0.37808   0.231761  0.794831
 0.623349   0.621472  0.149643  0.162051
 0.961319   0.85187   0.715274  0.039446