Created
May 24, 2018 22:51
-
-
Save vutunganh/51af91c7ce5b42789cf72c1ed1e08140 to your computer and use it in GitHub Desktop.
Mereni
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MovingWeightedLeastSquares | |
f(x) = sin(2x)/2 + 10 | |
function t() | |
xs = collect(-6:0.2:6) | |
fs = [f(x) for x in xs] | |
ε = 0.4 | |
w = (d, eps) -> (exp(-d^2)) | |
obj = mwls_naive(xs, fs, ε, w, maxDegree = 5) | |
for x in xs | |
res = obj(x) | |
ref = f(x) | |
@printf("%lf\t%lf\t%lf\t%lf\n", x, res, ref, abs(res - ref)) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment