# Wendland Surrogate

The Wendland surrogate is a compact surrogate: it allocates much less memory then other surrogates. The coefficients are found using an iterative solver.

$f = x -> exp(-x^2)$

using Surrogates
using Plots
n = 40
lower_bound = 0.0
upper_bound = 1.0
f = x -> exp(-x^2)
x = sample(n,lower_bound,upper_bound,SobolSample())
y = f.(x)
40-element Vector{Float64}:
0.9978051465960265
0.7415058221170969
0.5299303131915846
0.9156374719519708
0.8369604048668063
0.4274775461437875
0.6367258991486957
0.9708910551210944
0.9465498512981596
0.5831524464477202
⋮
0.9997558891748972
0.999450834440385
0.7603420992361533
0.5497973262437404
0.9279586861644862
0.8532075516884395
0.4461099014964117
0.6567372979278094
0.9782072773172401

We choose to sample f in 30 points between 5 to 25 using sample function. The sampling points are chosen using a Sobol sequence, this can be done by passing SobolSample() to the sample function.

## Building Surrogate

The choice of the right parameter is especially important here: a slight change in ϵ would produce a totally different fit. Try it yourself with this function!

my_eps = 0.5
wend = Wendland(x,y,lower_bound,upper_bound,eps=my_eps)
(::Wendland{Vector{Float64}, Vector{Float64}, Float64, Float64, Vector{Float64}, Int64, Float64, Float64}) (generic function with 1 method)
plot(x, y, seriestype=:scatter, label="Sampled points", xlims=(lower_bound, upper_bound), legend=:top)
plot!(f, label="True function",  xlims=(lower_bound, upper_bound), legend=:top)
plot!(wend, label="Surrogate function",  xlims=(lower_bound, upper_bound), legend=:top)