Weighted sum of Dirac Measures

# Weighted sum of Dirac Measures

``using PolyExp``

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 Array{Float64,1}:
0.638924
0.736486
0.950273
0.986364``````

Random points in [0,1]^n

``Xi0= rand(Float64,r,n)``
``````4×3 Array{Float64,2}:
0.742948    0.141712   0.925641
0.00529977  0.0592681  0.902205
0.294066    0.467558   0.949011
0.339742    0.8851     0.810675``````

Moment function of the sum of the Dirac measures of the points Xi0 with weights w0 and its generating series up to degree 3.

``````mt = moment(w0,Xi0)
s = series(mt, monoms(x, 3))``````
``3.3120468991754746 + 0.4269198003937452dx1*dx2*dx3 + 0.5487137640193676dx1^2 + 1.2525893475069072dx2*dx3 + 0.783036721106592dx2^3 + 0.9797706631037382dx1*dx3 + 0.8377829660254306dx2^2dx3 + 2.385288514465678dx3^3 + 0.8817988153146903dx1*dx3^2 + 0.49476133107025977dx1*dx2 + 0.18916915015876168dx1^2dx2 + 2.9573155043999417dx3 + 0.49674301106043944dx1^2dx3 + 0.32485836129926dx1^3 + 1.0931426896163405dx1 + 1.08701240516403dx2*dx3^2 + 1.4515325452107368dx2 + 0.9958780107592893dx2^2 + 0.33316098997739185dx1*dx2^2 + 2.6509864290569904dx3^2``

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

``w, Xi = svd_decompose(s);``
``w``
``````4-element Array{Float64,1}:
0.736486
0.638924
0.950273
0.986364``````
``Xi``
``````4×3 Array{Float64,2}:
0.00529977  0.0592681  0.902205
0.742948    0.141712   0.925641
0.294066    0.467558   0.949011
0.339742    0.8851     0.810675``````