Sparse interpolation

# Sparse interpolation

using PolyExp

A sparse polynomial in 3 variables

X = @ring x1 x2 x3
f = 6.7x1^4*x2^5*x3 + 10.2x1^2*x2*x3^3 - 3.4x1*x2^2*x3
6.7x1^4x2^5x3 + 10.2x1^2x2x3^3 - 3.4x1x2^2x3

The series of moments $f(\zeta^{\alpha})$ for $|\alpha|\leq 3$.

zeta = fill(0.9, length(X))
sigma = series(f, zeta, X,3)
13.499999999999998 + 5.5261037486700015dx1*dx2*dx3 + 6.8223503070000024dx1^2 + 7.774274700000001dx2*dx3 + 7.008371185034148dx2^3 + 7.2252810000000025dx1*dx3 + 6.117862993803001dx2^2dx3 + 6.357388987800002dx3^3 + 5.472820242000001dx1*dx3^2 + 7.5529172763000005dx1*dx2 + 5.495308104980432dx1^2dx2 + 10.405800000000001dx3 + 4.995745656300002dx1^2dx3 + 4.834376094422702dx1^3 + 9.59787dx1 + 5.852477610000002dx2*dx3^2 + 10.382283000000001dx2 + 8.36740554867dx2^2 + 6.217299094482389dx1*dx2^2 + 8.0936982dx3^2

Computing its decomposition using svd

w, Xi = svd_decompose(sigma);

yields the coefficients of the terms of f as the weights w, and the exponents of the monomials of f as the $log_{\zeta}$ of the points Xi:

w
3-element Array{Float64,1}:
-3.4
10.2
6.7
Ex = log(Xi, zeta)
3×3 Array{Float64,2}:
1.0  2.0  1.0
2.0  1.0  3.0
4.0  5.0  1.0